Page 1 of 1

+\- 10vDc PLC spindle code for ALLINONEDC

Posted: Sat Apr 13, 2024 3:15 pm
by rjtechserv
Does anyone have the PLC code for the ALLINONEDC to do spindle control +10vdc forward and (-)10vdc reverse?

Re: +\- 10vDc PLC spindle code for ALLINONEDC

Posted: Fri Apr 19, 2024 12:18 pm
by rjtechserv
This seemed to work.

Re: +\- 10vDc PLC spindle code for ALLINONEDC

Posted: Fri Apr 19, 2024 5:19 pm
by cncsnw
Assuming you only want to use it for speed control, then that should work (output a value from 2048 to 4095 for 0V to +10V).

My standard code is like this (having previously set "SpindleAnalogBipolar_M" per a parameter selection).

Code: Select all

;Convert RPM to 12 bit value
IF True THEN TwelveBitSpeed_FW = SpinSpeedCommand_FW/RPMPerBit_FW

; Factor in gear range
IF True THEN TwelveBitSpeed_FW = (TwelveBitSpeed_FW/SpinRangeAdjust_FW)

;Convert to integer word for DAC & I/O display
IF True THEN TwelveBitSpeed_W = TwelveBitSpeed_FW
IF SpindleAnalogBipolar_M && !SpindleDirectionOut
  THEN TwelveBitSpeed_W = 2048 + (TwelveBitSpeed_W / 2)
IF SpindleAnalogBipolar_M && SpindleDirectionOut
  THEN TwelveBitSpeed_W = 2048 - (TwelveBitSpeed_W / 2)

; Bound min to 0, max to 4095
IF TwelveBitSpeed_W < 0 THEN TwelveBitSpeed_W = 0
IF TwelveBitSpeed_W > 4095 THEN TwelveBitSpeed_W = 4095

; Output to DAC
IF True THEN WTB TwelveBitSpeed_W SpinAnalogOutBit0 12

Re: +\- 10vDc PLC spindle code for ALLINONEDC

Posted: Sat Apr 20, 2024 8:38 am
by rjtechserv
We hope to rigid tap as well. So the code change I've made wouldn't be suitable for that?

I'll try your code and find the parameter you mentioned. I think I saw it from another ATC post on your website.

Thanks as always Mark

RobJ

Re: +\- 10vDc PLC spindle code for ALLINONEDC

Posted: Sat Apr 20, 2024 2:36 pm
by cncsnw
Rigid tapping is not a factor one way or the other.

To do tapping, you need to be able to make the spindle rotate forward and rotate reverse, at more or less the requested speed. It does not matter whether reverse rotation is accomplished with a bipolar analog signal, or with an alternate "run" input to the drive.

I think the only functional issue with your code, is that it would not work correctly with a reversed spindle range (e.g. back gear on a knee mill), because the jog panel LEDs would not accurately indicate motor direction.

The sample bipolar code above references SpindleEnableOut, to choose whether to output a negative voltage. Typically I would assign that to a memory bit on any machine that uses bipolar analog for direction control, since OUT8 is no longer needed or used; but if you do not need all of the outputs, you could leave it on OUT8. Just be sure to wire your spindle run command directly from OUT7, or from OUT7 through the E-stop contactor; and not through OUT8.

Re: +\- 10vDc PLC spindle code for ALLINONEDC

Posted: Sat Apr 20, 2024 2:37 pm
by cncsnw
My complete Allin1DC basic mill PLC program is attached, for reference. I use Parameter 178 bit 2 (+4) to select bipolar analog.