Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
07/01/02 03:51
Read: times


 
#25029 - RE: timer tick handling
Pranav,

The code below handles one hardware based timer tick and activities associated with that tick, as well as handling a one second and ten second software based tick and those activities. It does NOT check for frame overruns. It is the programmer's responsibility using this method to assure every possible scenario will not cause an overrun. Frame overrun notification can be had in some commercially available RTOS's.

Good Luck,

BrucelMainProgramLoop:

; has 1/30th of a second elapsed yet?

jnb bFlag30HzTimer, lMain_EveryLoop

; do the stuff below every 33.48 msec

lcall p30msControlOuts
lcall p30msControlIns ; look at button ports, debounce buttons,
; use them to generate events, mark LEDs for
; flashing to indicate goal states
lcall pProcessEvents ; turn events into goal states for the state
; sequencer
lcall pFlashLEDs ; flash leds marked for flashing by updating
; the bits in dLEDVirtualPort

lcall pReadADC

lcall pOneHzTimer ; add 1 (33.48 msec) to the one hz "timer"
clr bFlag30HzTimer ; clear flag until timer toggles it again

; has 1 second elapsed yet?

jnb bFlag1HzTimer, lMain_EveryLoop

; do the stuff below once per second

clr bFlag1HzTimer
lcall p10SecondTimer ; add 1 (one sec) to the ten sec "timer"

; has 10 sec elapsed yet?

jnb bFlag10SecondTimer, lMain_EveryLoop

; do the stuff below once every 10 seconds

clr bFlag10SecondTimer

; do this stuff every loop (not on 33.48ms timer)

lMain_EveryLoop:

lcall pUARTInputProcessor
lcall pTransmitBytes
lcall pStateSequencer
lcall pUpdateDigitalPot

; tasks are complete, wait 'til another tick occurs

jmp lMainProgramLoop



List of 16 messages in thread
TopicAuthorDate
timer tick handling            01/01/70 00:00      
RE: timer tick handling            01/01/70 00:00      
RE: timer tick handling            01/01/70 00:00      
RE: timer tick handling            01/01/70 00:00      
RE: timer tick handling            01/01/70 00:00      
RE: timer tick handling            01/01/70 00:00      
RE: timer tick handling            01/01/70 00:00      
RE: timer tick handling            01/01/70 00:00      
RE: timer tick handling            01/01/70 00:00      
RE: timer tick handling            01/01/70 00:00      
RE: timer tick handling            01/01/70 00:00      
RE: timer tick handling            01/01/70 00:00      
RE: timer tick handling            01/01/70 00:00      
RE: timer tick handling            01/01/70 00:00      
RE: timer tick handling            01/01/70 00:00      
RE: timer tick handling            01/01/70 00:00      

Back to Subject List