PDA

View Full Version : on interupt with pic 16F619



cpayne
- 28th March 2008, 21:58
I am trying to figure out how to do a interupt. How do I do an interupt on an I2C Flag? I have tried this, but its not working. Thanks, Charlie

on Interrupt goto myint
intcon = PIR1.3 'SSPIF


myint:
disable
INTCON.1 = 0 'disable interupt
'do stuff
enable
resume

Thanks,
Charlie

mister_e
- 29th March 2008, 00:24
Have a look at the example provided in the manual, even if they don't use the same interrupt source, this should give you some tips.

You could still do a search with ON INTERRUPT within this forum.

cpayne
- 29th March 2008, 01:04
I have searched around some and found some good tips, but have not been able to find the exact interupt I am wanting to do. I have changed the interupt code based on the examples, but I am still not getting the interupt to trigger off the I2C interupt. Thanks, cp

on Interrupt goto myint
INTCON.6 = 1 ' PEIE = Peripheral Interrupt Enable bit
PIR1.3 = 1 ' I2C interrupt enable
enable

mister_e
- 29th March 2008, 01:12
Check once again all peripheral register and also the MSSP section of your datasheet, maybe you have to select a specific mode in X register(s)... 7 bits+start/stop int or something like that.

More tha often the datasheet will give you some tips how to set/use int flags.

I never dared to open your datasheet to check it :o

cpayne
- 29th March 2008, 17:39
I have read the data sheet and can't seem to find anything. I noticed some other chips have a SSPCON2 register, bit 7 looks like what I need.

GCEN: General Call Enable bit (In I2C Slave mode only)
1 = Enable interrupt when a general call address (0000h) is received in the SSPSR
0 = General call address disabled

The 16F819 does not have this register. I am stuck with the 18 pin interal osc with some analogs and I2C form, but I would really prefer getting the 16F819 working with an interupt. I have an 16F88, but that also does not have the SSPCON2 register either...