Zes
Member
Hello!
I have a control panel with two hard-wired push buttons. One button to switching on, and another one to switching off. And I have an HMI with one button to switching on/off (toggle). For some reasons I can't use two separate buttons on HMI. So I need to implement simultaneous operation with HW-buttons and HMI-button.
Here is my code for FB that alternates two outputs from one input:
And here is my diagram for simultaneous control:
The problem is if coil was turned on with HW-button, it takes two pushes to turn it off with HMI-button. Maybe I need to add small changes to handle this issue:
But maybe I missing something, this approach is wrong and there is more suitable and simple solution. Any advice, recommendations or thoughts will be greatly appreciated.
All buttons are momentary. 'SwitchedOn' is sealed internally in 'FB_L'.
I have a control panel with two hard-wired push buttons. One button to switching on, and another one to switching off. And I have an HMI with one button to switching on/off (toggle). For some reasons I can't use two separate buttons on HMI. So I need to implement simultaneous operation with HW-buttons and HMI-button.
Here is my code for FB that alternates two outputs from one input:
Code:
All variables are boolean type.
(* Asynchronous reset. *)
IF (RST) THEN
A := FALSE;
(* Normal operation. *)
ELSE
A := A XOR (CLK AND NOT(M));
Q01 := CLK AND A;
Q02 := CLK AND NOT(A);
M := CLK;
END_IF;
And here is my diagram for simultaneous control:
The problem is if coil was turned on with HW-button, it takes two pushes to turn it off with HMI-button. Maybe I need to add small changes to handle this issue:
Code:
(* Asynchronous reset. *)
IF (RST) OR (SET) THEN
A := NOT RST;
(* Normal operation. *)
ELSE
A := A XOR (CLK AND NOT(M));
Q01 := CLK AND A;
Q02 := CLK AND NOT(A);
M := CLK;
END_IF;
But maybe I missing something, this approach is wrong and there is more suitable and simple solution. Any advice, recommendations or thoughts will be greatly appreciated.
All buttons are momentary. 'SwitchedOn' is sealed internally in 'FB_L'.
Last edited: