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):
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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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):
thank you
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