1/2 mpg pendant key?

All things related to Centroid Oak, Allin1DC, MPU11 and Legacy products

Moderator: cnckeith

Post Reply
610Garage
Posts: 24
Joined: Sun Mar 28, 2021 12:06 am
Acorn CNC Controller: No
Allin1DC CNC Controller: No
Oak CNC controller: Yes
CNC Control System Serial Number: none
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No

1/2 mpg pendant key?

Post by 610Garage »

I would like to add a 1/2 key to centroid, so that, when I measure off of a part, I can quickly zero to center. I want to use the aux key on my wireless mpg so that it divides the currently selected axis. I found a forum post (link below) where they used a macro to divide current work position. But this required the use of 3 aux buttons to select axis.

I'm still new at gcode and not super familiar with centroids plc api. I can clearly see where I would write a subroutine in the plc src file, but I don't see where to get and modify current work position. And I don't see a way to get mpg axis switch position within gcode. Not sure if I am missing something there or not.

I would assume the best option would be to have the plc write to a global system variable that the g parser can read. But I have no idea if that is even possible, much less how to go about implementing it. Any thoughts?

Thanks in advance.

viewtopic.php?f=64&t=575&p=2653&hilit=edgefinder#p2653
cncsnw
Posts: 3763
Joined: Wed Mar 24, 2010 5:48 pm

Re: 1/2 mpg pendant key?

Post by cncsnw »

The PLC is not involved in a task like this at all, except to report to CNC12 that a key has been pressed (for Aux key functions via Parameters 188-199) or to trigger execution of the G code macros (e.g. c:\cncm\system\plcmacro1.mac etc.).

It is the G codes in the CNC macro file that perform the task.

You will have to look in your particular PLC program to see what word variable it uses to store the position of the axis select switch, so you can access that value (via a 96000-series CNC system variable) in the CNC macro.

The CNC system variables #5041 through #5044 hold the current axis positions in the local WCS.

So, for example:

Code: Select all

G90 G0 X[#5041/2]
would move the X axis to 1/2 of its current position.

Supposing that you want to keep it simple and readable; and that you only need to support axes X, Y and Z in their usual locations (1st, 2nd and 3rd); and that your PLC program uses variable W71 for the wireless MPG axis select switch, then the whole macro might be as simple as:

Code: Select all

IF [#96071==1] THEN G90 G0 X[#5041/2]
IF [#96071==2] THEN G90 G0 Y[#5042/2]
IF [#96071==3] THEN G90 G0 Z[#5043/2]
610Garage
Posts: 24
Joined: Sun Mar 28, 2021 12:06 am
Acorn CNC Controller: No
Allin1DC CNC Controller: No
Oak CNC controller: Yes
CNC Control System Serial Number: none
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No

Re: 1/2 mpg pendant key?

Post by 610Garage »

Perfect! Not only does that solve my issue, understanding how to communicate between the plc and gcode will undoubtedly be invaluable. Thanks!
Post Reply