Function Block - Hysteresis detection.
XIN1 : REAL
First input
signal
XIN2 :
REAL Second input
signal
EPS : REAL
Hysteresis
Q : BOOL Detected hysteresis: TRUE if XIN1 becomes greater than XIN2+EPS and is not yet below XIN2-EPS
The hysteresis is detected on the difference of XIN1 and XIN2 signals. In LD language, the input rung (EN) is used for enabling the block. The output rung is the Q output.
(* MyHyst is a declared instance of HYSTER
function block *)
MyHyst (XIN1, XIN2, EPS);
Q := MyHyst.Q;
(* The block is not called if EN is FALSE
*)
(* MyHyst is a declared instance of HYSTER
function block *)
Op1: CAL MyHyst (XIN1,
XIN2, EPS)
LD MyHyst.Q
ST Q