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 ?
ECIO Interrupt
Moderator: Benj
-
frankmortensen
- Posts: 24
- Joined: Wed Feb 17, 2010 12:27 pm
- Location: Danmark Fyn
- Been thanked: 1 time
- 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
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?
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?
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
frankmortensen
- Posts: 24
- Joined: Wed Feb 17, 2010 12:27 pm
- Location: Danmark Fyn
- Been thanked: 1 time
Re: ECIO Interrupt
yes I've tried to connect all port B directly to ground.
but it makes no difference.
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
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.
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.
-
Gary Freegard
- Posts: 45
- Joined: Mon Nov 07, 2011 6:36 pm
- Has thanked: 1 time
- Been thanked: 30 times
Re: ECIO Interrupt
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
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
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.
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
Hi
The second program will ignore subsequent interrupts until the variable is set to 0.
Gary
The second program will ignore subsequent interrupts until the variable is set to 0.
Gary