1
Mach4 General Discussion / Mach4 OB Axis Move in Real Time
« on: September 12, 2020, 06:01:09 AM »
Hy to all
I have Retrofit a old Fanuc Tape Drill with a CS Lab IP-S controller / Delta Servos and a China Spindle Motor.
The Spindle is Wired with a Step/Dir Signal and is a V Belt drive, for the correct control of the angle of the Spindle i use e external Encoder that is driven with a Timingbelt direkt to the Spindle.
I have set in Mach4 the Spindle as a OB Axis
For the Toolchange Turret i use the Spindle that have a gear for this.
I use this Script for to move the Spindle in the correct Angle:
-----------------------------------------------------------------
local hreg1 = mc.mcRegGetHandle (inst,"CSMIO-ENC/Encoder Angle 0" ) -- read the Angle from the external Encoder
local val2 = mc.mcRegGetValue (hreg1)
local grad = 0.00010934
local WZgrad = 276.8 -- angle that must be for toolchange
local Pos2 = 360-val2
local Pos4 = Pos2+WZgrad
local Pos5 = Pos4*grad*-1
rc = mc.mcJogSetAccel(inst, mc.AXIS6, 25);
rc = mc.mcJogSetRate(inst, mc.AXIS6,1.5)
rc = mc.mcJogIncStart(inst, mc.AXIS6, Pos5)
-----------------------------------------------------------------
When i move the axis with the "JogIncStart" script, the move the value the i say but in this movement can be that the V Belt from Spindle Motor to the Spindle slip, so is the end position not correct.
Now my question is it possible to move the Spindle in "Realtime" with the feedback of the External Encoder?
Attached i have the complet M6 Script for this Machine.
Best Regards for your help and replays
Silvio
I have Retrofit a old Fanuc Tape Drill with a CS Lab IP-S controller / Delta Servos and a China Spindle Motor.
The Spindle is Wired with a Step/Dir Signal and is a V Belt drive, for the correct control of the angle of the Spindle i use e external Encoder that is driven with a Timingbelt direkt to the Spindle.
I have set in Mach4 the Spindle as a OB Axis
For the Toolchange Turret i use the Spindle that have a gear for this.
I use this Script for to move the Spindle in the correct Angle:
-----------------------------------------------------------------
local hreg1 = mc.mcRegGetHandle (inst,"CSMIO-ENC/Encoder Angle 0" ) -- read the Angle from the external Encoder
local val2 = mc.mcRegGetValue (hreg1)
local grad = 0.00010934
local WZgrad = 276.8 -- angle that must be for toolchange
local Pos2 = 360-val2
local Pos4 = Pos2+WZgrad
local Pos5 = Pos4*grad*-1
rc = mc.mcJogSetAccel(inst, mc.AXIS6, 25);
rc = mc.mcJogSetRate(inst, mc.AXIS6,1.5)
rc = mc.mcJogIncStart(inst, mc.AXIS6, Pos5)
-----------------------------------------------------------------
When i move the axis with the "JogIncStart" script, the move the value the i say but in this movement can be that the V Belt from Spindle Motor to the Spindle slip, so is the end position not correct.
Now my question is it possible to move the Spindle in "Realtime" with the feedback of the External Encoder?
Attached i have the complet M6 Script for this Machine.
Best Regards for your help and replays
Silvio