ECIO Interrupt

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
frankmortensen
Posts: 24
Joined: Wed Feb 17, 2010 12:27 pm
Location: Danmark Fyn
Been thanked: 1 time

ECIO Interrupt

Post by frankmortensen »

Hello.
I will have A0 = 0 when I switch B1 from low to high, with an interrupt function.
My little program works fine in the simulation, but in hardware it seems that it interrupts all the time without me touching port B.
I've tried to put B0 to B7 low without it helped.
I use a ECIO40P
What do I do wrong ?
video lys off.fcf
(6.5 KiB) Downloaded 301 times

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: ECIO Interrupt

Post by Benj »

Hello,

Sounds like your input might be floating. Are you pulling the input pin to VDD or VSS using a resistor when the switch is not pressed?

frankmortensen
Posts: 24
Joined: Wed Feb 17, 2010 12:27 pm
Location: Danmark Fyn
Been thanked: 1 time

Re: ECIO Interrupt

Post by frankmortensen »

yes I've tried to connect all port B directly to ground.
but it makes no difference.

frankmortensen
Posts: 24
Joined: Wed Feb 17, 2010 12:27 pm
Location: Danmark Fyn
Been thanked: 1 time

Re: ECIO Interrupt

Post by frankmortensen »

I found the solution myself.
when ecio get power from USB port, it will interrupt all the time even when the gate b1 is connected to ground.
but when it is powered from an external source, there are no problems.
I also had to move reactivating the interrupt from interupt routine to the main program if it was in interupt routine, the interrupt was activated, all the time.
I do not understand it but now it works.
Here are pictures of the new program.
main.jpg
main.jpg (29.06 KiB) Viewed 4975 times
interupt.jpg
interupt.jpg (14.26 KiB) Viewed 4975 times

Gary Freegard
Posts: 45
Joined: Mon Nov 07, 2011 6:36 pm
Has thanked: 1 time
Been thanked: 30 times

Re: ECIO Interrupt

Post by Gary Freegard »

Hi

I have created two new version for you. The first is the same as yours but without the disabling and re enabling the interrupt.
The other has the control of the output in the main loop, the interrupt just flips a variable between 0 and 255. In the main loop the program checks this variable , if 255 the output on, wait 3 sec , output off, set variable to 0.
When writing interrupts macros its best to keep them as small as possible and try to do everything in the main loop. In your program it isn’t so important but if you start developing it further you could encounter problems, due to the fact the interrupt is disabled on entry to the interrupt macro and is enabled on exit.

Merry Christmas
Gary

PS This works on USB powered ECIO
Attachments
video lys off.fcf
(6.5 KiB) Downloaded 276 times
video lys off 2.fcf
(5.5 KiB) Downloaded 256 times

frankmortensen
Posts: 24
Joined: Wed Feb 17, 2010 12:27 pm
Location: Danmark Fyn
Been thanked: 1 time

Re: ECIO Interrupt

Post by frankmortensen »

Thank you,
but I think I have to stop interrupt while I pause, because it will not be triggered by a single pulse but of a whole series of pulses.
and only the rising edge at the first pulse I will trigger on until the break is gone.

Gary Freegard
Posts: 45
Joined: Mon Nov 07, 2011 6:36 pm
Has thanked: 1 time
Been thanked: 30 times

Re: ECIO Interrupt

Post by Gary Freegard »

Hi

The second program will ignore subsequent interrupts until the variable is set to 0.

Gary

Post Reply