Hello Guest it is October 31, 2024, 08:20:25 PM

Author Topic: What is the diference between $5021 and #5041  (Read 2481 times)

0 Members and 1 Guest are viewing this topic.

What is the diference between $5021 and #5041
« on: February 10, 2023, 04:32:23 PM »
Hello out there! My friend Mark and I have finally gotten the build (mostly) complete for our custom machine. It is a rebuild of the scratch built Ornamental Lathe we made in 1992. The original machine ran on a stepper motor control board and custom software. I am an electrical engineer (retired) - but a hardware guy, not software. For the rebuild we decided on MACH4 and Practical Micro Design PMDX-424. The machine (for lots of reasons) is configured as a MILL, but without a Y axis.

I am relatively new to CNC programming for our machine. I wrote a short program to make a "basket weave" pattern. I want to have the program run in incremental mode so it can be reused along the spindle. It is also required to return to the starting point after completing the cut. I tried to use #5021 and #5024 stored in a #var to return. In the attached it is 36, 37, 44, 45, 46. It works in simulation, but not on the machine. Each time the program runs the X axis offsets further in the +X direction (X= 0.72, 0.144, etc). Any input would be appreciated.

Offline Graham Waterworth

*
  • *
  •  2,731 2,731
  • Yorkshire Dales, England
Re: What is the diference between $5021 and #5041
« Reply #1 on: February 10, 2023, 04:39:25 PM »
I would use the G52 command.
Without engineers the world stops
Re: What is the diference between $5021 and #5041
« Reply #2 on: February 10, 2023, 07:09:20 PM »
Thanks Graham,
The issue is that I need to return to whatever the previous position was, not to the origin. I'm not sure I am correctly saving the original position. If I understand G52 correctly it still needs to know where to go?

Offline Graham Waterworth

*
  • *
  •  2,731 2,731
  • Yorkshire Dales, England
Re: What is the diference between $5021 and #5041
« Reply #3 on: February 11, 2023, 06:37:18 PM »
You may need to add the G53 commands as the coordinates you are reading are Machine figures.

( MOVE BACK TO THE STORED STARTING POSITIONS SO ANOTHER PASS WILL BE ALIGNED )
G90 (ABSOLUTE MODE)
G53 G00 X#254 (MOVE X BACK TO THE STARTING POINT)
G53 G00 A#253 (MOVE A BACK TO THE STARTING POINT)
G91 (BACK TO INCREMENTAL)
M30   (STOP THE PROGRAM)

« Last Edit: February 11, 2023, 07:34:35 PM by Graham Waterworth »
Without engineers the world stops
Re: What is the diference between $5021 and #5041
« Reply #4 on: February 12, 2023, 04:46:18 PM »
Thanks again Graham. We will give it a try and update this question for future generations. ;-)

If I read the positions from #5041 rather than #5021 would I read the work rather than machine coordinates?

Offline Graham Waterworth

*
  • *
  •  2,731 2,731
  • Yorkshire Dales, England
Re: What is the diference between $5021 and #5041
« Reply #5 on: February 12, 2023, 05:58:17 PM »
#5041 would give you the position relative to the current active fixture e.g. G54
Without engineers the world stops