Hi !
I have a small question. If i use the following code:
Tmr1 is setup as a counter. If it overflows within one of the the 800us delays, will the interrupt be fired directly, or will it first finish the 800us and then fire ?Code:;==== Dec's for OSC DEFINE OSC 8 'Int OSC @ 8 MHz, for PBP OSCCON = %01110001 'Int OSC @ 8 MHz '==== Interrupt handler on interrupt goto intHANDLER '==== Set defines OPTION_REG = %10000000 'Set Weak pull-ups WPU = %00000000 'Weak pull-ups disabled INTCON = %11000000 'Enable unmasked perhipal interrupts PIE1 = %00000001 'Set TMR1 overflow interrupt PIR1 = %00000000 ' PCON = %00000000 IOC = %00000000 'Interrupt On Change disabled PCON = %00000000 'Ultra lowpower + BOR disabled ANSEL = %00000000 'GPIO 0 Analog TRISIO = %00101000 'GPIO 0,3 inputs GPIO = %00000001 'All I/O low CMCON0 = %00000111 'Comparator off CMCON1 = %00000000 'Output is synced with TMR1 VRCON = %00000000 'Voltage ref. disabled ADCON0 = %00000000 'ADC off T2CON = %00000100 'TMR2 = ON, prescaler = 1:1 T1CON = %10000111 'Timer1 counts 100Hz CCP1CON = %00000000 'CCP engine is off '==== Dec's for variables countLOOP var word synclong var word '==== Initialise variables countLOOP = 0 '==== Set timer1 3000 from overflow synclong = 65535-3000 TMR1H = synclong.highbyte TMR1L = synclong.lowbyte '==== Main program start: GPIO.0 =1 'pulse 1 on pauseus 800 'Pause 800 us GPIO.0 = 0 'pulse 1 off pauseus 800 'pause 800 us goto start '==== The End ======================================================================= theend: 'Endless loop goto theend '==== Interrupt handler DISABLE intHANDLER: 'Disable interrupts intdelay = 1 'Set interrupt has occured bit PIR1.0 = 0 'Clear interrupt TMR1H = synclong.highbyte 'Set Tmr1 3000 from overflow again TMR1L = synclong.lowbyte resume enable
Should i be using the DT instant interrupts ? I've noticed that the DT interrupts can't resume to a specific label, am i right ?
Thanks
UB




Bookmarks