IF clause in a HAL File
14 Feb 2016 10:14 #70101
by Michael80
IF clause in a HAL File was created by Michael80
Can i use a IF clause in a HAL file?
if not, how i can manage this
e.g.
if motion.digital-out-00 true then
begin
blubb
else
bla
end
I´m a little bit confused right now
Thanks for your help
BR
Michael
if not, how i can manage this
e.g.
if motion.digital-out-00 true then
begin
blubb
else
bla
end
I´m a little bit confused right now
Thanks for your help
BR
Michael
Please Log in or Create an account to join the conversation.
14 Feb 2016 11:51 #70102
by BigJohnT
Replied by BigJohnT on topic IF clause in a HAL File
Can you expand a bit on what your trying to do?
JT
JT
Please Log in or Create an account to join the conversation.
23 Feb 2016 15:01 #70515
by andypugh
No. At the point that the HAL file is read the pins are all zero. The HAL file sets up a network of data signals. It is read once, and once only, before the system is active.
What do you want to do? You can probably do what you want with HAL components, such as mux2.
It is possible to have conditional statements in a HAL file with haltcl. But the conditions can not be based on hal pin values.
linuxcnc.org/docs/html/hal/haltcl.html
Replied by andypugh on topic IF clause in a HAL File
Can i use a IF clause in a HAL file?
...
if motion.digital-out-00 true then
No. At the point that the HAL file is read the pins are all zero. The HAL file sets up a network of data signals. It is read once, and once only, before the system is active.
What do you want to do? You can probably do what you want with HAL components, such as mux2.
It is possible to have conditional statements in a HAL file with haltcl. But the conditions can not be based on hal pin values.
linuxcnc.org/docs/html/hal/haltcl.html
Please Log in or Create an account to join the conversation.
23 Feb 2016 16:27 #70525
by dgarrett
Notes:
1. A [HAL]HALFILE=filename.tcl is executed in sequence at startup
and the pins that exist will depend upon its position in the halfile
sequence. Some hal pins, notably ini.* pins, are created too late
to be visible for any [HAL]HALFILE (man milltask)
2. However, a long-lived haltcl script can be run in a separate process
and use polling methods to continuously interrogate any hal pin.
Scripts can be started from an ini file using [APPLICATIONS]APP=
Ref: linuxcnc.org/docs/2.7/html/config/ini-co...applications_section
3. Example sim configs that demonstrate spawning an independent tcl
process are:
configs/sim/axis/moveoff/*.ini
[APPLICATIONS]APP=moveoff_gui -- runs an independent gui that continuously polls hal pins
configs/sim/axis/xhc-hb04/*.ini
[APPLICATIONS}APP=monitor-xhc-hb04 -- polls hal pins periodically
[APPLICATIONS]APP=xhc-hb04-accels -- waits for ini.* pins to be created
Source ref:
git.linuxcnc.org/gitweb?p=linuxcnc.git;a...c6b2dc62e57f873270cf
git.linuxcnc.org/gitweb?p=linuxcnc.git;a...c6b2dc62e57f873270cf
git.linuxcnc.org/gitweb?p=linuxcnc.git;a...c6b2dc62e57f873270cf
Replied by dgarrett on topic IF clause in a HAL File
Incorrect, example (ini file excerpt):It is possible to have conditional statements in a HAL file with haltcl. But the conditions can not be based on hal pin values.
[HAL]
...
HALFILE = tst.tcl
...
$ cat tst.tcl
if [getp motion.digital-out-00] {
puts "********* yes"
} else {
puts "********* no"
}
1. A [HAL]HALFILE=filename.tcl is executed in sequence at startup
and the pins that exist will depend upon its position in the halfile
sequence. Some hal pins, notably ini.* pins, are created too late
to be visible for any [HAL]HALFILE (man milltask)
2. However, a long-lived haltcl script can be run in a separate process
and use polling methods to continuously interrogate any hal pin.
Scripts can be started from an ini file using [APPLICATIONS]APP=
Ref: linuxcnc.org/docs/2.7/html/config/ini-co...applications_section
3. Example sim configs that demonstrate spawning an independent tcl
process are:
configs/sim/axis/moveoff/*.ini
[APPLICATIONS]APP=moveoff_gui -- runs an independent gui that continuously polls hal pins
configs/sim/axis/xhc-hb04/*.ini
[APPLICATIONS}APP=monitor-xhc-hb04 -- polls hal pins periodically
[APPLICATIONS]APP=xhc-hb04-accels -- waits for ini.* pins to be created
Source ref:
git.linuxcnc.org/gitweb?p=linuxcnc.git;a...c6b2dc62e57f873270cf
git.linuxcnc.org/gitweb?p=linuxcnc.git;a...c6b2dc62e57f873270cf
git.linuxcnc.org/gitweb?p=linuxcnc.git;a...c6b2dc62e57f873270cf
Please Log in or Create an account to join the conversation.
Time to create page: 0.072 seconds