Having trouble modifying the PLC code for a DMM spindle motor
Posted: Sat Jan 28, 2023 4:59 pm
I installed a DMM servo motor (DYN4 driver) to run a spindle on a small benchtop mill and am having some spindle fault issues. I followed the thread from a couple years ago now https://centroidcncforum.com/viewtopic. ... 068#p42068 and added in the code cncsnw was awesome enough to post as well as a timer in the correct location and am still getting spindle drive faults when I hit the spindle stop button at high rpms (at low rpms hitting the spindle stop acts as it should so far). As some back story, it was found out that the DYN4 driver doesn't like it when a stop command is given at a high speed and the solution was to add a timer to I think more slowly decrease speed of the motor to a stop.
Below is the code I copied into the StandardSpindleStage area (I've experimented with different timer durations with the same result, my last attempt was to set it at 10 seconds. CNC12 doesn't seem to be recognizing the added timer):
IF (SpindleEnableOut_M || SpinStart_M ) && !SpinStop_M
THEN SET SpindleEnableOut_M
IF !((SpindleEnableOut_M || SpinStart_M ) && !SpinStop_M) THEN RST SpindleEnableOut_M
IF SpindleEnableOut_M THEN SET VFDEnable_O, RST VFDDisableTimer
IF SpindleEnableOut_M && !SpindleDirectionOut_M && SpindleBrakeTimer THEN SET SpinFWD
IF SpindleEnableOut_M && SpindleDirectionOut_M && SpindleBrakeTimer THEN SET SpinREV, SET VFDDirection_O
IF !SpindleEnableOut_M THEN (DoSpindleStop), VFDDisableTimer = 10000, SET VFDDisableTimer
IF VFDDisableTimer THEN RST VFDEnable_O, RST SpinFWD, RST SpinREV, RST VFDDirection_O
Below is the timer I copied into the Timer Definitions area:
VFDDisableTimer IS T34
After I do all that I compile it into the mpu.plc code in the command prompt window using the code:
C:\cncm>mpucomp acorn_mill_plc_DMM_code_change.src mpu.plc
Has anyone ran into this situation before or have any suggestions of how to command CNC12 to use the timer in the above code?
Below is the code I copied into the StandardSpindleStage area (I've experimented with different timer durations with the same result, my last attempt was to set it at 10 seconds. CNC12 doesn't seem to be recognizing the added timer):
IF (SpindleEnableOut_M || SpinStart_M ) && !SpinStop_M
THEN SET SpindleEnableOut_M
IF !((SpindleEnableOut_M || SpinStart_M ) && !SpinStop_M) THEN RST SpindleEnableOut_M
IF SpindleEnableOut_M THEN SET VFDEnable_O, RST VFDDisableTimer
IF SpindleEnableOut_M && !SpindleDirectionOut_M && SpindleBrakeTimer THEN SET SpinFWD
IF SpindleEnableOut_M && SpindleDirectionOut_M && SpindleBrakeTimer THEN SET SpinREV, SET VFDDirection_O
IF !SpindleEnableOut_M THEN (DoSpindleStop), VFDDisableTimer = 10000, SET VFDDisableTimer
IF VFDDisableTimer THEN RST VFDEnable_O, RST SpinFWD, RST SpinREV, RST VFDDirection_O
Below is the timer I copied into the Timer Definitions area:
VFDDisableTimer IS T34
After I do all that I compile it into the mpu.plc code in the command prompt window using the code:
C:\cncm>mpucomp acorn_mill_plc_DMM_code_change.src mpu.plc
Has anyone ran into this situation before or have any suggestions of how to command CNC12 to use the timer in the above code?