Mas01
Member
Last edited:
Most likely you need a oneshot -- the value is incrementing every time the instruction is scanned while the button is pressed.
Most likely you need a oneshot -- the value is incrementing every time the instruction is scanned while the button is pressed.
Thanks for the replies.
I'm not sure what the difference is between -|P|- and -(P)-, but this implementation below seems to be working fine....i.e. counter increments by 1 each time the button is pressed.
See picture.
-|P|- would be used in-line as an input condition after the button but before the addition, saving a rung.
-(P)- is used as you have done, requiring a separate rung for the oneshot but allowing it to be examined in multiple locations.
I'm not sure what the difference is between -|P|- and -(P)-
IF bit_from_hmi THEN
counter := counter + 1 ;
bit_from_hmi := FALSE ;
END_IF ;
Even simpler.
In the HMI, use setbit function on the activated event on a regular button.
In the PLC, code this:
(SCL only because it is easier to write in a post).Code:IF bit_from_hmi THEN counter := counter + 1 ; bit_from_hmi := FALSE ; END_IF ;