Thread: 60 hz timer

  1. #16
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > unfortunately the machines in the device are both slower and running a lot of processes which causes the software timer to be slow by about 8 seconds per hour.
    But you were using QueryPerformanceCounter?
    Also bear in mind that QPC could give some very odd results if the processor is variably clocked (as in a laptop) to save power.

    What exactly is your embedded device?
    If it's running processes, then that implies a scheduler of some sort as well. Unless the scheduler is entirely cooperative, having a hardware timer interrupt is all but essential.

    Having found the hardware timer, is that stable for your needs?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  2. #17
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by cyberfish View Post
    Meaning you'll probably need to get power from outside, with your own transformer.
    Make sure you wear insulated gloves for this Dr. Frankenstien -- someone might get hurt.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  3. #18
    Registered User
    Join Date
    Jul 2009
    Posts
    50
    Quote Originally Posted by Salem View Post
    > unfortunately the machines in the device are both slower and running a lot of processes which causes the software timer to be slow by about 8 seconds per hour.
    But you were using QueryPerformanceCounter?
    Also bear in mind that QPC could give some very odd results if the processor is variably clocked (as in a laptop) to save power.

    What exactly is your embedded device?
    If it's running processes, then that implies a scheduler of some sort as well. Unless the scheduler is entirely cooperative, having a hardware timer interrupt is all but essential.

    Having found the hardware timer, is that stable for your needs?
    That's quite a good suggestion. We're actually running servers with Quad-core opterons, and after a bit of reading it looks like AMD implemented "Independent Dynamic Core Technology" which clocks each core independently. I'm going to check out if disabling that helps anything. Thanks!

    As for the hardware timer. I'm now trying to devise a software side solution for syncing to a signal over RS-232. The existing implementation is to use ReceiveFrom() to sync via UDP without constantly polling. Anybody know of a similar functionality for RS-232?

  4. #19
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    I'm guessing you've got an OS on top of that lot?

    So which is it?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. hi-res vs. normal timer
    By MK27 in forum C Programming
    Replies: 0
    Last Post: 12-02-2009, 08:53 PM
  2. SIGALRM and timer
    By nkhambal in forum C Programming
    Replies: 1
    Last Post: 06-30-2008, 12:23 AM
  3. tic tac toe crashes :(
    By stien in forum Game Programming
    Replies: 4
    Last Post: 05-13-2007, 06:25 PM
  4. strcat - cannot convert char to const char
    By ulillillia in forum C Programming
    Replies: 14
    Last Post: 12-07-2006, 10:00 AM