etisserant@0: (* etisserant@0: * (c) 26 Feb 2001 David Campbell etisserant@0: * etisserant@0: * Offered to the public under the terms of the GNU General Public License etisserant@0: * as published by the Free Software Foundation; either version 2 of the etisserant@0: * License, or (at your option) any later version. etisserant@0: * etisserant@0: * This program is distributed in the hope that it will be useful, but etisserant@0: * WITHOUT ANY WARRANTY; without even the implied warranty of etisserant@0: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General etisserant@0: * Public License for more details. etisserant@0: * etisserant@0: * This code is made available on the understanding that it will not be etisserant@0: * used in safety-critical situations without a full and competent review. etisserant@0: *) etisserant@0: etisserant@0: (* etisserant@0: * An IEC 61131-3 IL and ST compiler. etisserant@0: * etisserant@0: * Based on the etisserant@0: * FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10) etisserant@0: * etisserant@0: *) etisserant@0: etisserant@0: etisserant@0: (* etisserant@0: * This is part of the library conatining the functions etisserant@0: * and function blocks defined in the standard. etisserant@0: * etisserant@0: * SR and RS function blocks etisserant@0: * ------------------------- etisserant@0: *) etisserant@0: etisserant@0: etisserant@0: FUNCTION_BLOCK SR etisserant@0: VAR_INPUT etisserant@0: S1 : BOOL; etisserant@0: R : BOOL; etisserant@0: END_VAR etisserant@0: VAR_OUTPUT etisserant@0: Q1 : BOOL; etisserant@0: END_VAR etisserant@0: VAR etisserant@0: Q_INTERNAL : BOOL; etisserant@0: END_VAR etisserant@0: etisserant@0: Q_INTERNAL := S1 OR ( Q_INTERNAL AND (NOT R)); etisserant@0: Q1 := Q_INTERNAL; etisserant@0: END_FUNCTION_BLOCK etisserant@0: etisserant@0: FUNCTION_BLOCK RS etisserant@0: VAR_INPUT etisserant@0: S : BOOL; etisserant@0: R1 : BOOL; etisserant@0: END_VAR etisserant@0: VAR_OUTPUT etisserant@0: Q1 : BOOL; etisserant@0: END_VAR etisserant@0: VAR etisserant@0: Q_INTERNAL : BOOL; etisserant@0: END_VAR etisserant@0: etisserant@0: Q_INTERNAL := (NOT R1) AND (S OR Q_INTERNAL); etisserant@0: Q1 := Q_INTERNAL; etisserant@0: END_FUNCTION_BLOCK