author | Mario de Sousa <msousa@fe.up.pt> |
Mon, 04 Apr 2011 14:32:21 +0100 | |
changeset 274 | 8d36d1f81170 |
parent 0 | fb772792efd1 |
child 277 | f88718b71b6c |
permissions | -rwxr-xr-x |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1 |
(* |
274
8d36d1f81170
New version of bistable.txt - due to license issues.
Mario de Sousa <msousa@fe.up.pt>
parents:
0
diff
changeset
|
2 |
* matiec - a compiler for the programming languages defined in IEC 61131-3 |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
3 |
* |
274
8d36d1f81170
New version of bistable.txt - due to license issues.
Mario de Sousa <msousa@fe.up.pt>
parents:
0
diff
changeset
|
4 |
* Copyright (C) 2011 Mario de Sousa (msousa@fe.up.pt) |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
5 |
* |
274
8d36d1f81170
New version of bistable.txt - due to license issues.
Mario de Sousa <msousa@fe.up.pt>
parents:
0
diff
changeset
|
6 |
* This program is free software: you can redistribute it and/or modify |
8d36d1f81170
New version of bistable.txt - due to license issues.
Mario de Sousa <msousa@fe.up.pt>
parents:
0
diff
changeset
|
7 |
* it under the terms of the GNU General Public License as published by |
8d36d1f81170
New version of bistable.txt - due to license issues.
Mario de Sousa <msousa@fe.up.pt>
parents:
0
diff
changeset
|
8 |
* the Free Software Foundation, either version 3 of the License, or |
8d36d1f81170
New version of bistable.txt - due to license issues.
Mario de Sousa <msousa@fe.up.pt>
parents:
0
diff
changeset
|
9 |
* (at your option) any later version. |
8d36d1f81170
New version of bistable.txt - due to license issues.
Mario de Sousa <msousa@fe.up.pt>
parents:
0
diff
changeset
|
10 |
* |
8d36d1f81170
New version of bistable.txt - due to license issues.
Mario de Sousa <msousa@fe.up.pt>
parents:
0
diff
changeset
|
11 |
* This program is distributed in the hope that it will be useful, |
8d36d1f81170
New version of bistable.txt - due to license issues.
Mario de Sousa <msousa@fe.up.pt>
parents:
0
diff
changeset
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
8d36d1f81170
New version of bistable.txt - due to license issues.
Mario de Sousa <msousa@fe.up.pt>
parents:
0
diff
changeset
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
8d36d1f81170
New version of bistable.txt - due to license issues.
Mario de Sousa <msousa@fe.up.pt>
parents:
0
diff
changeset
|
14 |
* GNU General Public License for more details. |
8d36d1f81170
New version of bistable.txt - due to license issues.
Mario de Sousa <msousa@fe.up.pt>
parents:
0
diff
changeset
|
15 |
* |
8d36d1f81170
New version of bistable.txt - due to license issues.
Mario de Sousa <msousa@fe.up.pt>
parents:
0
diff
changeset
|
16 |
* You should have received a copy of the GNU General Public License |
8d36d1f81170
New version of bistable.txt - due to license issues.
Mario de Sousa <msousa@fe.up.pt>
parents:
0
diff
changeset
|
17 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
8d36d1f81170
New version of bistable.txt - due to license issues.
Mario de Sousa <msousa@fe.up.pt>
parents:
0
diff
changeset
|
18 |
* |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
19 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
20 |
* This code is made available on the understanding that it will not be |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
21 |
* used in safety-critical situations without a full and competent review. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
22 |
*) |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
23 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
24 |
(* |
274
8d36d1f81170
New version of bistable.txt - due to license issues.
Mario de Sousa <msousa@fe.up.pt>
parents:
0
diff
changeset
|
25 |
* An IEC 61131-3 compiler. |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
26 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
27 |
* Based on the |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
28 |
* FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10) |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
29 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
30 |
*) |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
31 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
32 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
33 |
(* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
34 |
* This is part of the library conatining the functions |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
35 |
* and function blocks defined in the standard. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
36 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
37 |
* SR and RS function blocks |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
38 |
* ------------------------- |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
39 |
*) |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
40 |
|
274
8d36d1f81170
New version of bistable.txt - due to license issues.
Mario de Sousa <msousa@fe.up.pt>
parents:
0
diff
changeset
|
41 |
(* The standard defines the SR FB thus: |
8d36d1f81170
New version of bistable.txt - due to license issues.
Mario de Sousa <msousa@fe.up.pt>
parents:
0
diff
changeset
|
42 |
|
8d36d1f81170
New version of bistable.txt - due to license issues.
Mario de Sousa <msousa@fe.up.pt>
parents:
0
diff
changeset
|
43 |
+-----+ |
8d36d1f81170
New version of bistable.txt - due to license issues.
Mario de Sousa <msousa@fe.up.pt>
parents:
0
diff
changeset
|
44 |
S1----------------| >=1 |---Q1 |
8d36d1f81170
New version of bistable.txt - due to license issues.
Mario de Sousa <msousa@fe.up.pt>
parents:
0
diff
changeset
|
45 |
+---+ | | |
8d36d1f81170
New version of bistable.txt - due to license issues.
Mario de Sousa <msousa@fe.up.pt>
parents:
0
diff
changeset
|
46 |
R------O| & |----| | |
8d36d1f81170
New version of bistable.txt - due to license issues.
Mario de Sousa <msousa@fe.up.pt>
parents:
0
diff
changeset
|
47 |
Q1------| | | | |
8d36d1f81170
New version of bistable.txt - due to license issues.
Mario de Sousa <msousa@fe.up.pt>
parents:
0
diff
changeset
|
48 |
+---+ +-----+ |
8d36d1f81170
New version of bistable.txt - due to license issues.
Mario de Sousa <msousa@fe.up.pt>
parents:
0
diff
changeset
|
49 |
*) |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
50 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
51 |
FUNCTION_BLOCK SR |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
52 |
VAR_INPUT |
274
8d36d1f81170
New version of bistable.txt - due to license issues.
Mario de Sousa <msousa@fe.up.pt>
parents:
0
diff
changeset
|
53 |
S1, R : BOOL; |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
54 |
END_VAR |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
55 |
VAR_OUTPUT |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
56 |
Q1 : BOOL; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
57 |
END_VAR |
274
8d36d1f81170
New version of bistable.txt - due to license issues.
Mario de Sousa <msousa@fe.up.pt>
parents:
0
diff
changeset
|
58 |
Q1 := S1 OR ((NOT R) AND Q1); |
8d36d1f81170
New version of bistable.txt - due to license issues.
Mario de Sousa <msousa@fe.up.pt>
parents:
0
diff
changeset
|
59 |
END_FUNCTION_BLOCK |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
60 |
|
274
8d36d1f81170
New version of bistable.txt - due to license issues.
Mario de Sousa <msousa@fe.up.pt>
parents:
0
diff
changeset
|
61 |
|
8d36d1f81170
New version of bistable.txt - due to license issues.
Mario de Sousa <msousa@fe.up.pt>
parents:
0
diff
changeset
|
62 |
(* The standard defines the RS FB thus: |
8d36d1f81170
New version of bistable.txt - due to license issues.
Mario de Sousa <msousa@fe.up.pt>
parents:
0
diff
changeset
|
63 |
+---+ |
8d36d1f81170
New version of bistable.txt - due to license issues.
Mario de Sousa <msousa@fe.up.pt>
parents:
0
diff
changeset
|
64 |
R1----------------O| & |---Q1 |
8d36d1f81170
New version of bistable.txt - due to license issues.
Mario de Sousa <msousa@fe.up.pt>
parents:
0
diff
changeset
|
65 |
+-----+ | | |
8d36d1f81170
New version of bistable.txt - due to license issues.
Mario de Sousa <msousa@fe.up.pt>
parents:
0
diff
changeset
|
66 |
S-------| >=1 |----| | |
8d36d1f81170
New version of bistable.txt - due to license issues.
Mario de Sousa <msousa@fe.up.pt>
parents:
0
diff
changeset
|
67 |
Q1------| | | | |
8d36d1f81170
New version of bistable.txt - due to license issues.
Mario de Sousa <msousa@fe.up.pt>
parents:
0
diff
changeset
|
68 |
+-----+ +---+ |
8d36d1f81170
New version of bistable.txt - due to license issues.
Mario de Sousa <msousa@fe.up.pt>
parents:
0
diff
changeset
|
69 |
*) |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
70 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
71 |
FUNCTION_BLOCK RS |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
72 |
VAR_INPUT |
274
8d36d1f81170
New version of bistable.txt - due to license issues.
Mario de Sousa <msousa@fe.up.pt>
parents:
0
diff
changeset
|
73 |
S, R1 : BOOL; |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
74 |
END_VAR |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
75 |
VAR_OUTPUT |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
76 |
Q1 : BOOL; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
77 |
END_VAR |
274
8d36d1f81170
New version of bistable.txt - due to license issues.
Mario de Sousa <msousa@fe.up.pt>
parents:
0
diff
changeset
|
78 |
Q1 := (NOT R1) AND (S OR Q1); |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
79 |
END_FUNCTION_BLOCK |