The wait command documentation on the help menu does not specify if interrupts are disabled while waiting for a set amount of time. I need to wait for serial port input (interrupt driven) before I continue. Are interrupts allowed while on wait?
Otherwise I have to use Timer 1 (on a 16F648):
TMR1 = 0xFFFF
T1CON.TMR1ON = 1 'start timer 1 (524 ms)
wait until PIR1.TMR1IF = 1 'wait for timeout
T1CON.TMR1ON = 0 'stop timer 1
Your code isn't really relying on an interrupt.
The timer interrupt flag will get set when the timer overflows even if interrupts are disabled.
This allows you to monitor (or also called polling) the flag bit to see if it's overflowed.
The difference between this and interrupts is the latency. An interrupt will almost immediately respond to the flag being set and jump to a separate interrupt service routine. Polling can take a while to react depending on what's being done while polling.
Your simple example should work fine, though I haven't tried it out. You'll need to clear that TMR1IF flag though after you respond or before you enter this routine again because its not automatically reset.
You can get the same results with this I believe:
wait 52 10ms
wait 4 ms
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.