07-06-2016 07:13 PM
This is a very simplified version of code, as I just wanted to be able to extract the value from the mechanical switch to be used in the selector. Although it appears that you can wire the new value directly to the selector in the "Run" case, in my original program, the selector switch is actually in another case. If I use the propery node, value, I get a variant.
I have to use this stop button.
Any help will be greatly appreciated to extract the boolean value out from stop button to be used elsewhere in the selector.
Thanks,
hiNi
07-06-2016 07:27 PM
Usually, to transfer data from one case to another, we use a shift register like you are using for your control 1.ctl. Can you create a shift register and wire the stop into it and then read it in the other case from the other side. Your example is a little lacking because you don't show the other cases so it's not clear what the difficulty is. Also, there's no "mechanical switch" just a stop button.
07-06-2016 07:53 PM
Hello, can you convert the Stop Button value to a boolen?
07-06-2016 08:07 PM - edited 07-06-2016 08:10 PM
You need to change the mechanical action of the boolean. (Latch action boolean don't allow local variables and are variats for value properties.)
Of course you don't even need the value property here, just wire from the terminal. Right?
You also don't need the terminal in the stop event, because you can also get the new data from the event data node.
07-06-2016 08:11 PM
Hello,
I have modified the original program to show the extra state where the stop button should become active. Thanks.
07-06-2016 08:16 PM
As I said, you need to change the mechanical action of the button (e.g. to switch when pressed). A latch action boolean resets when read by the code, so it is very likley never true for a predictable amount of time.
07-06-2016 08:20 PM
Hello, if you are given this in a CLD exam, will you lose points for carrying out your suggested solution? Thanks.
07-06-2016 08:23 PM - edited 07-06-2016 08:23 PM
Instead of using the property node, just pass the value of the control out of the event structure. This would be a valid use of the Use Default If Unwired state of the output tunnel.

Alternatively (and probably the better option) is to just have the event cases output the enum for which state to go to.

07-06-2016 08:23 PM
If you move the stop control to the "check elapsed time" case, you can read it there. The event structure will still work as normal. If you need to read the stop in more than one case, then you might want to consider a different archtecture where you have one loop looking at the control and then send a message to the other elapsed time checking loop using maybe a notifier.
07-06-2016 08:25 PM
@hiNI wrote:Hello, if you are given this in a CLD exam, will you lose points for carrying out your suggested solution? Thanks.
Which post are you replying to?