a | b/examples/Ladder.ladder | ||
---|---|---|---|
1 | |||
2 | //This is a rung comment |
||
3 | (*Also a |
||
4 | rung comment*) |
||
5 | (**Mabe a nicer |
||
6 | * Way to do multiline comments |
||
7 | *) |
||
8 | (** supported features: |
||
9 | * 001 ‘Network’ |
||
10 | * 002 ‘Box’ |
||
11 | * 002 ‘Assignment’ |
||
12 | * (003 FB, 003 FN) ‘Box with EN/ENO’ |
||
13 | * 002 ‘Input’ |
||
14 | * 005 ‘Label’ |
||
15 | * 005 ‘Contact’ |
||
16 | * 005 ‘Coil’ |
||
17 | * 005 Negated Contant |
||
18 | * 006 Branches (note, branches always close!) |
||
19 | * 007 Set coil |
||
20 | * 007 Reset coil |
||
21 | * 008 short circuit evaluation (SCE) (Toggle Parallel Mode) (I dislike this enough I make you use extended ascii) |
||
22 | * 008 Negation (I dislike this enough I make you use extended ascii) |
||
23 | * 009 Jump |
||
24 | * 010 Return |
||
25 | * 011 Network Comment State |
||
26 | * 012 FBD/LD/IL Element ‘Execute’ |
||
27 | * 013 Names are too long (abreviation section) |
||
28 | * I think that's everything actually. |
||
29 | *) |
||
30 | (** Declaration Section: |
||
31 | * Exact copy of the declaration section, with some indentation |
||
32 | * Note any indentation that is the same for each line will be removed |
||
33 | *) |
||
34 | {Declaration} |
||
35 | PROGRAM POU |
||
36 | VAR |
||
37 | END_VAR |
||
38 | {/Declaration} |
||
39 | (** Abbreviation Section: |
||
40 | * Sure it can get confusing. Maybe later can alter it so not fixed width ladder |
||
41 | * For importing, it is OK to change the abbrevioations however you please |
||
42 | * Rules: Generally if too long: |
||
43 | * take first three letters and last three and add a ~0 through ~9 |
||
44 | * If more than 10 have same first three and same last three, the 11th becomes ~~10 |
||
45 | * If there is one or more points in the variable name, shorten the first three and but the point before the ~ |
||
46 | *) |
||
47 | {Abbreviaitons} |
||
48 | Nam~0GHT := NameEIGHT; |
||
49 | Nam~1GHT := NameONE_HUNDRED_AND_EIGHT; |
||
50 | Nam~2GHT := NameI_CANT_WEIGHT; |
||
51 | F_C~0ate := F_Calculate; |
||
52 | FB.~0ate := FB_Timer.Calculate; |
||
53 | {/Abbreviations} |
||
54 | (** Execution Section: |
||
55 | * If the execution block is too big to fit, |
||
56 | * either width ways or column ways, write it's Execution here. |
||
57 | * Note any indentation that is the same for each line will be removed |
||
58 | *) |
||
59 | {Executions} |
||
60 | {~1} |
||
61 | thisvariable := actuallyToolong; |
||
62 | REsult := Function(); |
||
63 | //I added a comment |
||
64 | //If line too long it gets truncated |
||
65 | // >6 line, ~ bottom right |
||
66 | IF TRUE THEN |
||
67 | DoSomethingCool; |
||
68 | END_IF; |
||
69 | {/~1} |
||
70 | {/Executions} |
||
71 | {Ladder} |
||
72 | 001 ||. . . . . . || |
||
73 | || || |
||
74 | ||------------------------------------------------------------|| |
||
75 | || || |
||
76 | 002 ||. . . ________ . || |
||
77 | || NameEIGH | F_Name | NameEIGH || |
||
78 | ||----] [------------------------Input_01|--------------( )---|| |
||
79 | || Variable==In_out01| || |
||
80 | || =InOut2 | || |
||
81 | || Variable--Input2 | || |
||
82 | || =InOut3 | || |
||
83 | || | Out01--Variable || |
||
84 | || | Out02--Variable || |
||
85 | || |________| || |
||
86 | || || |
||
87 | 003 ||. . . ________ . || |
||
88 | || NameEIGH NameEIGH Instance--FB_Name8| NameEIGH || |
||
89 | ||----] [-------] [--------------EN ENO---------------( )---|| |
||
90 | || -Input01 | || |
||
91 | || | Out01- || |
||
92 | || =In_out01| || |
||
93 | || =Inout2 | || |
||
94 | || |________| || |
||
95 | || || |
||
96 | 004 ||. . . ________ . || |
||
97 | || NameEIGH | F_Name | NameEIGH || |
||
98 | ||----] [------------------------EN ENO---------------( )---|| |
||
99 | || Variable--Input01 | || |
||
100 | || | Out01--Variable || |
||
101 | || Variable==In_out01| || |
||
102 | || Variable==Inout2 | || |
||
103 | || |________| || |
||
104 | || || |
||
105 | 005 ||. . . . . . || |
||
106 | myLabel || NameEIGH NameEIGH NameEIGH || |
||
107 | ||----] [-------]/[-------------------------------------( )---|| |
||
108 | || || |
||
109 | 006 ||. . . . . . || |
||
110 | || NameEIGH NameEIGH NameEIGH || |
||
111 | ||+---] [--++---] [------------+------------------------( )---|| |
||
112 | ||| || | || |
||
113 | ||| || . | || |
||
114 | |||NameEIGH||NameEIGH NameEIGH| || |
||
115 | ||+---] [--++---] [-------]/[--+ || |
||
116 | || || |
||
117 | 007 ||. . . . . . || |
||
118 | || NameEIGH NameEIGH NameEIGH || |
||
119 | ||----------------------------------(R)-------(S)---+---(S)--+|| |
||
120 | || | ||| |
||
121 | || | ||| |
||
122 | || |NameEIGH||| |
||
123 | || +---(R)--+|| |
||
124 | || || |
||
125 | 008 ||. . . . . . || |
||
126 | || NameEIGH ASCII181 NameEIGH || |
||
127 | ||----] [---╬---] [--------------------------------╬----( )---|| |
||
128 | || ║ ║ || |
||
129 | || ║ . ________ ║ || |
||
130 | || ║ASCII206 Instance--FB_Name8| ║ || |
||
131 | || ╬---] [--------------EN ENO----------╬ || |
||
132 | || NegInVarø-Input01 | || |
||
133 | || | Out01-øASCII155 || |
||
134 | || =In_out01| || |
||
135 | || =Inout2 | || |
||
136 | || |________| || |
||
137 | || || |
||
138 | 009 ||. . . . . . || |
||
139 | || myLabel || |
||
140 | ||----------------------------------------------------<JUMP>--|| |
||
141 | || || |
||
142 | 010 ||. . . . . . || |
||
143 | || || |
||
144 | ||---------------------------------------------------<RETURN>-|| |
||
145 | || || |
||
146 | 011 ||##. . . . . . || |
||
147 | ||## NameEIGH || |
||
148 | ||##----] [--------------------------------------------<RETURN>-|| |
||
149 | ||## || |
||
150 | 012 ||. . . __________________________ . || |
||
151 | || NameEIGH | Execute ~1 | || |
||
152 | ||----] [---------------EN ENO------------|| |
||
153 | || |thisvariable := actuallyT~| || |
||
154 | || |REsult := Function(); | || |
||
155 | || |//I added a comment | || |
||
156 | || |//If line too long it get~| || |
||
157 | || |// >6 line, ~ bottom right| || |
||
158 | || |IF TRUE THEN | || |
||
159 | || |_________________________~| || |
||
160 | || || |
||
161 | 013 ||. . . ________ . || |
||
162 | || FB.~0ate Nam~1GHT |F_C~0ate| Nam~2GHT || |
||
163 | ||----] [---+---] [--------------EN ENO----------+----( )---|| |
||
164 | || | NegInVarø-Input01 | | || |
||
165 | || | | Out01-øASCII155| || |
||
166 | || | =In_out01| | || |
||
167 | || | =Inout2 | | || |
||
168 | || | |________| | || |
||
169 | || | . ________ | || |
||
170 | || |Nam~0GHT Instance--FB_Timer| | || |
||
171 | || +---] [--------------EN ENO----------+ || |
||
172 | || NegInVarø-Input01 | || |
||
173 | || | Out01-øASCII155 || |
||
174 | || =In_out01| || |
||
175 | || =Inout2 | || |
||
176 | || |________| || |
||
177 | || || |
||
178 | {/Ladder} |