Clearing Pins - Simulates Correctly Not Hardware....

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Post Reply
Sparkoids
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....

Post by Sparkoids »

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 :-}

User avatar
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....

Post by Enamul »

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.
Enamul
University of Nottingham
enamul4mm@gmail.com

Sparkoids
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....

Post by Sparkoids »

This one should go Red, Orange, Green but goes Red, Orange, Off Orange Green in hardware!

Help!!


James :-{
Attachments
LED_TEST.fcf
Cycle two LED's....
(17.52 KiB) Downloaded 255 times

Sparkoids
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....

Post by Sparkoids »

Meant to say ECIO28 Port C0, C1 and C2 active high....

User avatar
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....

Post by Enamul »

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.
Enamul
University of Nottingham
enamul4mm@gmail.com

Sparkoids
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....

Post by Sparkoids »

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 :-{

User avatar
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....

Post by Enamul »

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.
Enamul
University of Nottingham
enamul4mm@gmail.com

Sparkoids
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....

Post by Sparkoids »

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....

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: Clearing Pins - Simulates Correctly Not Hardware....

Post by Benj »

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.

Sparkoids
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....

Post by Sparkoids »

I'll try the 1ms delay now Ben...

Sparkoids
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....

Post by Sparkoids »

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!!

Sparkoids
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....

Post by Sparkoids »

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...

User avatar
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....

Post by Enamul »

Ohh..very sad for the time you have spent..But the problem is solved that good news.
Enamul
University of Nottingham
enamul4mm@gmail.com

Post Reply