Page 1 of 1
More IOCs
Posted: Wed Jan 18, 2017 12:14 pm
by Jan Lichtenbelt
I use the 40 pins 16F1939 microchip and programmed it with two IOC's, one at rising edge of pin B0 and the second on rising edge of pin B1. Board EB006 was used for the microchip with the swicthes board EB007 on port B and the LCD EB005 on port D.
But I got wrong results, only B1 gave an interrupt, but on the wrong macro of B0.
Then I extended it to IOCs of
all B-ports. The same results, only the high ports (B7) gives an interrupt to the wrong macro IOC_B0.
Questions: Is it not allowed to use more then one IOC interrupt (with different interrupt macros)?
With kind regards
Jan Lichtenbelt
Re: More IOCs
Posted: Wed Jan 18, 2017 12:55 pm
by LeighM
Hi Jan,
You can only have one IOC interrupt, where you select which pin or pins activate that interrupt.
Re: More IOCs
Posted: Wed Jan 18, 2017 1:56 pm
by Steve001
I have pondered this before and had some light bulb moments
but have wondered on there feasibility or if they would at all work if some one could shed some light or suggestions on them
use diode steering to the interrupt pin then when an interrupt is detected then go see which pin it is
I have also a few of these ic's that I was wanting to play with at a later date just to see what they do
https://en.wikipedia.org/wiki/Intel_825 ... escription
just some idea's I have been thinking about
Steve
Re: More IOCs
Posted: Wed Jan 18, 2017 2:59 pm
by LeighM
The ORing (or rather ANDing for active low interrupts) is the historic way of doing it, although reading the port before the interrupt disappears is the tricky bit :O)
So these "new" IOC ports are a gift
To extend Jan's code, you would need to check the IOCBF register (in the interrupt code) to see which bit(s) caused the interrupt.
Re: More IOCs
Posted: Wed Jan 18, 2017 3:33 pm
by johnsondav
Hi Everyone
I had a similar problem which needed a response to an interrupt which could come from several sources. One of the options which was considered and worked, was to use an inexpensive PIC in addition to the main controller which had been programed to constantly read just one port to handle the interrupt detection and source. When an high was detected on one of the pins, it sent a pulse to the main controller to trigger its interrupt. The interrupt routine interacted with the PIC which had detected the interrupt, to see where the interrupt had originated (4 output pins gives 16 binary). This way, theoretically, you could have up 16 sources checked for an interrupt by one simple dedicated PIC with careful programming on that dedicated interrupt handling PIC.
The main controller just needs to read the 4 output pins to see where the interrupt had originated.
Just food for thought!
Dave
Re: More IOCs
Posted: Thu Jan 19, 2017 11:31 am
by Benj
The IOC_Pulse_Counter example here might be useful as it shows you how to use a single IOC interrupt to count transitions on multiple pins.
http://www.flowcode.co.uk/wikiv7/index.p ... Interrupts