This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Using timers and interrupts

Hi,

I am trying to write a program that will perform an action at 30 MHz. I was thinking the way I need to do this is to set a timer that will go off every 1/30th of a second and call an interrupt to perform the action. Does anyone have any example code of how this would be done on an 8051 (ADuC812 specifically) ?

Thanks,
Todd

  • Todd;
    I think you have your math wrong. Your time base (1/30 sec) is about 33.3333Msec not uSec.
    However, look at App note 105 on the Keil website for an interrupt driven timer example.
    Bradford

  • "I think you have your math wrong. Your time base (1/30 sec) is about 33.3333Msec not uSec."

    And he's not the only one confusing his "milli-" with his "mega-" !

    "mega-" is a million (10^6) and is represented by an uppercase 'M';
    "milli-" is a thousandth (10^-3) and is represented by a lowercase 'm'.

    Also, the symbol for the second - the SI unit of time - is a lowercase 's' (uppercase 'S' is siemens, the unit of electrical conductance)

  • Well I had meant 30 Hz so 1/30th of a second was right. And I found some really good powerpoint slides from some class at U-Texas online so I think I got this figured out. Thanks everyone!