More IOCs

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 7.

Moderator: Benj

Post Reply
User avatar
Jan Lichtenbelt
Posts: 797
Joined: Tue Feb 17, 2009 8:35 pm
Location: Haren GN, the Netherlands
Has thanked: 128 times
Been thanked: 264 times
Contact:

More IOCs

Post 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
Test_IOC_16F1939.fcfx
(18.88 KiB) Downloaded 283 times

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times

Re: More IOCs

Post by LeighM »

Hi Jan,
You can only have one IOC interrupt, where you select which pin or pins activate that interrupt.

Steve001
Valued Contributor
Valued Contributor
Posts: 1189
Joined: Wed Dec 31, 2008 3:37 pm
Has thanked: 460 times
Been thanked: 523 times

Re: More IOCs

Post by Steve001 »

I have pondered this before and had some light bulb moments :roll:

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
Success always occurs in private and failure in full view.

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times

Re: More IOCs

Post 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 :D

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.

johnsondav
Posts: 188
Joined: Thu Jun 28, 2012 7:29 pm
Location: Durham
Has thanked: 86 times
Been thanked: 186 times

Re: More IOCs

Post 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

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: More IOCs

Post 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

Post Reply