A program for testing a new machine or a new configuration.

More
11 Nov 2026 14:45 #350604 by tuxcnc
Unfortunately, my original thread was deleted during an attempt to migrate the forum to a new server.
Therefore, a brief introduction:
I purchased a Chinese rotary axis in a tilt/rotary configuration.
Mechanically, it works perfectly, but I’ve had trouble configuring the open-loop EtherCAT drives.
Replacing the motors with closed-loop ones is not an option, as none of the available models would fit.
After many attempts, I believe I have configured the drives correctly, but I cannot be certain.
That is why I needed a program that would run a large number of cycles—performing many movements—to ensure that the table returns to the correct position every time.
This is crucial; if the tilt axis were to stop in an unintended position, the machine would end up milling itself instead of the workpiece...

Naturally, this program can also be used to test a simpler machine, even one with only a single axis.
The program executes a specified number of movements and checks whether a sensor is in an active state; if it is not, the program stops.
I used a "home" sensor, but any switch placed anywhere on the machine can be used.
Minor adjustments to the `.hal` file are required, but the process is very straightforward—even a beginner should be able to handle it.
It essentially involves adding `motion.digital-in-00` to the line containing the sensor signal you wish to monitor (e.g., `joint.3.home-sw-in`), or adding a new line if you are incorporating an additional sensor.
Of course, the "home" sensor cannot also function as a limit switch. We can remove the relevant entry, or, once LinuxCNC is running, use `halcmd unlinkp <signal-name>` to temporarily disconnect the specific net.

And here is the program itself:
(connect in hal file motion.digital-in-00 to A axis home switch)
g61
o100 repeat[100]
g0
a60 b150
a30 b120
a90 b180
b90
(in a90 b90 position, motion.digital-in-00 should be TRUE)
(else stop program)
m66 p0 l3 q9999
a0
o100 endrepeat
m2

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

Time to create page: 0.288 seconds
Powered by Kunena Forum