Clearing Pins - Simulates Correctly Not Hardware....
Moderator: Benj
-
- Posts: 267
- Joined: Mon Sep 14, 2009 10:34 am
- Has thanked: 30 times
- Been thanked: 19 times
- Contact:
Clearing Pins - Simulates Correctly Not Hardware....
I have a program where I have made up a Macro to control a Bi-Colour LED and send a '1' to either the Green, Red or Both. To speed up the process I have made four Macros; RED_ON. ORANGE_ON, GREEN_ON and LED_OFF obviously send a combination of '1's and '0's.
In Flowcode 5 everything works perfectly on the computer but when I send it to the ECIO and try to turn the LED Orange (both C1 and C2 get a '1' sent in my config) from Green (C1 = '0', C2 = '1') the LED turns itself off until I next select Green.
I have tested a simple program which changes the LED Green, Orange then Red every second and that is fine but this is flummoxing me frankly and I wonder if I should be clearing ports or not sending two '1's if one of the pins is already at '1' - especially as I don't want to go back through my code.
Any ideas before I launch my ECIO and EBlocks across the room please!!
James :-}
In Flowcode 5 everything works perfectly on the computer but when I send it to the ECIO and try to turn the LED Orange (both C1 and C2 get a '1' sent in my config) from Green (C1 = '0', C2 = '1') the LED turns itself off until I next select Green.
I have tested a simple program which changes the LED Green, Orange then Red every second and that is fine but this is flummoxing me frankly and I wonder if I should be clearing ports or not sending two '1's if one of the pins is already at '1' - especially as I don't want to go back through my code.
Any ideas before I launch my ECIO and EBlocks across the room please!!
James :-}
- Enamul
- Posts: 1772
- Joined: Mon Mar 05, 2012 11:34 pm
- Location: Nottingham, UK
- Has thanked: 271 times
- Been thanked: 814 times
- Contact:
Re: Clearing Pins - Simulates Correctly Not Hardware....
Can you please post your program here so that we can match what are you saying? I want to test it in hardware as well.
-
- Posts: 267
- Joined: Mon Sep 14, 2009 10:34 am
- Has thanked: 30 times
- Been thanked: 19 times
- Contact:
Re: Clearing Pins - Simulates Correctly Not Hardware....
This one should go Red, Orange, Green but goes Red, Orange, Off Orange Green in hardware!
Help!!
James :-{
Help!!
James :-{
- Attachments
-
- LED_TEST.fcf
- Cycle two LED's....
- (17.52 KiB) Downloaded 255 times
-
- Posts: 267
- Joined: Mon Sep 14, 2009 10:34 am
- Has thanked: 30 times
- Been thanked: 19 times
- Contact:
Re: Clearing Pins - Simulates Correctly Not Hardware....
Meant to say ECIO28 Port C0, C1 and C2 active high....
- Enamul
- Posts: 1772
- Joined: Mon Mar 05, 2012 11:34 pm
- Location: Nottingham, UK
- Has thanked: 271 times
- Been thanked: 814 times
- Contact:
Re: Clearing Pins - Simulates Correctly Not Hardware....
Can post the link of the LED please? As I can't find anything wrong with the code..only you could mask 1 and 2 bit to send the command in one line..rest are fine.
-
- Posts: 267
- Joined: Mon Sep 14, 2009 10:34 am
- Has thanked: 30 times
- Been thanked: 19 times
- Contact:
Re: Clearing Pins - Simulates Correctly Not Hardware....
Hi Enamul,
If you have the LED Eblock it works on that OK - I have my LED active hight with in series resistors to get the right colours if you get me but set up the Eblock and you will see what I mean...
Not sure what you mean regarding the masking though - is the code OK because it doesn't work in hardware :-{
If you have the LED Eblock it works on that OK - I have my LED active hight with in series resistors to get the right colours if you get me but set up the Eblock and you will see what I mean...
Not sure what you mean regarding the masking though - is the code OK because it doesn't work in hardware :-{
- Enamul
- Posts: 1772
- Joined: Mon Mar 05, 2012 11:34 pm
- Location: Nottingham, UK
- Has thanked: 271 times
- Been thanked: 814 times
- Contact:
Re: Clearing Pins - Simulates Correctly Not Hardware....
Your code is ok ignore masking. I can see that it should work with led E-block. It seems to me something wrong in bi-colour that's why I want to see it's datasheet.
-
- Posts: 267
- Joined: Mon Sep 14, 2009 10:34 am
- Has thanked: 30 times
- Been thanked: 19 times
- Contact:
Re: Clearing Pins - Simulates Correctly Not Hardware....
Hi Enamul,
No the code doesn't work on the Eblock EB_004 LED board either so it is not the Bi-Colour that is at fault. It's weird but I think it must be something to do with the ports being cleared or not being cleared.
Maybe there is a bug in the Flowcode 5 program....
No the code doesn't work on the Eblock EB_004 LED board either so it is not the Bi-Colour that is at fault. It's weird but I think it must be something to do with the ports being cleared or not being cleared.
Maybe there is a bug in the Flowcode 5 program....
- 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: Clearing Pins - Simulates Correctly Not Hardware....
Hello James,
Doubtful it's a bug in Flowcode if you are just toggling I/O.
Might be worth adding a 1 ms delay in between in the output icons in the orange / red / green and off macros to ensure the read / modify / write process is working ok.
Another way to do this would be to write to both pins at once using an output icon in port mode instead of pin mode and using masking to only alter the LED pins.
Doubtful it's a bug in Flowcode if you are just toggling I/O.
Might be worth adding a 1 ms delay in between in the output icons in the orange / red / green and off macros to ensure the read / modify / write process is working ok.
Another way to do this would be to write to both pins at once using an output icon in port mode instead of pin mode and using masking to only alter the LED pins.
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
-
- Posts: 267
- Joined: Mon Sep 14, 2009 10:34 am
- Has thanked: 30 times
- Been thanked: 19 times
- Contact:
Re: Clearing Pins - Simulates Correctly Not Hardware....
Is there anything weird in Ports C1 and C2 on an ECIO because it is still playing up and I've run out of ideas! I have a 1 second delay between Call Macro for RED, Delay 1 Second, Call Macro for OFF, Delay 1 Second, Call Macro for Green etc etc
It is supposed to go RED, OFF, ORANGE, OFF, GREEN, OFF looping
It is going RED, ORANGE, OFF, GREEN, ORANGE, OFF, etc - all wrong!!
It is supposed to go RED, OFF, ORANGE, OFF, GREEN, OFF looping
It is going RED, ORANGE, OFF, GREEN, ORANGE, OFF, etc - all wrong!!
-
- Posts: 267
- Joined: Mon Sep 14, 2009 10:34 am
- Has thanked: 30 times
- Been thanked: 19 times
- Contact:
Re: Clearing Pins - Simulates Correctly Not Hardware....
This is my fault - I had exported some Macro's and reused them although I was using a Bi-Colour LED that was Active High and not Active Low :-{
Believe it or not I spent four hours of my life and built 3 different veroboard circuits and tested with a logic probe before actually reading what the Flowcode external properties box was telling me DOH!!
Thanks for all the info and help guys...
Believe it or not I spent four hours of my life and built 3 different veroboard circuits and tested with a logic probe before actually reading what the Flowcode external properties box was telling me DOH!!
Thanks for all the info and help guys...
- Enamul
- Posts: 1772
- Joined: Mon Mar 05, 2012 11:34 pm
- Location: Nottingham, UK
- Has thanked: 271 times
- Been thanked: 814 times
- Contact:
Re: Clearing Pins - Simulates Correctly Not Hardware....
Ohh..very sad for the time you have spent..But the problem is solved that good news.