AND operator fails by 'Wait for falling' ?

Alles rund um TX(T) und RoboPro, mit ft-Hard- und Software
Computing using original ft hard- and software
Forumsregeln
Bitte beachte die Forumsregeln!
Antworten
Benutzeravatar
FeuerTischler
Beiträge: 13
Registriert: 18 Okt 2011, 04:02

AND operator fails by 'Wait for falling' ?

Beitrag von FeuerTischler » 05 Feb 2012, 07:53

is it my programming logic or is there something failing with the software/hardware ?

i have two switches which i want BOTH to be pressed before program control continues, the problem is in the following program; just ONE switch 'falling' and it already proceeds ?!
Bild

changing it to 'rising' works as expected (the same as Wait for '1'), as soon as the 2nd switch is pressed, the program proceeds, but for 'falling', only one button release is sufficient (after both have been pressed).

am i doing something wrong, or is there a bug here ?
give them NOT fish, but TEACH them HOW TO

thkais
Beiträge: 384
Registriert: 31 Okt 2010, 21:45

Re: AND operator fails by 'Wait for falling' ?

Beitrag von thkais » 05 Feb 2012, 09:42

Hello,

I am not shure that I understood your explanation -

As long as both of the switches are pressed, the result of the AND-Operator is "1". If you release one of the switches (or both) the result of the AND-Operator will be "0".
In your case, the program will wait for "1->0" of the AND-operator - and this appears, if you first press both switches and then release one (or both).

To get the function you asked for (continouing by pressing both switches) you need the "Wait for rising" or "Wait for 1" Element.
Gruß
Thomas

Benutzeravatar
FeuerTischler
Beiträge: 13
Registriert: 18 Okt 2011, 04:02

Re: AND operator fails by 'Wait for falling' ?

Beitrag von FeuerTischler » 09 Feb 2012, 02:57

thkais hat geschrieben:###cut###

As long as both of the switches are pressed, the result of the AND-Operator is "1". If you release one of the switches (or both) the result of the AND-Operator will be "0".
In your case, the program will wait for "1->0" of the AND-operator - and this appears, if you first press both switches and then release one (or both).

###cut###
thank you for your reply.

it seems i do not understand how "Falling" works ?

isn't it a transition from 1 to 0 ?

it's clear when it's just one switch, but when two switches are combined with the 'AND' operator, why does only ONE switch 'Falling' satisfy the condition of the AND operator ?

as you mentioned above "both switches or one"... ?! doesn't 'AND' require both ??
give them NOT fish, but TEACH them HOW TO

thkais
Beiträge: 384
Registriert: 31 Okt 2010, 21:45

Re: AND operator fails by 'Wait for falling' ?

Beitrag von thkais » 09 Feb 2012, 05:10

Hello,
You are right with the meaning of "falling" = transition from "1" to "0".
I think you didn't understand the "AND" ;)

Code: Alles auswählen

Switch A          Switch B           "AND"
     0                0               0
     1                0               0
     0                1               0
     1                1               1

"1" = pressed, "0" = not pressed   
Only if both switches are pressed, the AND-Operator delivers a "1" as a result.

So let's have a look what happens:
If none of the switches is pressed, the AND-Operator is "0". If one of the switches ist pressed there is also a "0". Only if you press both there will be a "1" as result of the AND-Operator - so you will get a "0 to 1" transition in the case of pressing both switches.
So if both switches are pressed (AND = 1) and you will release one of the switches the AND will be "0" and there is a "1 to 0" transition.
Gruß
Thomas

Benutzeravatar
FeuerTischler
Beiträge: 13
Registriert: 18 Okt 2011, 04:02

Re: AND operator fails by 'Wait for falling' ?

Beitrag von FeuerTischler » 11 Feb 2012, 18:43

ahh, i see now - yes; that is how i understood 'AND' but i was taking it (the transition) for the switches individually, like so;

Code: Alles auswählen

Switch A     'AND'   Switch B           Waiting for 'Falling'
   1->0                 1->0         =       1->0
whereas the 'Waiting For...' takes *both* switches in combination.

okay then, thanks for the clarification !
give them NOT fish, but TEACH them HOW TO

Antworten