Hi everyone...
I just had a glace at Darrel Taylors great instant interrupts page (http://darreltaylor.com/DT_INTS-14/intro.html),
and I would like to apply these in the near future.
I would like to learn to have interrupts after a certain amount of time/manually preload the timer.. For example, to
make a light toggle every 70ms, I could use timer 1, prescaler 1:2 and preload of 30536 (thanks Mister E!).
I figured that I could base my code on:
the blinky light code http://darreltaylor.com/DT_INTS-14/blinky.html
the timer template http://darreltaylor.com/DT_INTS-14/TimerTemplate.html
I HAVE 2 QUESTIONS:
QUESTION 1: looking at the blinky light code: Do I understand correctly that the timer is still running while the interrupt handler is executing.
QUESTION 2 deals with altering the timer template code:
I figure it would be easiest for me to changing the code which calculates the timer reload constant. here it is:
ASM ; Calculate Timer Reload Constant
ReloadInst = 8 ; # of Intructions used to reload timer
if ((Prescaler == 1)||(Prescaler == 2)||(Prescaler == 4)||(Prescaler == 8))
MaxCount = 65536 + (ReloadInst / Prescaler)
TimerReload = MaxCount - ((25000 / Freq) * (OSC*10/Prescaler))
if ((TimerReload < 0) || (TimerReload > (65535-ReloadInst)))
error Invalid Timer Values - check "OSC", "Freq" and "Prescaler"
endif
else
error Invalid Prescaler
endif
ENDASM
QUESTION 2: CAN THIS SIMPLY BE REPLACED BY
ASM
TimerReload = 30536
ENDASM
OR HAVE I MISSED SOMETHING?
Bookmarks