Having trouble modifying the PLC code for a DMM spindle motor

All things related to the Centroid Acorn CNC Controller

Moderator: cnckeith

Post Reply
Setlab
Posts: 51
Joined: Tue Sep 29, 2020 10:00 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No

Having trouble modifying the PLC code for a DMM spindle motor

Post by Setlab »

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?
Gary Campbell
Posts: 2164
Joined: Sat Nov 18, 2017 2:32 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: Acorn 238
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No
Location: Marquette, MI
Contact:

Re: Having trouble modifying the PLC code for a DMM spindle motor

Post by Gary Campbell »

I had the same issue using a Leadshine servo to drive a lathe spindle. I used a simpler method that involved modifying the M5 macro by issuing an "S0" command, then "G4 P3" then toggled the SpinFWD/SpinREV output off. Worked like a dream
GCnC Control
CNC Control & Retrofits
https://www.youtube.com/user/Islaww1/videos
Setlab
Posts: 51
Joined: Tue Sep 29, 2020 10:00 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No

Re: Having trouble modifying the PLC code for a DMM spindle motor

Post by Setlab »

Good idea, I'll look into that. I'll find where those macros are kept in the system this week and let you know how it goes. I'm wondering, since I called out a timer, is there any type of display I can pull up as a sanity check that yes in fact the timer is activating? I have a gut feeling that my timer isn't working or isn't correctly tied into DoSpindleStop.

This may be a dumb question but every virtual button on the CNC12 GUI refers to a macro telling the PLC to do whatever the button label says right? Also the programing manual says SET = on and RST = off, what does RST stand for? I'm thinking rest or reset.
Post Reply