Does anyone know how to use SwitchBank(0) and it's macro "ReadState" I have been working on this for the last 2 hours. No help under HELP , no Flowcode 5 examples for SwitchBank/ReadState , Did a search only found where there was a problem that was fixed (not sure that is true). The only bit that seems to works is bit 0. I can attach the code but it is very simple.
Component Switchbank(0) select readstate(input) "input is defined a byte" Output (input) to a led array.
SwitchBank(0) and readstate
Moderator: Benj
- 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: SwitchBank(0) and readstate
Hi Errol,
Please can you attach your program so we can see what your doing.
Please can you attach your program so we can see what your doing.
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: SwitchBank(0) and readstate
Hi Ben
Here is my FlowCode program . It is the start of a display program that I'm putting together for a Reflow oven project, so it not complete.
Thank for your help
Here is my FlowCode program . It is the start of a display program that I'm putting together for a Reflow oven project, so it not complete.
Thank for your help
- Attachments
-
- Display Thermocouple.fcf
- (14.23 KiB) Downloaded 273 times
-
- Posts: 1314
- Joined: Sun Jan 15, 2012 3:15 pm
- Has thanked: 474 times
- Been thanked: 458 times
- Contact:
Re: SwitchBank(0) and readstate
Hi Errol
TRy the attached code you were almost there comments added to code to show the errors
Regards
Dazz
TRy the attached code you were almost there comments added to code to show the errors
Regards
Dazz
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: SwitchBank(0) and readstate
Hi Errol,
The SwitchBank component macro is not being used correctly as you have seen it's not working as expected within your flowchart.
Switch Bank is for reading one switch at a time only!.
If you right click on the swichbank on the control panel and select Ext properties, you will see the numbers from 0 to 7
This is the number you require for reading a switch.
For example if you want to read switch 2 (STORE), then a number 2 or a variable assigned with 2 is placed in WhichSwitch Byte.
The value of pin switch is connected to will be returned in a variable placed Return Value (BYTE).
For example: If pull up resistors are used and switch is closed.
Then i/p connected to switch 2 will drop to 0V then when the above component macro is accessed, since i/p = 0V then sw_input will be assigned a 0
If switch is opened so i/p increased to 5V, then when above component macro is accessed, since i/p = 5V then sw_input variable will be assigned a 1
So for reading more than 1 switch you either need to use SwitchBank in a loop (see attached flowchart)
Or you take the more common approach and use the input icon like Dazz has posted.
In that flowchart the Switch bank is redundant, so it can be deleted.
Hope this helps
Martin
The SwitchBank component macro is not being used correctly as you have seen it's not working as expected within your flowchart.
Switch Bank is for reading one switch at a time only!.
If you right click on the swichbank on the control panel and select Ext properties, you will see the numbers from 0 to 7
This is the number you require for reading a switch.
For example if you want to read switch 2 (STORE), then a number 2 or a variable assigned with 2 is placed in WhichSwitch Byte.
The value of pin switch is connected to will be returned in a variable placed Return Value (BYTE).
For example: If pull up resistors are used and switch is closed.
Then i/p connected to switch 2 will drop to 0V then when the above component macro is accessed, since i/p = 0V then sw_input will be assigned a 0
If switch is opened so i/p increased to 5V, then when above component macro is accessed, since i/p = 5V then sw_input variable will be assigned a 1
So for reading more than 1 switch you either need to use SwitchBank in a loop (see attached flowchart)
Or you take the more common approach and use the input icon like Dazz has posted.
In that flowchart the Switch bank is redundant, so it can be deleted.
Hope this helps
Martin
- Attachments
-
- Display Thermocouple V1.fcf
- Using switch bank command
- (17 KiB) Downloaded 293 times
Martin
Re: SwitchBank(0) and readstate
I want to thank Dazz and Medelec35 for the code and the input. You both must have spent a lot of time working this out the first time.
Ben: My question to Support is why are there no examples of this component or Help under "HELP"
Ben: My question to Support is why are there no examples of this component or Help under "HELP"
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: SwitchBank(0) and readstate
Hi Errol,
You don't get information on individual component in the standard top help menu as that's just for help with using Flowcode.
Your welcome.Errol wrote:I want to thank Dazz and Medelec35 for the code and the input.
Have you right clicked on the component on your panel and selected help? : Right click help is help for the components.Errol wrote:Ben: My question to Support is why are there no examples of this component or Help under "HELP"
You don't get information on individual component in the standard top help menu as that's just for help with using Flowcode.
Martin