Hello,
I'm currently trying to use at same time both GP2 and on Port change interrupts.
The compilation to .hex failed complaining about unknown iocb variable. I added a #define iocb ioc to the Add defines component to workaround this issue.
So I could build to .hex but only GP2 interrupt works on the board. By the way only GP2 interruption works under simulation (I know it's not a reason for the port chnage interrupt to fail on the breadboard).
Is ther any specific thing to do to make port change interrupt to work with Flowcode?
My first (very) quick read of the asm code seems Ok.
Marc
Interrupt GP2 and Port change on 12F675
Re: Interrupt GP2 and Port change on 12F675
I was not clear, here's an example:
BP0 on GP2: each interrupt makes DEL0 dim (that part runs fine on both flowcode and on the breadboard)
BP1 pn GP0: one interrupt should light on DEL1 (no way to make it run on both flowcode and the breadboard)
The .fcd is attached.
M.
BP0 on GP2: each interrupt makes DEL0 dim (that part runs fine on both flowcode and on the breadboard)
BP1 pn GP0: one interrupt should light on DEL1 (no way to make it run on both flowcode and the breadboard)
The .fcd is attached.
M.
- Attachments
-
- touch_test.fcf
- (8.5 KiB) Downloaded 383 times
Re: Interrupt GP2 and Port change on 12F675
My previous flowcode was not totally correct, in the GP2 interrupt macro I forgot to disable the interrupt.
Here's a corrected version.
M.
Here's a corrected version.
M.
- Attachments
-
- touch_test2.fcf
- (8.5 KiB) Downloaded 361 times
- 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: Interrupt GP2 and Port change on 12F675
Hello
I have attached a corrected version of the program that hopefully should work correctly. Let me know how you get on.
I have attached a corrected version of the program that hopefully should work correctly. Let me know how you get on.
- Attachments
-
- touch_test2.fcf
- (8 KiB) Downloaded 376 times
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
Re: Interrupt GP2 and Port change on 12F675
Hello Benj,
Thanks for your reply.
Here's the result of my tests:
(For info:
- on-change port interrupt enabled on both GP0 and GP1; GP2/INT
enabled;
- GP2/INT macro commands a LED on GP4;
- on-change port macro commands a LED on GP5.)
First, I had a wrong value for one resistor leading to a non-working
LED (the one driven by the on-change port interrupt...);
Once the resistor correctly chosen, I tested your flowcode. It's not
correctly working: the GP5 LED is on from the beginning, I mean since
I switched-on the power-supply. Actually, we need to read the GPIO
just before enabling the on-change port interrupt to provide a correct
state of the GPIO. With that read, the things are better but when a
change occurs on GP2, sometimes the GP5 LED's state changes...).
I found a workaround to this problem: disabling both interrupt inside
GP2/INT macro, then a
intcon.INTE=1;
intcon.GPIE=1;
inside the main while (1) loop (well in fact only on-change port
disabling should be required).
I attached the .fcd, an example is always better than words.
So to sum up, the only bugs I found was the need to add the define for
the iocb variable and the fact flowcode simulation of on-change port
interrupt does not work (this last point is not a bug for me, I
understand that trying to simulate interrupts is not an easy thing)
I have a suggestion, is it possible to provide an example (in the help
or on your examples pages) of on-change port usage? This interrupt is
a bit tricky to use.
Thanks again for your help.
Thanks for your reply.
Here's the result of my tests:
(For info:
- on-change port interrupt enabled on both GP0 and GP1; GP2/INT
enabled;
- GP2/INT macro commands a LED on GP4;
- on-change port macro commands a LED on GP5.)
First, I had a wrong value for one resistor leading to a non-working
LED (the one driven by the on-change port interrupt...);
Once the resistor correctly chosen, I tested your flowcode. It's not
correctly working: the GP5 LED is on from the beginning, I mean since
I switched-on the power-supply. Actually, we need to read the GPIO
just before enabling the on-change port interrupt to provide a correct
state of the GPIO. With that read, the things are better but when a
change occurs on GP2, sometimes the GP5 LED's state changes...).
I found a workaround to this problem: disabling both interrupt inside
GP2/INT macro, then a
intcon.INTE=1;
intcon.GPIE=1;
inside the main while (1) loop (well in fact only on-change port
disabling should be required).
I attached the .fcd, an example is always better than words.
So to sum up, the only bugs I found was the need to add the define for
the iocb variable and the fact flowcode simulation of on-change port
interrupt does not work (this last point is not a bug for me, I
understand that trying to simulate interrupts is not an easy thing)
I have a suggestion, is it possible to provide an example (in the help
or on your examples pages) of on-change port usage? This interrupt is
a bit tricky to use.
Thanks again for your help.
- Attachments
-
- touch_test_working.fcf
- (8.5 KiB) Downloaded 440 times