equal
deleted
inserted
replaced
|
1 (* |
|
2 * (c) 26 Feb 2001 David Campbell |
|
3 * |
|
4 * Offered to the public under the terms of the GNU General Public License |
|
5 * as published by the Free Software Foundation; either version 2 of the |
|
6 * License, or (at your option) any later version. |
|
7 * |
|
8 * This program is distributed in the hope that it will be useful, but |
|
9 * WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
|
11 * Public License for more details. |
|
12 * |
|
13 * This code is made available on the understanding that it will not be |
|
14 * used in safety-critical situations without a full and competent review. |
|
15 *) |
|
16 |
|
17 (* |
|
18 * An IEC 61131-3 IL and ST compiler. |
|
19 * |
|
20 * Based on the |
|
21 * FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10) |
|
22 * |
|
23 *) |
|
24 |
|
25 |
|
26 (* |
|
27 * This is part of the library conatining the functions |
|
28 * and function blocks defined in the standard. |
|
29 * |
|
30 * SR and RS function blocks |
|
31 * ------------------------- |
|
32 *) |
|
33 |
|
34 |
|
35 FUNCTION_BLOCK SR |
|
36 VAR_INPUT |
|
37 S1 : BOOL; |
|
38 R : BOOL; |
|
39 END_VAR |
|
40 VAR_OUTPUT |
|
41 Q1 : BOOL; |
|
42 END_VAR |
|
43 VAR |
|
44 Q_INTERNAL : BOOL; |
|
45 END_VAR |
|
46 |
|
47 Q_INTERNAL := S1 OR ( Q_INTERNAL AND (NOT R)); |
|
48 Q1 := Q_INTERNAL; |
|
49 END_FUNCTION_BLOCK |
|
50 |
|
51 FUNCTION_BLOCK RS |
|
52 VAR_INPUT |
|
53 S : BOOL; |
|
54 R1 : BOOL; |
|
55 END_VAR |
|
56 VAR_OUTPUT |
|
57 Q1 : BOOL; |
|
58 END_VAR |
|
59 VAR |
|
60 Q_INTERNAL : BOOL; |
|
61 END_VAR |
|
62 |
|
63 Q_INTERNAL := (NOT R1) AND (S OR Q_INTERNAL); |
|
64 Q1 := Q_INTERNAL; |
|
65 END_FUNCTION_BLOCK |