Unwind C axis in less than 360

Moderator: cnckeith

Post Reply
RMILLER
Posts: 13
Joined: Sun Jun 25, 2023 9:09 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: 0117
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No

Unwind C axis in less than 360

Post by RMILLER »

I'm looking to have my C axis unwind the shortest distance possible. I have cnc12 mill/router with acorn6 I have a B/C head configuration with unlimited C axis rotation (no wires to tangle) I have found this in the centroid lathe manual but I cant find it in the Mill manual and it seems I do not have a M151 or M51 available.

"11.49 M151 - Unwind C axis
This M function will reset the C axis position to less than one revolution of the C axis (< 360 degrees).
Example: (M51)"


This is what id really want... like my Haas machine dose with my 4th axis rotary however it seems this isn't available as a simple parameter change in cnc12 I hope I'm missing something though.

https://www.haascnc.com/video/tipofthed ... lbaie.html


simply put how can I add this feature
cncsnw
Posts: 3854
Joined: Wed Mar 24, 2010 5:48 pm

Re: Unwind C axis in less than 360

Post by cncsnw »

Here is the content of an M27 macro that I use for that purpose.

Code: Select all

; M27 - Unwind the Rotary Axis Position
IF [#4201 || #4202] THEN GOTO 900  ; skip procedure in graph and search
  #1 = #4001               ; save movement mode (G0/G1)
  #2 = #4003               ; save positioninng mode (G90/G91)

  #10 = #5024 / 360.0      ; A axis Machine position, converted to revolutions
  ; round to nearest whole number (whole revolution)
  IF [#10 < 0] THEN #10 = #10 - 0.5
  IF [#10 > 0] THEN #10 = #10 + 0.5
  #10 = #10 OR 0           ; "OR 0" truncates to integer, rounding towards zero
  #10 = #10 * 360.0        ; convert back to degrees

  G0 G90 G53 A#10          ; move A axis to the calculated whole-turn position
  G4 P0.5                  ; pause for axis to settle
  IF #50001                ; wait for execution to catch up
  M26/A                    ; reset axis home position here

  G#1 G#2
N900
This one is for a fourth axis that is named 'A'. If the rotary you want to unwind is labeled something different, change the 'A' label on the G53 and M26 lines (and also in the comments) to your axis label. If the rotary you want to unwind is not axis #4, then change "#5024" in the first "#10" assignment to the appropriate variable (e.g. "#5025" for axis #5, or "#5023" for axis #3).

You can, of course, put this code in any M function number you choose. Just name the macro file appropriately, and change the comment on the first line to match.

If you do not need to support software older than CNC12 v4.14 (the first version in which the "FIX" and "FUP" functions appear), then you can use FIX and simplify the round-nearest logic. E.g.

Code: Select all

#10 = FIX(#10+0.5)
RMILLER
Posts: 13
Joined: Sun Jun 25, 2023 9:09 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: 0117
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No

Re: Unwind C axis in less than 360

Post by RMILLER »

That’s what I was looking for. Thanks.
Post Reply