hy rcs
i am using a small code to get the shortest path for the C axis on lathes; i use this inside the program :
and i keep this soubroutine inside a *.ssb file :Code:// some linear movement CALL OCAXS LV01 = desired_C_value // C axis movement
... it checks that -360 < target_value < +360Code:OCAXS ( C_target ) IF [ ABS [ LV01 ] LT 360 ] NJUMP1 NLOOOP M0 ( cool man ) GOTO NLOOOP NJUMP1 NOEX IF [ LV01 GE 0 ] NJUMP2 NOEX LV01 = 360 + LV01 NJUMP2 NOEX LV01 = LV01 - VSIOC IF [ [ [ [ [ LV01 GE 0 ] AND [ LV01 LE +180 ] ] EQ 1 ] OR [ LV01 LT -180 ] ] EQ 1 ] NTRUE ( NFALSE ) M16 GOTO NDONE NTRUE M15 NDONE NOEX RTS ( . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ) ( dif > +180 : M16 ) ( 0 <= dif <= +180 : M15 ) ( 0 > dif >= -180 : M16 ) ( dif < -180 : M15 )
... converts negative value to positive ( eq -30 to +330 )
... it chooses a sense
to make it work on your cnc, you need the "equivalent system variable" for "VSIOC"
... i don't know, try VWKA* , VWKB*, * = A or B or C ?
kindly