1<?xml version="1.0" encoding="UTF-8"?>
2<project
3 xmlns="http://www.plcopen.org/xml/tc6_0201"
4 xmlns:xhtml="http://www.w3.org/1999/xhtml"
5 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6 xsi:schemaLocation="http://www.plcopen.org/xml/tc6_0201 http://www.plcopen.org/xml/tc6.xsd" >
7<fileHeader
8 companyName="FGDES/LRT"
9 creationDateTime="2017-03-14T15:42:55"
10 productName="CompileDES"
11 productVersion="3.10" />
12<contentHeader
13 name="Blink_Pox_2017_02" >
14 <coordinateInfo>
15 <fbd><scaling x="1" y="1"/></fbd>
16 <ld><scaling x="1" y="1"/></ld>
17 <sfc><scaling x="1" y="1"/></sfc>
18 </coordinateInfo>
19</contentHeader>
20<types>
21<dataTypes />
22<pous>
23<pou name="fcg_cyclic_fb" pouType="functionBlock">
24<interface>
25 <inputVars retain="false">
26 <variable name="RESET">
27 <type> <BOOL /> </type>
28 <initialValue> <simpleValue value="false" /> </initialValue>
29 <documentation><xhtml xmlns="http://www.w3.org/1999/xhtml">external reset</xhtml></documentation>
30 </variable>
31 </inputVars>
32 <outputVars retain="false">
33 <variable name="STATUS">
34 <type> <BYTE /> </type>
35 <documentation><xhtml xmlns="http://www.w3.org/1999/xhtml">status (0x00 <> waiting, 0x01<>executing, 0x02<>err)</xhtml></documentation>
36 </variable>
37 <variable name="RECENT_EVENT">
38 <type> <INT /> </type>
39 <documentation><xhtml xmlns="http://www.w3.org/1999/xhtml">recent event (0<>none)</xhtml></documentation>
40 </variable>
41 <variable name="PENDING_EVENTS">
42 <type>
43 <array>
44 <dimension lower="0" upper="0" />
45 <baseType> <BYTE /> </baseType>
46 </array>
47 </type>
48 <documentation><xhtml xmlns="http://www.w3.org/1999/xhtml">pending input events incl timer elapse</xhtml></documentation>
49 </variable>
50 <variable name="ENABLED_EVENTS">
51 <type>
52 <array>
53 <dimension lower="0" upper="0" />
54 <baseType> <BYTE /> </baseType>
55 </array>
56 </type>
57 <documentation><xhtml xmlns="http://www.w3.org/1999/xhtml">events enabled by all generators</xhtml></documentation>
58 </variable>
59 <variable name="PARALLEL_STATE">
60 <type>
61 <array>
62 <dimension lower="0" upper="2" />
63 <baseType> <INT /> </baseType>
64 </array>
65 </type>
66 <documentation><xhtml xmlns="http://www.w3.org/1999/xhtml">parallel state</xhtml></documentation>
67 </variable>
68 </outputVars>
69 <localVars retain="false">
70 <variable name="fcg_exec_event">
71 <type> <INT /> </type>
72 <initialValue> <simpleValue value="-1" /> </initialValue>
73 <documentation><xhtml xmlns="http://www.w3.org/1999/xhtml">executed event (-1<>init, 0<>none)</xhtml></documentation>
74 </variable>
75 <variable name="fcg_sched_event">
76 <type> <INT /> </type>
77 <documentation><xhtml xmlns="http://www.w3.org/1999/xhtml">scheduled event (0<>none)</xhtml></documentation>
78 </variable>
79 <variable name="fcg_line_level_0">
80 <type> <BOOL /> </type>
81 <documentation><xhtml xmlns="http://www.w3.org/1999/xhtml">line levels</xhtml></documentation>
82 </variable>
83 <variable name="fcg_first_loop">
84 <type> <BOOL /> </type>
85 <documentation><xhtml xmlns="http://www.w3.org/1999/xhtml">loop flag</xhtml></documentation>
86 </variable>
87 <variable name="fcg_timer_Tick_cnt">
88 <type> <TIME /> </type>
89 <documentation><xhtml xmlns="http://www.w3.org/1999/xhtml">timer states</xhtml></documentation>
90 </variable>
91 <variable name="fcg_timer_Tick_run">
92 <type> <BOOL /> </type>
93 <documentation><xhtml xmlns="http://www.w3.org/1999/xhtml">timer states</xhtml></documentation>
94 </variable>
95 <variable name="fcg_time_elapsed">
96 <type> <TIME /> </type>
97 <documentation><xhtml xmlns="http://www.w3.org/1999/xhtml">elapsed time since last invokation</xhtml></documentation>
98 </variable>
99 <variable name="fcg_aux_locenabled">
100 <type>
101 <array>
102 <dimension lower="0" upper="0" />
103 <baseType> <BYTE /> </baseType>
104 </array>
105 </type>
106 <documentation><xhtml xmlns="http://www.w3.org/1999/xhtml">parse generator</xhtml></documentation>
107 </variable>
108 <variable name="fcg_aux_parsetrans">
109 <type> <INT /> </type>
110 <documentation><xhtml xmlns="http://www.w3.org/1999/xhtml">parse generator</xhtml></documentation>
111 </variable>
112 <variable name="fcg_aux_parseevent">
113 <type> <INT /> </type>
114 <documentation><xhtml xmlns="http://www.w3.org/1999/xhtml">parse generator</xhtml></documentation>
115 </variable>
116 <variable name="fcg_aux_executables">
117 <type>
118 <array>
119 <dimension lower="0" upper="0" />
120 <baseType> <BYTE /> </baseType>
121 </array>
122 </type>
123 <documentation><xhtml xmlns="http://www.w3.org/1999/xhtml">enabled events that can be executed</xhtml></documentation>
124 </variable>
125 <variable name="fcg_aux_wordret">
126 <type> <BYTE /> </type>
127 <documentation><xhtml xmlns="http://www.w3.org/1999/xhtml">aux maths and stack variables </xhtml></documentation>
128 </variable>
129 <variable name="fcg_aux_edge">
130 <type> <BOOL /> </type>
131 <documentation><xhtml xmlns="http://www.w3.org/1999/xhtml">aux maths and stack variables </xhtml></documentation>
132 </variable>
133 <variable name="fcg_aux_wordaddr">
134 <type> <INT /> </type>
135 <documentation><xhtml xmlns="http://www.w3.org/1999/xhtml">aux maths and stack variables </xhtml></documentation>
136 </variable>
137 <variable name="fcg_aux_bitaddr">
138 <type> <INT /> </type>
139 <documentation><xhtml xmlns="http://www.w3.org/1999/xhtml">aux maths and stack variables </xhtml></documentation>
140 </variable>
141 <variable name="fcg_aux_bitmask">
142 <type> <BYTE /> </type>
143 <documentation><xhtml xmlns="http://www.w3.org/1999/xhtml">aux maths and stack variables </xhtml></documentation>
144 </variable>
145 <variable name="fcg_bitmask_vector">
146 <type>
147 <array>
148 <dimension lower="0" upper="7" />
149 <baseType> <BYTE /> </baseType>
150 </array>
151 </type>
152 <initialValue>
153 <arrayValue>
154 <value> <simpleValue value="BYTE#16#01" /> </value>
155 <value> <simpleValue value="BYTE#16#02" /> </value>
156 <value> <simpleValue value="BYTE#16#04" /> </value>
157 <value> <simpleValue value="BYTE#16#08" /> </value>
158 <value> <simpleValue value="BYTE#16#10" /> </value>
159 <value> <simpleValue value="BYTE#16#20" /> </value>
160 <value> <simpleValue value="BYTE#16#40" /> </value>
161 <value> <simpleValue value="BYTE#16#80" /> </value>
162 </arrayValue>
163 </initialValue>
164 <documentation><xhtml xmlns="http://www.w3.org/1999/xhtml">mask vectors</xhtml></documentation>
165 </variable>
166 <variable name="fcg_generator_states_0">
167 <type>
168 <array>
169 <dimension lower="1" upper="6" />
170 <baseType> <INT /> </baseType>
171 </array>
172 </type>
173 <initialValue>
174 <arrayValue>
175 <value> <simpleValue value="0" /> </value>
176 <value> <simpleValue value="3" /> </value>
177 <value> <simpleValue value="6" /> </value>
178 <value> <simpleValue value="9" /> </value>
179 <value> <simpleValue value="12" /> </value>
180 <value> <simpleValue value="15" /> </value>
181 </arrayValue>
182 </initialValue>
183 <documentation><xhtml xmlns="http://www.w3.org/1999/xhtml">generator [Blink3]</xhtml></documentation>
184 </variable>
185 <variable name="fcg_generator_transitions_0">
186 <type>
187 <array>
188 <dimension lower="0" upper="17" />
189 <baseType> <INT /> </baseType>
190 </array>
191 </type>
192 <initialValue>
193 <arrayValue>
194 <value> <simpleValue value="3" /> </value>
195 <value> <simpleValue value="2" /> </value>
196 <value> <simpleValue value="0" /> </value>
197 <value> <simpleValue value="4" /> </value>
198 <value> <simpleValue value="3" /> </value>
199 <value> <simpleValue value="0" /> </value>
200 <value> <simpleValue value="5" /> </value>
201 <value> <simpleValue value="6" /> </value>
202 <value> <simpleValue value="0" /> </value>
203 <value> <simpleValue value="7" /> </value>
204 <value> <simpleValue value="5" /> </value>
205 <value> <simpleValue value="0" /> </value>
206 <value> <simpleValue value="8" /> </value>
207 <value> <simpleValue value="1" /> </value>
208 <value> <simpleValue value="0" /> </value>
209 <value> <simpleValue value="6" /> </value>
210 <value> <simpleValue value="4" /> </value>
211 <value> <simpleValue value="0" /> </value>
212 </arrayValue>
213 </initialValue>
214 <documentation><xhtml xmlns="http://www.w3.org/1999/xhtml">generator [Blink3]</xhtml></documentation>
215 </variable>
216 <variable name="fcg_generator_transitions_1">
217 <type>
218 <array>
219 <dimension lower="0" upper="15" />
220 <baseType> <INT /> </baseType>
221 </array>
222 </type>
223 <initialValue>
224 <arrayValue>
225 <value> <simpleValue value="3" /> </value>
226 <value> <simpleValue value="13" /> </value>
227 <value> <simpleValue value="4" /> </value>
228 <value> <simpleValue value="13" /> </value>
229 <value> <simpleValue value="5" /> </value>
230 <value> <simpleValue value="13" /> </value>
231 <value> <simpleValue value="6" /> </value>
232 <value> <simpleValue value="13" /> </value>
233 <value> <simpleValue value="7" /> </value>
234 <value> <simpleValue value="13" /> </value>
235 <value> <simpleValue value="8" /> </value>
236 <value> <simpleValue value="13" /> </value>
237 <value> <simpleValue value="0" /> </value>
238 <value> <simpleValue value="2" /> </value>
239 <value> <simpleValue value="0" /> </value>
240 <value> <simpleValue value="0" /> </value>
241 </arrayValue>
242 </initialValue>
243 <documentation><xhtml xmlns="http://www.w3.org/1999/xhtml">generator [Delay]</xhtml></documentation>
244 </variable>
245 <variable name="fcg_generator_transitions_2">
246 <type>
247 <array>
248 <dimension lower="0" upper="11" />
249 <baseType> <INT /> </baseType>
250 </array>
251 </type>
252 <initialValue>
253 <arrayValue>
254 <value> <simpleValue value="6" /> </value>
255 <value> <simpleValue value="0" /> </value>
256 <value> <simpleValue value="1" /> </value>
257 <value> <simpleValue value="5" /> </value>
258 <value> <simpleValue value="0" /> </value>
259 <value> <simpleValue value="3" /> </value>
260 <value> <simpleValue value="5" /> </value>
261 <value> <simpleValue value="6" /> </value>
262 <value> <simpleValue value="0" /> </value>
263 <value> <simpleValue value="1" /> </value>
264 <value> <simpleValue value="5" /> </value>
265 <value> <simpleValue value="0" /> </value>
266 </arrayValue>
267 </initialValue>
268 <documentation><xhtml xmlns="http://www.w3.org/1999/xhtml">generator [WaitButton]</xhtml></documentation>
269 </variable>
270 <variable name="fcg_systime_ton">
271 <type> <derived name="TON" /> </type>
272 <documentation><xhtml xmlns="http://www.w3.org/1999/xhtml">iec timer to simulate system time</xhtml></documentation>
273 </variable>
274 <variable name="fcg_systime_recent">
275 <type> <TIME /> </type>
276 <documentation><xhtml xmlns="http://www.w3.org/1999/xhtml">iec timer to simulate system time</xhtml></documentation>
277 </variable>
278 <variable name="fcg_systime_now">
279 <type> <TIME /> </type>
280 <documentation><xhtml xmlns="http://www.w3.org/1999/xhtml">iec timer to simulate system time</xhtml></documentation>
281 </variable>
282 </localVars>
283 <externalVars>
284 <variable name="input">
285 <type> <BOOL /> </type>
286 <documentation><xhtml xmlns="http://www.w3.org/1999/xhtml">import i/o variables and addresses</xhtml></documentation>
287 </variable>
288 </externalVars>
289</interface>
290<body>
291<ST>
292<xhtml xmlns="http://www.w3.org/1999/xhtml">
293(* ************************************************ *)
294(* CodeGenerator: Target IEC 61131 Structured Text *)
295(* ************************************************ *)
296
297
298(* CompileDES 3.10 (using libFAUDES 2.28a) *)
299(* Configuration: Blink_Pox_2017_02 *)
300
301
302
303(* ************************************************ *)
304(* * executor core cyclic code: reset/initialise * *)
305(* ************************************************ *)
306
307
308(* ************************************************ *)
309(* * reset internal state * *)
310
311(* set internal reset flag *)
312IF RESET THEN
313 fcg_exec_event := -1;
314END_IF;
315
316(* do reset core *)
317IF fcg_exec_event = -1 THEN
318 (* clear status *)
319 STATUS := 0;
320 (* set initial state *)
321 PARALLEL_STATE[0] := 1;
322 PARALLEL_STATE[1] := 0;
323 PARALLEL_STATE[2] := 0;
324 (* clear scheduled event *)
325 fcg_sched_event := 0;
326 (* clear recent event *)
327 RECENT_EVENT := 0;
328 (* clear pending/enabled events *)
329 PENDING_EVENTS[0] := BYTE#0;
330 ENABLED_EVENTS[0] := BYTE#0;
331 (* reset timer *)
332 fcg_timer_Tick_run := false;
333 fcg_timer_Tick_cnt := TIME#1s;
334END_IF;
335
336(* do reset/track systime *)
337IF fcg_exec_event = -1 THEN
338 fcg_systime_ton(IN:=false);
339 fcg_systime_recent := TIME#0ms;
340END_IF;
341fcg_systime_ton(IN:=true, PT:=TIME#2h, ET=>fcg_systime_now);
342fcg_time_elapsed := fcg_systime_now - fcg_systime_recent;
343IF fcg_systime_now < TIME#1h THEN
344 fcg_systime_recent := fcg_systime_now;
345ELSE
346 fcg_systime_ton(IN:=false, PT:=TIME#2h);
347 fcg_systime_ton(IN:=true, PT:=TIME#2h);
348 fcg_systime_recent := TIME#0ms;
349END_IF;
350
351
352
353(* ************************************************ *)
354(* * bail out on external reset * *)
355
356IF RESET THEN
357 RETURN;
358END_IF;
359
360
361
362(* ************************************************ *)
363(* * update timer states * *)
364
365
366IF fcg_time_elapsed > TIME#0ms THEN
367 IF fcg_timer_Tick_run THEN
368 IF fcg_timer_Tick_cnt > fcg_time_elapsed THEN
369 fcg_timer_Tick_cnt := fcg_timer_Tick_cnt - fcg_time_elapsed;
370 ELSE
371 fcg_timer_Tick_cnt := TIME#0s;
372 END_IF;
373 END_IF;
374END_IF;
375
376
377
378(* ************************************************ *)
379(* * executor core cyclic code: begin * *)
380(* ************************************************ *)
381
382
383
384(* ************************************************ *)
385(* * sense input events * *)
386
387(* init: reset all line data and generate statics *)
388IF fcg_exec_event = -1 THEN
389 fcg_line_level_0 := input;
390 IF fcg_line_level_0 THEN
391 (* positive value: trigger init event [PushButton] *)
392 PENDING_EVENTS[0] := PENDING_EVENTS[0] OR BYTE#16#01;
393 END_IF;
394END_IF;
395
396(* normal operation: read lines and detect edges *)
397IF fcg_exec_event <> -1 THEN
398 (* read line [input] *)
399 fcg_aux_edge := input;
400 IF fcg_aux_edge <> fcg_line_level_0 THEN
401 IF fcg_aux_edge THEN
402 (* positive edge: trigger input event [PushButton] *)
403 PENDING_EVENTS[0] := PENDING_EVENTS[0] OR BYTE#16#01;
404 fcg_sched_event := 0;
405 END_IF;
406 fcg_line_level_0 := fcg_aux_edge;
407 END_IF;
408END_IF;
409
410
411
412(* ************************************************ *)
413(* * sense timer elapse * *)
414
415IF fcg_timer_Tick_run AND (fcg_timer_Tick_cnt <= TIME#0ms) THEN
416 fcg_timer_Tick_run := false;
417 PENDING_EVENTS[0] := PENDING_EVENTS[0] OR BYTE#16#02;
418 fcg_sched_event := 0;
419END_IF;
420
421
422
423(* ************************************************ *)
424(* * event execution loop * *)
425
426(* clear status to waiting *)
427STATUS := 0;
428(* clear event report *)
429RECENT_EVENT := 0;
430(* set entry flag *)
431fcg_first_loop := true;
432WHILE true DO
433
434
435
436(* ************************************************ *)
437(* * update enabled events after execution * *)
438
439(* if event was executed (and on init) *)
440IF fcg_exec_event <> 0 THEN
441
442 (* set all to enabled *)
443 ENABLED_EVENTS[0] := BYTE#16#ff;
444
445 (* setup enabled events by [Blink3] *)
446 fcg_aux_locenabled[0] := BYTE#16#03;
447 fcg_aux_parsetrans := fcg_generator_states_0[PARALLEL_STATE[0]];
448 WHILE true DO
449 fcg_aux_parseevent := fcg_generator_transitions_0[fcg_aux_parsetrans];
450 IF fcg_aux_parseevent = 0 THEN EXIT; END_IF;
451 fcg_aux_bitaddr := fcg_aux_parseevent;
452 fcg_aux_bitaddr := fcg_aux_bitaddr - 1;
453 fcg_aux_bitmask := fcg_bitmask_vector[fcg_aux_bitaddr];
454 fcg_aux_locenabled[fcg_aux_wordaddr] := fcg_aux_locenabled[fcg_aux_wordaddr] OR fcg_aux_bitmask;
455 fcg_aux_parsetrans := fcg_aux_parsetrans + 2;
456 END_WHILE;
457 (* restrict enabled events *)
458 ENABLED_EVENTS[0] := ENABLED_EVENTS[0] AND fcg_aux_locenabled[0];
459
460 (* setup enabled events by [Delay] *)
461 fcg_aux_locenabled[0] := BYTE#16#01;
462 fcg_aux_parsetrans := PARALLEL_STATE[1];
463 WHILE true DO
464 fcg_aux_parseevent := fcg_generator_transitions_1[fcg_aux_parsetrans];
465 IF fcg_aux_parseevent = 0 THEN EXIT; END_IF;
466 fcg_aux_bitaddr := fcg_aux_parseevent;
467 fcg_aux_bitaddr := fcg_aux_bitaddr - 1;
468 fcg_aux_bitmask := fcg_bitmask_vector[fcg_aux_bitaddr];
469 fcg_aux_locenabled[fcg_aux_wordaddr] := fcg_aux_locenabled[fcg_aux_wordaddr] OR fcg_aux_bitmask;
470 fcg_aux_parsetrans := fcg_aux_parsetrans + 2;
471 END_WHILE;
472 (* restrict enabled events *)
473 ENABLED_EVENTS[0] := ENABLED_EVENTS[0] AND fcg_aux_locenabled[0];
474
475 (* setup enabled events by [WaitButton] *)
476 fcg_aux_locenabled[0] := BYTE#16#da;
477 fcg_aux_parsetrans := PARALLEL_STATE[2];
478 WHILE true DO
479 fcg_aux_parseevent := fcg_generator_transitions_2[fcg_aux_parsetrans];
480 IF fcg_aux_parseevent = 0 THEN EXIT; END_IF;
481 fcg_aux_bitaddr := fcg_aux_parseevent;
482 fcg_aux_bitaddr := fcg_aux_bitaddr - 1;
483 fcg_aux_bitmask := fcg_bitmask_vector[fcg_aux_bitaddr];
484 fcg_aux_locenabled[fcg_aux_wordaddr] := fcg_aux_locenabled[fcg_aux_wordaddr] OR fcg_aux_bitmask;
485 fcg_aux_parsetrans := fcg_aux_parsetrans + 2;
486 END_WHILE;
487 (* restrict enabled events *)
488 ENABLED_EVENTS[0] := ENABLED_EVENTS[0] AND fcg_aux_locenabled[0];
489
490 (* dispose event *)
491 fcg_exec_event := 0;
492 fcg_sched_event := 0;
493END_IF;
494
495
496
497(* ************************************************ *)
498(* * schedule next event to execute * *)
499
500IF fcg_sched_event = 0 THEN
501
502 (* setup candidate set to "pending or internal" *)
503 fcg_aux_executables[0] := PENDING_EVENTS[0] OR BYTE#16#fc;
504 (* restrict candidate set by "enabled" *)
505 fcg_aux_executables[0] := fcg_aux_executables[0] AND ENABLED_EVENTS[0];
506
507 (* find highest priority event (lowest bitaddress) *)
508 fcg_sched_event := 0;
509 IF NOT ( fcg_aux_executables[0] = BYTE#0 ) THEN
510 IF ( fcg_aux_executables[0] AND BYTE#16#0f ) <> BYTE#0 THEN
511 IF ( fcg_aux_executables[0] AND BYTE#16#03 ) <> BYTE#0 THEN
512 IF ( fcg_aux_executables[0] AND BYTE#16#01 ) <> BYTE#0 THEN
513 fcg_sched_event := 1;
514 ELSE
515 fcg_sched_event := 2;
516 END_IF;
517 ELSE
518 IF ( fcg_aux_executables[0] AND BYTE#16#04 ) <> BYTE#0 THEN
519 fcg_sched_event := 3;
520 ELSE
521 fcg_sched_event := 4;
522 END_IF;
523 END_IF;
524 ELSE
525 IF ( fcg_aux_executables[0] AND BYTE#16#30 ) <> BYTE#0 THEN
526 IF ( fcg_aux_executables[0] AND BYTE#16#10 ) <> BYTE#0 THEN
527 fcg_sched_event := 5;
528 ELSE
529 fcg_sched_event := 6;
530 END_IF;
531 ELSE
532 IF ( fcg_aux_executables[0] AND BYTE#16#40 ) <> BYTE#0 THEN
533 fcg_sched_event := 7;
534 ELSE
535 fcg_sched_event := 8;
536 END_IF;
537 END_IF;
538 END_IF;
539 END_IF;
540
541 (* remove scheduled event from pending events *)
542 IF fcg_sched_event > 0 THEN
543 fcg_aux_bitaddr := fcg_sched_event;
544 fcg_aux_bitaddr := fcg_aux_bitaddr - 1;
545 fcg_aux_bitmask := fcg_bitmask_vector[fcg_aux_bitaddr];
546 PENDING_EVENTS[fcg_aux_wordaddr] := PENDING_EVENTS[fcg_aux_wordaddr] AND (NOT fcg_aux_bitmask );
547 END_IF;
548
549 (* detect sync error *)
550 IF fcg_sched_event = 0 THEN
551 fcg_aux_wordret := PENDING_EVENTS[0];
552 IF NOT ( fcg_aux_wordret = BYTE#0 ) THEN
553 STATUS := STATUS OR BYTE#16#02;
554 END_IF;
555 END_IF;
556
557 (* cancel pending events if no event could be scheduled *)
558 IF fcg_sched_event = 0 THEN
559 PENDING_EVENTS[0] := BYTE#0;
560 END_IF;
561
562END_IF;
563
564
565
566(* ************************************************ *)
567(* * break execution loop * *)
568
569IF fcg_sched_event = 0 THEN EXIT; END_IF;
570fcg_first_loop := false;
571
572
573
574(* ************************************************ *)
575(* * execute scheduled event * *)
576
577IF fcg_sched_event <> 0 THEN
578
579 fcg_exec_event := fcg_sched_event;
580 fcg_sched_event := 0;
581 STATUS := STATUS OR BYTE#16#01;
582
583 (* execute event for [Blink3] *)
584 fcg_aux_parsetrans := fcg_generator_states_0[PARALLEL_STATE[0]];
585 WHILE true DO
586 fcg_aux_parseevent := fcg_generator_transitions_0[fcg_aux_parsetrans];
587 IF fcg_aux_parseevent = fcg_exec_event THEN EXIT; END_IF;
588 IF fcg_aux_parseevent = 0 THEN EXIT; END_IF;
589 fcg_aux_parsetrans := fcg_aux_parsetrans + 2;
590 END_WHILE;
591 IF fcg_aux_parseevent > 0 THEN
592 fcg_aux_parsetrans := fcg_aux_parsetrans + 1;
593 PARALLEL_STATE[0] := fcg_generator_transitions_0[fcg_aux_parsetrans];
594 END_IF;
595
596 (* execute event for [Delay] *)
597 fcg_aux_parsetrans := PARALLEL_STATE[1];
598 WHILE true DO
599 fcg_aux_parseevent := fcg_generator_transitions_1[fcg_aux_parsetrans];
600 IF fcg_aux_parseevent = fcg_exec_event THEN EXIT; END_IF;
601 IF fcg_aux_parseevent = 0 THEN EXIT; END_IF;
602 fcg_aux_parsetrans := fcg_aux_parsetrans + 2;
603 END_WHILE;
604 IF fcg_aux_parseevent > 0 THEN
605 fcg_aux_parsetrans := fcg_aux_parsetrans + 1;
606 PARALLEL_STATE[1] := fcg_generator_transitions_1[fcg_aux_parsetrans];
607 END_IF;
608
609 (* execute event for [WaitButton] *)
610 fcg_aux_parsetrans := PARALLEL_STATE[2];
611 WHILE true DO
612 fcg_aux_parseevent := fcg_generator_transitions_2[fcg_aux_parsetrans];
613 IF fcg_aux_parseevent = fcg_exec_event THEN EXIT; END_IF;
614 IF fcg_aux_parseevent = 0 THEN EXIT; END_IF;
615 fcg_aux_parsetrans := fcg_aux_parsetrans + 2;
616 END_WHILE;
617 IF fcg_aux_parseevent > 0 THEN
618 fcg_aux_parsetrans := fcg_aux_parsetrans + 1;
619 PARALLEL_STATE[2] := fcg_generator_transitions_2[fcg_aux_parsetrans];
620 END_IF;
621
622 (* record *)
623 RECENT_EVENT := fcg_exec_event;
624
625END_IF;
626
627
628
629(* ************************************************ *)
630(* * operate timers * *)
631
632IF fcg_exec_event > 0 THEN
633 CASE fcg_exec_event OF
634 3 .. 8:
635 fcg_timer_Tick_cnt := TIME#1s;
636 fcg_timer_Tick_run := true;
637 END_CASE;
638END_IF;
639
640
641
642(* ************************************************ *)
643(* * operate outputs * *)
644
645IF fcg_exec_event > 2 THEN
646 CASE fcg_exec_event OF
647 3:
648 (* outputs for [OnLedA] *)
649 %QX55.1 := true;
650 4:
651 (* outputs for [OnLedB] *)
652 %QX55.2 := true;
653 5:
654 (* outputs for [OnLedC] *)
655 %QX55.3 := true;
656 6:
657 (* outputs for [OffLedA] *)
658 %QX55.1 := false;
659 7:
660 (* outputs for [OffLedB] *)
661 %QX55.2 := false;
662 8:
663 (* outputs for [OffLedC] *)
664 %QX55.3 := false;
665 END_CASE;
666END_IF;
667
668
669
670(* ************************************************ *)
671(* * end execution loop * *)
672
673END_WHILE;
674
675
676
677
678(* ************************************************ *)
679(* * executor core cyclic code: end * *)
680(* ************************************************ *)
681
682
683
684(* ************************************************ *)
685(* CodeGenerator: Generated Code Ends Here *)
686(* ************************************************ *)
687</xhtml>
688</ST>
689</body>
690</pou>
691<pou name="fcg_event_lookup_f" pouType="function">
692<interface>
693 <returnType> <string /> </returnType>
694 <inputVars retain="false">
695 <variable name="IDX">
696 <type> <INT /> </type>
697 <documentation><xhtml xmlns="http://www.w3.org/1999/xhtml">event index</xhtml></documentation>
698 </variable>
699 </inputVars>
700 <localVars retain="false" constant="true">
701 <variable name="fcg_event_lookup">
702 <type>
703 <array>
704 <dimension lower="1" upper="8" />
705 <baseType> <string length="10" /> </baseType>
706 </array>
707 </type>
708 <initialValue>
709 <arrayValue>
710 <value> <simpleValue value="'PushButton'" /> </value>
711 <value> <simpleValue value="'Tick'" /> </value>
712 <value> <simpleValue value="'OnLedA'" /> </value>
713 <value> <simpleValue value="'OnLedB'" /> </value>
714 <value> <simpleValue value="'OnLedC'" /> </value>
715 <value> <simpleValue value="'OffLedA'" /> </value>
716 <value> <simpleValue value="'OffLedB'" /> </value>
717 <value> <simpleValue value="'OffLedC'" /> </value>
718 </arrayValue>
719 </initialValue>
720 <documentation><xhtml xmlns="http://www.w3.org/1999/xhtml">event name lookup table</xhtml></documentation>
721 </variable>
722 </localVars>
723</interface>
724<body>
725<ST>
726<xhtml xmlns="http://www.w3.org/1999/xhtml">fcg_event_lookup_f := fcg_event_lookup[IDX];
727</xhtml></ST>
728</body>
729</pou>
730<pou name="fcg_state_lookup_f" pouType="function">
731<interface>
732 <returnType> <string /> </returnType>
733 <inputVars retain="false">
734 <variable name="GID">
735 <type> <INT /> </type>
736 <documentation><xhtml xmlns="http://www.w3.org/1999/xhtml">generator id</xhtml></documentation>
737 </variable>
738 <variable name="IDX">
739 <type> <INT /> </type>
740 <documentation><xhtml xmlns="http://www.w3.org/1999/xhtml">state index</xhtml></documentation>
741 </variable>
742 </inputVars>
743 <localVars retain="false" constant="true">
744 <variable name="fcg_state_lookup_0">
745 <type>
746 <array>
747 <dimension lower="1" upper="6" />
748 <baseType> <string length="4" /> </baseType>
749 </array>
750 </type>
751 <initialValue>
752 <arrayValue>
753 <value> <simpleValue value="'On0'" /> </value>
754 <value> <simpleValue value="'On1'" /> </value>
755 <value> <simpleValue value="'On2'" /> </value>
756 <value> <simpleValue value="'Off2'" /> </value>
757 <value> <simpleValue value="'Off1'" /> </value>
758 <value> <simpleValue value="'#6'" /> </value>
759 </arrayValue>
760 </initialValue>
761 <documentation><xhtml xmlns="http://www.w3.org/1999/xhtml">state name lookup for generator [Blink3]</xhtml></documentation>
762 </variable>
763 </localVars>
764</interface>
765<body>
766<ST>
767<xhtml xmlns="http://www.w3.org/1999/xhtml">fcg_state_lookup_f:='';
768CASE GID OF
7690: fcg_state_lookup_f := fcg_state_lookup_0[IDX];
770
771
772END_CASE;
773IF LEN(fcg_state_lookup_f) = 0 THEN
774 fcg_state_lookup_f := CONCAT('s',INT_TO_STRING(IDX));
775END_IF;
776</xhtml></ST>
777</body>
778</pou>
779</pous>
780</types>
781<instances>
782 <configurations />
783</instances>
784</project>