Connecting User Defined Commands to Classic Ladder Inputs

More
20 Apr 2020 20:55 #164889 by AndrewL
I have a M code, M101 which I have used to directly change an output pin. When I edit M101 to try to control classicladder inputs, I cannot. If I execute the M101 code, nothing happens and no errors are thrown. Two methods I've tried are shown below.

my M101 looks like this:
#!/bin/bash
halcmd setp TestVar01 True
halcmd setp classicladder.0.in-06 TRUE
exit 0

I have these lines in my .hal file
net TestVar01 => classicladder.0.in-05
net TestVar02 => classicladder.0.in-06

the following HAL commands were executed for further diagnostic information;

Test HAL command: setp TestVar01 True
error: parameter or pin 'TestVar01' not found

Test HAL command:setp classicladder.0.in-06 TRUE
error: pin 'classicladder.0.in-06' is connected to a signal

Test HAL command: setp classicladder.0.in-07 TRUE
success

What am I doing wrong?

Please Log in or Create an account to join the conversation.

More
20 Apr 2020 22:33 #164895 by cmorley
I would add an echo command and run linuxcnc from the terminal to see it it's getting run.

You can also check permissions on the file - it must be executable.

Please Log in or Create an account to join the conversation.

More
21 Apr 2020 13:01 #164957 by AndrewL
I found a solution. If I eliminate all references to classicladder.0.in-06 in my hal file and let the M code change the unnamed bit it will work.

my M101 looks like this:
#!/bin/bash
halcmd setp classicladder.0.in-06 TRUE
exit 0

Please Log in or Create an account to join the conversation.

More
21 Apr 2020 17:21 #164982 by cmorley
Yes if you want to manipulate the pin directly, you can't have a signal connected.
Same idea with a signal, if you want to manipulate it directly you can't have a driving pin connected.

Chris
The following user(s) said Thank You: AndrewL

Please Log in or Create an account to join the conversation.

Time to create page: 0.133 seconds
Powered by Kunena Forum