blob: 63ebe1be7633ca97409760b7418fdb8ab5e5891d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Awlsim project file generated by awlsim-0.72.0-pre -->
<awlsim_project date_create="2016-03-16 00:00:00.000000"
date_modify="2020-02-22 15:04:58.429757"
format_version="1">
<!-- CPU core configuration -->
<cpu>
<!-- CPU core feature specification -->
<specs call_stack_size="256"
nr_accus="2"
nr_counters="256"
nr_flags="2048"
nr_inputs="128"
nr_localbytes="1024"
nr_outputs="128"
nr_timers="256"
parenthesis_stack_size="7" />
<!-- CPU core configuration -->
<config clock_memory_byte="-1"
cycle_time_limit_us="1000000"
cycle_time_target_us="0"
ext_insns_enable="0"
mnemonics="0"
ob_startinfo_enable="0"
run_time_limit_us="-1" />
</cpu>
<!-- AWL/STL language configuration -->
<language_awl>
<!-- AWL/STL source code -->
<source enabled="1"
name="Unnamed source"
type="0"><![CDATA[
ORGANIZATION_BLOCK OB 1
VAR_TEMP
OB1_EV_CLASS : BYTE; // Bits 0-3 = 1 (Coming event), Bits 4-7 = 1 (Event class 1)
OB1_SCAN_1 : BYTE; // 1 (Cold restart scan 1 of OB 1), 3 (Scan 2-n of OB 1)
OB1_PRIORITY : BYTE; // Priority of OB execution
OB1_OB_NUMBR : BYTE; // 1 (Organization block 1, OB 1)
OB1_RESERVED_1 : BYTE;
OB1_RESERVED_2 : BYTE;
OB1_PREV_CYCLE : INT; // Cycle time of previous OB 1 scan (milliseconds)
OB1_MIN_CYCLE : INT; // Minimum cycle time of OB 1 (milliseconds)
OB1_MAX_CYCLE : INT; // Maximum cycle time of OB 1 (milliseconds)
OB1_DATE_TIME : DATE_AND_TIME; // Date and time OB 1 started
END_VAR
BEGIN
//
// EXAMPLE RASPBERRY PI PROJECT
//
// Two hardware modules are enabled in the
// configuration of this project:
// The 'rpigpio' module is used to access tha Raspberry Pi
// GPIO ports.
// The 'pyprofibus' module is used to access the PiLC
// PROFIBUS-DP header and talk to PROFIBUS-DP slaves.
//
// The HW-config of the 'rpigpio' module
// does the following input/output memory mappings:
// I0.0 <= BCM17
// I0.1 <= BCM24
// Q0.0 => BCM27
// Q0.1 => BCM23
//
// The HW-config of the 'pyprofibus' module
// maps the PROFIBUS memory start to
// I8.0 and Q8.0
//
A I 0.0 // Read bit from GPIO BCM17
= Q 0.0 // Write bit to GPIO BCM27
A I 0.0 // Read bit from GPIO BCM17
A I 0.1 // Read bit from GPIO BCM24 and do an AND operation
= Q 0.1 // Write resulting bit to GPIO BCM23
L IB 8 // Read the first byte from PROFIBUS
T QB 8 // Write it to the first byte of PROFIBUS
// Run some other code...
CALL FC 1
END_ORGANIZATION_BLOCK
FUNCTION FC 1 : VOID
BEGIN
NOP 0
NOP 0
NOP 0
NOP 0
NOP 0
NOP 0
NOP 0
NOP 0
NOP 0
NOP 0
NOP 0
NOP 0
NOP 0
NOP 0
NOP 0
NOP 0
NOP 0
NOP 0
NOP 0
NOP 0
NOP 0
NOP 0
NOP 0
NOP 0
L MW 200
+ 1
T MW 202
L MW 204
+ 1
T MW 206
L MW 208
+ 1
T MW 210
L MW 212
+ 1
T MW 214
L MW 216
+ 1
T MW 218
L MW 220
+ 1
T MW 222
L MW 224
+ 1
T MW 226
L MW 228
+ 1
T MW 230
L MW 200
+ 1
T MW 202
L MW 204
+ 1
T MW 206
L MW 208
+ 1
T MW 210
L MW 212
+ 1
T MW 214
L MW 216
+ 1
T MW 218
L MW 220
+ 1
T MW 222
L MW 224
+ 1
T MW 226
L MW 228
+ 1
T MW 230
L MW 200
+ 1
T MW 202
L MW 204
+ 1
T MW 206
L MW 208
+ 1
T MW 210
L MW 212
+ 1
T MW 214
L MW 216
+ 1
T MW 218
L MW 220
+ 1
T MW 222
L MW 224
+ 1
T MW 226
L MW 228
+ 1
T MW 230
L MW 200
+ 1
T MW 202
L MW 204
+ 1
T MW 206
L MW 208
+ 1
T MW 210
L MW 212
+ 1
T MW 214
L MW 216
+ 1
T MW 218
L MW 220
+ 1
T MW 222
L MW 224
+ 1
T MW 226
L MW 228
+ 1
T MW 230
L MW 200
+ 1
T MW 202
L MW 204
+ 1
T MW 206
L MW 208
+ 1
T MW 210
L MW 212
+ 1
T MW 214
L MW 216
+ 1
T MW 218
L MW 220
+ 1
T MW 222
L MW 224
+ 1
T MW 226
L MW 228
+ 1
T MW 230
NOP 0
NOP 0
NOP 0
NOP 0
NOP 0
NOP 0
NOP 0
NOP 0
NOP 0
NOP 0
NOP 0
NOP 0
NOP 0
NOP 0
NOP 0
NOP 0
NOP 0
NOP 0
NOP 0
NOP 0
NOP 0
NOP 0
NOP 0
NOP 0
END_FUNCTION
]]></source>
</language_awl>
<!-- Symbol table configuration -->
<symbols>
<!-- symbol table source code -->
<source enabled="1"
name="Main table"
type="3"><![CDATA[
]]></source>
</symbols>
<!-- Core server link configuration -->
<core_link>
<!-- Locally spawned core server -->
<spawn_local enable="0"
interpreters="$DEFAULT"
port_range_begin="4183"
port_range_end="8278" />
<!-- Remote server connection -->
<connect host="pilc"
port="4151"
timeout_ms="10000" />
<!-- Transport tunnel -->
<tunnel local_port="-1"
type="1">
<ssh executable="ssh"
port="22"
user="pi" />
</tunnel>
</core_link>
<!-- Hardware modules configuration -->
<hardware>
<!-- Loaded hardware module -->
<module name="pyprofibus">
<params>
<param name="config"
value="awlsimhw_pyprofibus.conf" />
<param name="inputAddressBase"
value="8" />
<param name="outputAddressBase"
value="8" />
</params>
</module>
<!-- Loaded hardware module -->
<module name="rpigpio">
<params>
<param name="I0.0"
value="BCM17" />
<param name="I0.1"
value="BCM24" />
<param name="Q0.0"
value="BCM27" />
<param name="Q0.1"
value="BCM23" />
<param name="inputAddressBase"
value="0" />
<param name="outputAddressBase"
value="0" />
</params>
</module>
</hardware>
<!-- Graphical user interface configuration -->
<gui>
<!-- Core interaction settings -->
<core pre_download_validation="1" />
<!-- AWL editor settings -->
<editor autoindent="1"
paste_autoindent="1"
validation="1" />
<!-- CPU state view layout -->
<cpu_view>
<cpu_view_window config=""
type="1"
x="0"
y="0" />
</cpu_view>
</gui>
</awlsim_project>
|