View previous topic :: View next topic |
Author |
Message |
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
Best method for clearing interrupt in PIC18F458? |
Posted: Tue Jun 22, 2004 3:02 am |
|
|
In the CCS compiler the function clear_interrupt(int_ext) clears the interrupt by resetting the INTCON.INT0IF bit.
But in the datasheets for the PIC18F458 the description for the INTCON register bit INT0IF states: 'The INT0 external interrupt occurred (must be cleared in software by reading PORTB)'.
The CCS code is working, but now I'm wondering: Is the datasheet wrong or is the CCS code working because of some undocumented features in the hardware? |
|
|
Ttelmah Guest
|
Re: Best method for clearing interrupt in PIC18F458? |
Posted: Tue Jun 22, 2004 8:00 am |
|
|
ckielstra wrote: | In the CCS compiler the function clear_interrupt(int_ext) clears the interrupt by resetting the INTCON.INT0IF bit.
But in the datasheets for the PIC18F458 the description for the INTCON register bit INT0IF states: 'The INT0 external interrupt occurred (must be cleared in software by reading PORTB)'.
The CCS code is working, but now I'm wondering: Is the datasheet wrong or is the CCS code working because of some undocumented features in the hardware? |
That would appear to be an error in the data sheet. The 'B change' interrupts, require the register to be read to properly clear them (this resets the 'comparison' latch for the port), otherwise if the condition is still 'changed' from the last read, and the interrupt flag is cleared, the bit will immediately be set again. However this does not apply for the EXT interrups.
This comment appears to have been put on the wrong line in the data sheet.
If you compare the register entries here with those for the 18F452 (where this register is the same), this comment does not appear, but a comment does appear below the B change interrupt, saying that the port must be read.
Best Wishes |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Tue Jun 22, 2004 9:08 am |
|
|
Thanks. I already thought so, but wanted to make sure. |
|
|
|