PDA

View Full Version : i2cread and timer0 interrupt



robertpoll
- 24th May 2010, 15:02
Hi everyone,

I'm running PBP 2.47 on a 16F887 and have a problem with a timer0 interrupt.

It seems that if the timer0 interrupt happens during an i2cread the handler doesn't get executed until after the i2cread finishes (I'm concluding this based on looking at pin levels on a scope so am pretty confident about this). Does i2cread either 1) disable interrupts or 2) use timer0?

many thanks,

...rob

Bruce
- 24th May 2010, 15:08
I2CREAD does not disable interrupts or use Timer0. If you're using ON INTERRUPT, whatever command is executing at the time of the interrupt will complete first, then the interrupt is serviced.

robertpoll
- 25th May 2010, 19:26
I2CREAD does not disable interrupts or use Timer0. If you're using ON INTERRUPT, whatever command is executing at the time of the interrupt will complete first, then the interrupt is serviced.

Ah, thanks very much for this. I should have read the manual a bit more carefully as it's pretty clear when you look. I'd assumed the picbasic commands were interruptable when you used on interrupt but I'll need to code the interrupt in assembler I think for that to happen.

thanks again,

...rob

Bruce
- 25th May 2010, 19:30
Hi Rob,

You can also use DT_INTS if you prefer not to write any assembler.

robertpoll
- 26th May 2010, 20:28
Thanks for the DT_INTS tip - it looks good!

...rob