Page 702 - Mechanical Engineers' Handbook (Volume 2)
P. 702

2 Programmable Controllers (PLCs)  693

                              FUNCTION_BLOCK CMD_MONITOR (* Begin definition of FB CMD_MONITOR *)

                                (* Definition of external interface *)
                                VAR_INPUT
                                  AUTO_CMD : BOOL;     (* Automatic Command *)

                                  AUTO_MODE : BOOL;    (* AUTO_CMD Enable *)
                                  MAN_CMD : BOOL;      (* Manual Command *)
                                  MAN_CMD_CHK : BOOL;  (* Negated MAN_CMD for debouncing *)
                                  T_CMD_MAX : TIME;    (* Maximum time from CMD to FDBK *)

                                  FDBK : BOOL;         (* Confirmation of CMD completion by operative
                                 unit *)
                                  ACK : BOOL;          (* Acknowledgement/Cancel ALRM *)
                                END_VAR
                                VAR_OUTPUT

                                  CMD : BOOL;          (* Command to operative unit *)
                                  ALRM : BOOL;         (* T_CMD_MAX expired without FDBK *)
                                END_VAR

                                (* Definition of internal state variables *)
                                VAR
                                  CMD_TMR : TON;  (* CMD-to-FDBK timer *)
                                  ALRM_FF : SR;   (* Note over-riding “S1” input,
                                                     Command must be cancelled before ACK can cancel

                                 alarm *)
                                END_VAR

                             (* Definition of Function Block Body per
                              Figure (a), (b) or (c) *)
                              END_FUNCTION_BLOCK  (* End definition of FB CMD_MONITOR *)
                                                              (a)
                           Figure 11 Function block encapsulation: (a) textual declaration in ST language; (b) graphic represen-
                           tation.
   697   698   699   700   701   702   703   704   705   706   707