Hello,
I've noticed that on the PIC 16F18326, interrupts always trigger on both edges when a falling edge is set. This applies to the IOC and INT pins.
Regards
PIC16F18326 Interrupt error
-
DirkB
- Posts: 105
- http://meble-kuchenne.info.pl
- Joined: Thu Dec 10, 2020 3:55 pm
- Has thanked: 1 time
- Been thanked: 4 times
-
mnfisher
- Valued Contributor
- Posts: 1936
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 157 times
- Been thanked: 911 times
Re: PIC16F18326 Interrupt error
Can you post a simple demo showing this?
Looking at the datasheet - bits are set in IOCxP and IOCxN for rising and falling edge interrupts - both to detect both.
I added an IOC interrupt to a chart and selected some pins (the 'selection' image is too small - and I couldn't find keys to enlarge it) - then looking at the code generated:
Which looks okay?
Martin
Looking at the datasheet - bits are set in IOCxP and IOCxN for rising and falling edge interrupts - both to detect both.
I added an IOC interrupt to a chart and selected some pins (the 'selection' image is too small - and I couldn't find keys to enlarge it) - then looking at the code generated:
Code: Select all
// Interrupt
st_bit(INTCON,GIE);
IOCAP=0x28;
IOCAN=0x18;
IOCCP=0x0;
IOCCN=0x0;
st_bit(PIE0, IOCIE);
Martin
Re: PIC16F18326 Interrupt error
Hi Martin,
these are exactly the entries (C code) in my interrupt handler. It works with other chips such as the 16F1825/27, the 18F14K22, and many others as well. You have to use a chip. In the simulation, it almost always works, even if it doesn't work on the chip.
these are exactly the entries (C code) in my interrupt handler. It works with other chips such as the 16F1825/27, the 18F14K22, and many others as well. You have to use a chip. In the simulation, it almost always works, even if it doesn't work on the chip.