Just continuing on from this thread i have my own question about DT Interrupts for the 12F683.
Having looked at the example given by darrell for the generic timer the code below seems unecessary if we know what the values are for the prescaler etc?
Do we need this error checking if we know and are happy with osc/prescaler/freq etc or am i missing something else. It looks like it might take a fair bit of code space?Code:;---[TMR1 reload - interrupt handler]----------------------------------------- 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 - (OSC*1000000/4/Prescaler/Freq) if ((TimerReload < 0) || (TimerReload > (65535-ReloadInst))) error Invalid Timer Values - check "OSC", "Freq" and "Prescaler" endif else error Invalid Prescaler endif ENDASM




Bookmarks