Switch and LED logic
Switch and LED logic
Logic for switches and LEds. great for your test circuits using e-blocks which I have however for real circuits I need switches to pull inputs low as well as high. LEDS on states that are eather low or high. Can the logic be changed as an option in flow code. I have the professional versions of PIC, AVR and ARM. Having to go through code to change logic after running is time consumming and leads to errors etc. Other wise Flowcode is good software.
Regards
JohnF
Regards
JohnF
- 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: Switch and LED logic
Hello John
Rather then switches to pull the inputs low and high why not just use one to pull high and then use a pull down resistor. Otherwise when neither your pull up or pull down switch is pressed the I/O pin will be floating and may lead to errors.
As for the LEDOn and LEDOFF functions yes you can globally change this to do the opposite function by editing the LEDs_Code.c file in your Flowcode V3/Components directory.
Rather then switches to pull the inputs low and high why not just use one to pull high and then use a pull down resistor. Otherwise when neither your pull up or pull down switch is pressed the I/O pin will be floating and may lead to errors.
As for the LEDOn and LEDOFF functions yes you can globally change this to do the opposite function by editing the LEDs_Code.c file in your Flowcode V3/Components directory.
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: Switch and LED logic
Hi
I have a circuit designed with interfaces useing exting components on another board, it has LED.s to supply and ground so I need to be able to set up LEDs in both modes.
Also switches due to interfaces are also both ways to ground or Supply. the ability to change this within flowcode would make life much easier and should be part of the launguage anyway.
for instance if you even had a setting for a hole bank at a time would be OK as you could use multiple banks if neccessary.
Due to the fact that I and other users have spend a lot off money on this system, can it be updated or at least let us know how we can change the software to meet the above.
JohnF
I have a circuit designed with interfaces useing exting components on another board, it has LED.s to supply and ground so I need to be able to set up LEDs in both modes.
Also switches due to interfaces are also both ways to ground or Supply. the ability to change this within flowcode would make life much easier and should be part of the launguage anyway.
for instance if you even had a setting for a hole bank at a time would be OK as you could use multiple banks if neccessary.
Due to the fact that I and other users have spend a lot off money on this system, can it be updated or at least let us know how we can change the software to meet the above.
JohnF
Re: Switch and LED logic
The problem is interfaces from other circuits can be simulated manualy in flowcode if you can change direction of switchs and LEDs on a bank by bank basses. if leds.c can be modified so that for instance LEds(0) can be on Low and LEDs(1) can be on high. then that is a usfull mod. Can this be done within LEDs.c ?? if so how? also can same be done with Switch's this would make life much easier in developing code for interfaces.
JohnF
JohnF
- 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: Switch and LED logic
Hello John
This can be done but it involves a component update from our end which will create some knock on problems as previous programs using old LED / Switches components will not open properly. Therefore it is not as simple as it seems and will require a fair amount of work to get right.
I will pass this onto the Flowcode engineer and see what he thinks. Possible that this functionality will be included with Flowcode V4.
This can be done but it involves a component update from our end which will create some knock on problems as previous programs using old LED / Switches components will not open properly. Therefore it is not as simple as it seems and will require a fair amount of work to get right.
I will pass this onto the Flowcode engineer and see what he thinks. Possible that this functionality will be included with Flowcode V4.
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: Switch and LED logic
How long before version 4. As it means I can't use flowcode for this project and will need to find other software
JohnF
JohnF
- Steve
- Matrix Staff
- Posts: 3424
- Joined: Tue Jan 03, 2006 3:59 pm
- Has thanked: 114 times
- Been thanked: 422 times
- Contact:
Re: Switch and LED logic
We're looking at a January release for v4.
But you should be able to get it to work fairly easy with your existing version of Flowcode. All you need to do is change the C code behind the switch and LED components. Please explain what you need and we'll look at producing some appropriate code for you.
But you should be able to get it to work fairly easy with your existing version of Flowcode. All you need to do is change the C code behind the switch and LED components. Please explain what you need and we'll look at producing some appropriate code for you.
- 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: Switch and LED logic
Hello John
Flowcode V4 should arrive near the end of the year, so it depends on how long you have to do your project. You could do the program now and then simply edit the component properties in your program once V4 is released. Alternativly you could create a list of all the components that will require the reverse polarity and when ever you are editing those particular component you can switch the logic. I cant see how you would be able to acheive your program without doing this on another compiler anyway.
Flowcode V4 should arrive near the end of the year, so it depends on how long you have to do your project. You could do the program now and then simply edit the component properties in your program once V4 is released. Alternativly you could create a list of all the components that will require the reverse polarity and when ever you are editing those particular component you can switch the logic. I cant see how you would be able to acheive your program without doing this on another compiler anyway.
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
- 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: Switch and LED logic
Brainwave!!!
Ok what you can do is use the normal LED component to set the LEDs that are the correct polarity. Then you can use the custom component to do the reverse polarity LEDs. This would allow you to use on and off macros to actually switch the reverse LEDs on and off. Unfortunatly this would not simulate as the custom component is C code based only.
Ok what you can do is use the normal LED component to set the LEDs that are the correct polarity. Then you can use the custom component to do the reverse polarity LEDs. This would allow you to use on and off macros to actually switch the reverse LEDs on and off. Unfortunatly this would not simulate as the custom component is C code based only.
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
- 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: Switch and LED logic
Hi John
Ok just been chatting with the Flowcode designer and he suggested a way to do your program that would simulate (though not inverted) and also would allow you to define the components as positive and negative. To acheive this the LED components would have to be different sizes eg normal LED component has 3 LEDs and reversed LED component has 2 LEDs. Let me know if you think this functionality would help.
Ok just been chatting with the Flowcode designer and he suggested a way to do your program that would simulate (though not inverted) and also would allow you to define the components as positive and negative. To acheive this the LED components would have to be different sizes eg normal LED component has 3 LEDs and reversed LED component has 2 LEDs. Let me know if you think this functionality would help.
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: Switch and LED logic
Yes
As a matter of fact there is 3 LEDs positive the way it is now and two negative. so yes this would indeed help. I have posponed this work until thursday as I have other pressing things to get on with. however I have this code to develope over next fortnight. So anything that helps would be good. Is your programmer going to implement the changes in next version? and if you could give me full details on how to implement this change it would be helpfull.
maybe send mods as attachment
Regards
JohnWF
As a matter of fact there is 3 LEDs positive the way it is now and two negative. so yes this would indeed help. I have posponed this work until thursday as I have other pressing things to get on with. however I have this code to develope over next fortnight. So anything that helps would be good. Is your programmer going to implement the changes in next version? and if you could give me full details on how to implement this change it would be helpfull.
maybe send mods as attachment
Regards
JohnWF
Re: Switch and LED logic
Hi Benj
Stil waitting on your 3 and 2 led mod which would help enormously, as I am getting cinfused as what led should be on when it is off. and what switch is active when off. Any little will help.
Regards
JohnF
Stil waitting on your 3 and 2 led mod which would help enormously, as I am getting cinfused as what led should be on when it is off. and what switch is active when off. Any little will help.
Regards
JohnF
- Steve
- Matrix Staff
- Posts: 3424
- Joined: Tue Jan 03, 2006 3:59 pm
- Has thanked: 114 times
- Been thanked: 422 times
- Contact:
Re: Switch and LED logic
Hello John,
The attached mod might work for you. I have edited the component code so that if there are 2 LEDs on a component, the code for turning the LEDs on and off is essentially reversed. This should give you the functionality you require, as long as you use the macros LEDon and LEDoff to set and clear the LEDs.
Just make a backup of the existing LEDs_Code.c file and then save the attached in its place. It will be in the "Components" subfolder of the Flowcode directory. You will also need to add the following line into the "Defines" section of the "Supplementary code" window:
The attached mod might work for you. I have edited the component code so that if there are 2 LEDs on a component, the code for turning the LEDs on and off is essentially reversed. This should give you the functionality you require, as long as you use the macros LEDon and LEDoff to set and clear the LEDs.
Just make a backup of the existing LEDs_Code.c file and then save the attached in its place. It will be in the "Components" subfolder of the Flowcode directory. You will also need to add the following line into the "Defines" section of the "Supplementary code" window:
Code: Select all
#define MX_ALLOW_SWAP_POLARITY 1
- Attachments
-
- LEDs_Code.c
- (4.5 KiB) Downloaded 324 times
Re: Switch and LED logic
Steve
Thanks for code I will try it out today. I hope that version 4 has this functionality built in. Also be good if you could have a square wave oscilator to feed into the chip for text purposes. Looking foreward to the new code later in year.
JohnF
Thanks for code I will try it out today. I hope that version 4 has this functionality built in. Also be good if you could have a square wave oscilator to feed into the chip for text purposes. Looking foreward to the new code later in year.
JohnF