Button Press

Moderator: Benj

Post Reply
Gypo
Posts: 52
Joined: Thu Apr 29, 2010 11:12 am
Has thanked: 5 times
Been thanked: 3 times

Button Press

Post by Gypo »

Hi

is there any way of being able to press several buttons at once?
If not can there be a method added where several momentary buttons can be grouped together so that pressing a group button acts like all buttons of the group have been pressed? But still allows each individual button to be used even though it's grouped.

I ask of this after developing a program whereby I am making use of 4 buttons and a 2 x 8 display and had problems simulating the working circuit / program.
Each of the buttons in the project do one thing alone and combinations of buttons do something else.

This is very hard to simulate in Flowcode as you can't press more than one button at a time.
As there is a possibility of a stuck button or the user pressing a button at the wrong time the buttons are checked at program startup so toggle buttons cant be used or switches set before the program is run.

Regards
The only real simulation isn't ...
Gypo

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times

Re: Button Press

Post by medelec35 »

Gypo wrote:Hi

is there any way of being able to press several buttons at once?
This is very hard to simulate in Flowcode as you can't press more than one button at a time.
As there is a possibility of a stuck button or the user pressing a button at the wrong time the buttons are checked at program start-up so toggle buttons cant be used or switches set before the program is run.

Regards
Actually you can do all of these,and there are several ways switches can be pressed simultaneously.

1) The easiest way is to make the switches toggle (from component Ext properties), or if using separate switches choose latching.
When ready to run simulation, press F8 key once. Now you can change the status of any of the switches. Then run the simulation (or use single step by pressing F8 function key). Since you are single stepping, just change state of switches back before continuing stepping.

2) You can setup key mapping (See picture). Useful is switches are on push to make or momentary
Then whilst simulation is running, you can simultaneously operate switches, by pressing the number keys (both on separate keypad and top number keys).
I believe this is more in line what you are trying to achieve, as you have correctly stated you can't press more than 1 key (with mouse) when simulation is running if keys are momentary.
key mapping.jpg
key mapping.jpg (140.22 KiB) Viewed 10285 times
As you can see from picture if you press key 0 then switch A0 will be activated. If press both 0 and 1 on keyboard then both A0 and A1 will be activated.

This is a very useful feature if are single stepping. you cannot single step and use mouse to hold in switch at the same time. If you do then single step will not proceed.
The solution is to keep single stepping and press the mapped number keys at the same time.

There are several ways to detect multiple key presses.
Using the input component with the whole port selected.
Then using switch component macro. If input variable = 3 then switches A1and A2 are both activated so do something.
If input variable = 7 then A1, A2 and A3 are all activated so do something else.
If input variable = 128 then A7 is activated so do something different etc.
Switch Component.jpg
Switch Component.jpg (194.39 KiB) Viewed 10285 times
Any Combination (or Case) that is not been entered on the component properties then Default path is used.

Hope this has helped.
Martin

Gypo
Posts: 52
Joined: Thu Apr 29, 2010 11:12 am
Has thanked: 5 times
Been thanked: 3 times

Re: Button Press

Post by Gypo »

Hi

Looks like this could be the way to do what I was trying to do,
It was the pressing of multiple buttons at the same time that I was strugling with, the detection of them had been sorted already.

I'll give this a try later, fingers crossed,,, but I think this could be it...

Thanks again
The only real simulation isn't ...
Gypo

Post Reply