aboutsummaryrefslogtreecommitdiffstats
path: root/examples/linuxcnc-demo/linuxcnc-demo.awlpro
blob: 18e7c0daef7e63d2855f60f9d7e61c3e1ae25017 (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
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Awlsim project file generated by awlsim-0.66.0-pre -->
<awlsim_project date_create="2015-01-04 14:29:54.007468"
                date_modify="2018-07-08 18:00:06.516647"
                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"
		        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="OB 1"
		        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
	
	CALL "FC_heartbeat"
	CALL "FC_limit_switches"
	CALL "FC_home_switches"
	CALL "FC_spindle"
	CALL "FC_coolant"
	CALL "FC_estop"
	
END_ORGANIZATION_BLOCK

]]></source>

		<!-- AWL/STL source code -->
		<source enabled="1"
		        name="Heartbeat"
		        type="0"><![CDATA[
FUNCTION "FC_heartbeat" : VOID
BEGIN
	// Generate the heartbeat output
	UN	"HB_out_Tb"
	=	"Heartbeat_out"
	L	S5T#100ms
	SV	"HB_out_Ta"
	UN	"HB_out_Ta"
	L	S5T#100ms
	SV	"HB_out_Tb"
	
	// Check the heartbeat input
	U	"Heartbeat_in"
	L	S5T#500ms
	SA	"HB_in_T"
	U	"HB_in_T"
	=	"Heartbeat_in_ok"
END_FUNCTION

]]></source>

		<!-- AWL/STL source code -->
		<source enabled="1"
		        name="E-stop"
		        type="0"><![CDATA[
FUNCTION "FC_estop" : VOID
BEGIN
	// Create our emergency stop signal
	U	"Estop_in_not"
	U	"Heartbeat_in_ok"
	=	"Estop_out_not"
END_FUNCTION

]]></source>

		<!-- AWL/STL source code -->
		<source enabled="1"
		        name="Limit switches"
		        type="0"><![CDATA[
FUNCTION "FC_limit_switches" : VOID
BEGIN
	// Emulate limit switches
	
	// X
	O(
	L	"X_position_in"
	L	1.0
	>=R
	)
	O(
	L	"X_position_in"
	L	-201.0
	<=R
	)
	=	"X_limit_out"
	
	// Y
	O(
	L	"Y_position_in"
	L	1.0
	>=R
	)
	O(
	L	"Y_position_in"
	L	-201.0
	<=R
	)
	=	"Y_limit_out"
	
	// Z
	O(
	L	"Z_position_in"
	L	1.0
	>=R
	)
	O(
	L	"Z_position_in"
	L	-201.0
	<=R
	)
	=	"Z_limit_out"
END_FUNCTION

]]></source>

		<!-- AWL/STL source code -->
		<source enabled="1"
		        name="Home switches"
		        type="0"><![CDATA[
FUNCTION "FC_home_switches" : VOID
BEGIN
	// Emulate home switches
	
	// X
	U(
	L	"X_position_in"
	L	-10.0
	<=R
	)
	U(
	L	"X_position_in"
	L	-15.0
	>=R
	)
	=	"X_home_out"
	
	// Y
	U(
	L	"Y_position_in"
	L	-10.0
	<=R
	)
	U(
	L	"Y_position_in"
	L	-15.0
	>=R
	)
	=	"Y_home_out"
	
	// Z
	U(
	L	"Z_position_in"
	L	-10.0
	<=R
	)
	U(
	L	"Z_position_in"
	L	-15.0
	>=R
	)
	=	"Z_home_out"
END_FUNCTION

]]></source>

		<!-- AWL/STL source code -->
		<source enabled="1"
		        name="Spindle"
		        type="0"><![CDATA[
FUNCTION "FC_spindle" : VOID
BEGIN
	// TODO: Handle spindle signals
	// "Spindle_cw_in"
	// "Spindle_ccw_in"
END_FUNCTION

]]></source>

		<!-- AWL/STL source code -->
		<source enabled="1"
		        name="Coolant"
		        type="0"><![CDATA[
FUNCTION "FC_coolant" : VOID
BEGIN
	// TODO: Handle coolant signals
	// "Coolant_mist_in"
	// "Coolant_flood_in"
END_FUNCTION

]]></source>
	</language_awl>

	<!-- Symbol table configuration -->
	<symbols>
		<!-- symbol table source code -->
		<source enabled="1"
		        name="Inputs / outputs"
		        type="3"><![CDATA[
126,X_position_in           ED 0        REAL      The current position (X)
126,Y_position_in           ED 4        REAL      The current position (Y)
126,Z_position_in           ED 8        REAL      The current position (Z)
126,Heartbeat_in            E 12.0      BOOL      LinuxCNC heartbeat input
126,Estop_in_not            E 12.1      BOOL      Emergency stop input
126,Spindle_cw_in           E 12.2      BOOL      Spindle "clockwise" enable input
126,Spindle_ccw_in          E 12.3      BOOL      Spindle "counterclockwise" enable input
126,Coolant_mist_in         E 12.4      BOOL      Mist coolant enable input
126,Coolant_flood_in        E 12.5      BOOL      Flood coolant enable input
126,X_limit_out             A 0.0       BOOL      Limit switch output (X)
126,Y_limit_out             A 0.1       BOOL      Limit switch output (Y)
126,Z_limit_out             A 0.2       BOOL      Limit switch output (Z)
126,X_home_out              A 1.0       BOOL      Home switch output (X)
126,Y_home_out              A 1.1       BOOL      Home switch output (Y)
126,Z_home_out              A 1.2       BOOL      Home switch output (Z)
126,Heartbeat_out           A 2.0       BOOL      LinuxCNC heartbeat output
126,Estop_out_not           A 2.1       BOOL      Emergency stop output

]]></source>

		<!-- symbol table source code -->
		<source enabled="1"
		        name="Flags"
		        type="3"><![CDATA[
126,Heartbeat_in_ok         M 0.0       BOOL      Result of the Heartbeat_in check

]]></source>

		<!-- symbol table source code -->
		<source enabled="1"
		        name="Timers"
		        type="3"><![CDATA[
126,HB_out_Ta               T 1         TIMER     Heartbeat_out timer A
126,HB_out_Tb               T 2         TIMER     Heartbeat_out timer B
126,HB_in_T                 T 3         TIMER     Heartbeat_in check timer

]]></source>

		<!-- symbol table source code -->
		<source enabled="1"
		        name="Functions"
		        type="3"><![CDATA[
126,FC_heartbeat            FC 1        FC 1      Function for heartbeat handling
126,FC_estop                FC 2        FC 2      Function for emergency stop handling
126,FC_limit_switches       FC 3        FC 3      Function for handling limit switches
126,FC_home_switches        FC 4        FC 4      Function for handling home switches
126,FC_spindle              FC 5        FC 5      Function for spindle handling
126,FC_coolant              FC 6        FC 6      Function for coolant handling

]]></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="localhost"
		         port="4151"
		         timeout_ms="3000" />

		<!-- Transport tunnel -->
		<tunnel local_port="-1"
		        type="0">
			<ssh executable="ssh"
			     port="22"
			     user="pi" />
		</tunnel>
	</core_link>

	<!-- Hardware modules configuration -->
	<hardware>
		<!-- Loaded hardware module -->
		<module name="dummy">
			<params>
				<param name="inputAddressBase"
				       value="128" />
				<param name="outputAddressBase"
				       value="128" />
			</params>
		</module>

		<!-- Loaded hardware module -->
		<module name="linuxcnc">
			<params>
				<param name="hal" />
				<param name="inputAddressBase"
				       value="0" />
				<param name="inputSize"
				       value="16" />
				<param name="outputAddressBase"
				       value="0" />
				<param name="outputSize"
				       value="8" />
			</params>
		</module>
	</hardware>

	<!-- Graphical user interface configuration -->
	<gui>
		<editor autoindent="1"
		        paste_autoindent="1"
		        validation="1" />
	</gui>
</awlsim_project>
bues.ch cgit interface