summaryrefslogtreecommitdiffstats
path: root/examples/linuxcnc-demo/awlsim.hal
blob: a2be97ffef4b7130cce383bc1ce425f19be282df (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
# ---------------------------------------
# --- Awlsim
# --- LinuxCNC HAL configuration file
# ------


# --- Load the awlsim HAL userspace module ---
#
# Parameters:
#  --listen HOST:PORT	: The HOST and PORT the core server should listen on.
#			  Defaults to localhost:4151
#			  You can connect with awlsim-gui to this port
#			  to watch, debug or change the AWL program.
#
#  --input-base BASE	: S7 input base-address byte-offset to use for the HAL module.
#			  If 0 is used, address-mapping will start at I 0.0
#			  If 1 is used, address-mapping will start at I 1.0
#			  etc...
#			  This overrides the value from the project file.
#
#  --output-base BASE	: S7 output base-address byte-offset to use for the HAL module.
#			  If 0 is used, address-mapping will start at Q 0.0
#			  If 1 is used, address-mapping will start at Q 1.0
#			  etc...
#			  This overrides the value from the project file.
#
#  --input-size SIZE	: Size of the input area mapping, in bytes.
#			  This overrides the value from the project file.
#
#  --output-size SIZE	: Size of the output area mapping, in bytes.
#			  This overrides the value from the project file.
#
#  --loglevel LVL	: Change the log level.
#
#  --nice NICE		: Renice the process. -20 <= NICE <= 19.
#			  Default: Do not renice.
#
#  Last argument	: The Awlsim AWL/STL project to load and run.
#
loadusr -Wn awlsim awlsim-linuxcnc-hal --listen localhost:4151 linuxcnc-demo.awlpro


# --- Enable the used input pins ---
# All input pins are deactivated by default.
# So all input pins connected below, should be activated here by writing
# a '1' to the '.active' pin.
# Deactivated input pins will not be forwarded from LinuxCNC to the awlsim PLC program.
setp	awlsim.input.float.0.active		1
setp	awlsim.input.float.4.active		1
setp	awlsim.input.float.8.active		1
setp	awlsim.input.bit.12.0.active		1
setp	awlsim.input.bit.12.1.active		1
setp	awlsim.input.bit.12.2.active		1
setp	awlsim.input.bit.12.3.active		1
setp	awlsim.input.bit.12.4.active		1
setp	awlsim.input.bit.12.5.active		1

# --- Connect input pins ---
net	xpos-cmd		=> awlsim.input.float.0		# "X_position_in"
net	ypos-cmd		=> awlsim.input.float.4		# "Y_position_in"
net	zpos-cmd		=> awlsim.input.float.8		# "Z_position_in"
net	heartbeat		=> awlsim.input.bit.12.0	# "Heartbeat_in"
net	estop-out-not		=> awlsim.input.bit.12.1	# "Estop_in_not"
net	spindle-cw		=> awlsim.input.bit.12.2	# "Spindle_cw_in"
net	spindle-ccw		=> awlsim.input.bit.12.3	# "Spindle_ccw_in"
net	coolant-mist		=> awlsim.input.bit.12.4	# "Coolant_mist_in"
net	coolant-flood		=> awlsim.input.bit.12.5	# "Coolant_flood_in"


# --- Enable the used output pins ---
# All output pins are deactivated by default.
# So all output pins connected below, should be activated here by writing
# a '1' to the '.active' pin.
# Deactivated output pins will not be forwarded from the awlsim PLC program to LinuxCNC.
setp	awlsim.output.bit.0.0.active		1
setp	awlsim.output.bit.0.1.active		1
setp	awlsim.output.bit.0.2.active		1
setp	awlsim.output.bit.1.0.active		1
setp	awlsim.output.bit.1.1.active		1
setp	awlsim.output.bit.1.2.active		1
setp	awlsim.output.bit.2.0.active		1
setp	awlsim.output.bit.2.1.active		1

# --- Connect output pins ---
net	limit-x			<= awlsim.output.bit.0.0	# "X_limit_out"
net	limit-y			<= awlsim.output.bit.0.1	# "Y_limit_out"
net	limit-z			<= awlsim.output.bit.0.2	# "Z_limit_out"
net	home-x			<= awlsim.output.bit.1.0	# "X_home_out"
net	home-y			<= awlsim.output.bit.1.1	# "Y_home_out"
net	home-z			<= awlsim.output.bit.1.2	# "Z_home_out"
net	awlsim-heartbeat	<= awlsim.output.bit.2.0	# "Heartbeat_out"
net	estop-in-not		<= awlsim.output.bit.2.1	# "Estop_out_not"



# Always keep this at the end of this file.
# This will activate data transfer between awlsim and LinuxCNC.
setp	awlsim.config.ready	1
bues.ch cgit interface