Page 1 of 1

Configuring Acorn for 0-5V spindle control

Posted: Fri Dec 11, 2020 2:01 pm
by GranDan
I have drilled down in multiple posts to get clarity on configuring Acorn for 0-5V spindle control. It appears there are four possible solutions:
1) Throw away your 0-5V spindle drive and get a drive and motor that works on 0-10V (allow me a little humor here) = unacceptable
2) Install a KBSI-240D. Cost: $60 - $100 depending on source, shipping etc. = marginally acceptable if you don't mind spending the $$
3) Make a simple voltage divider circuit with a couple of resistors. = cheap, simple, easy, acceptable, but not an elegant solution IMHO.
4) Someone has alluded to the possibility of editing the PLC code by changing the DAC values. = elegant, no cost (except time and possible fear of mistakes).
So, is it possible to edit the PLC code to cause Acorn to output 0-5V, or not? If so, what values? Even better, a screen shot of the edited code - unless it is classified beyond my security clearance. ;)
Thanks guys,
Love y'all

Re: Configuring Acorn for 0-5V spindle control

Posted: Fri Dec 11, 2020 3:08 pm
by Nigelo
Suggest you wait for CNC12 v4.60 which supports both 0-5v and PWM that is about to be released once the public beta has finished

Enhancement list on the following link
viewtopic.php?f=60&t=5094

Re: Configuring Acorn for 0-5V spindle control

Posted: Fri Dec 11, 2020 3:11 pm
by cncsnw
There are several ways it could be done. Among the simplest would be to let all of the existing code that calculates the output do its job, then divide by two at the point of converting it to the integer "12BitSpeed_W", limiting it to a valid range, and writing to the analog output.

Locate in your PLC program the code which reads:

Code: Select all

;Convert to integer word for DAC & I/O display
IF True THEN TwelveBitSpeed_W = TwelveBitSpeed_FW

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

If !SpinAutoModeLED && G540SpindleStage && SpindleDisable_M THEN TwelveBitSpeed_W = 0
If !SpinAutoModeLED && !G540SpindleStage && !SpindleEnableOut_M THEN TwelveBitSpeed_W = 0

; Output to DAC
IF True THEN WTB TwelveBitSpeed_W SpinAnalogOutBit0 12
Change two lines (four counting comments) so it reads:

Code: Select all

;Convert to integer word for DAC & I/O display
; Also divide by two, to get 0-5V output instead of 0-10V output
IF True THEN TwelveBitSpeed_W = TwelveBitSpeed_FW / 2.0

; Bound min to 0, max to 2047.  2047 is maximum for 5VDC.
IF TwelveBitSpeed_W < 0 THEN TwelveBitSpeed_W = 0
IF TwelveBitSpeed_W > 2047 THEN TwelveBitSpeed_W = 2047

If !SpinAutoModeLED && G540SpindleStage && SpindleDisable_M THEN TwelveBitSpeed_W = 0
If !SpinAutoModeLED && !G540SpindleStage && !SpindleEnableOut_M THEN TwelveBitSpeed_W = 0

; Output to DAC
IF True THEN WTB TwelveBitSpeed_W SpinAnalogOutBit0 12

Re: Configuring Acorn for 0-5V spindle control

Posted: Fri Dec 11, 2020 6:31 pm
by GranDan
Thanks guys. PLC mod works perfectly

Re: Configuring Acorn for 0-5V spindle control

Posted: Wed Jan 13, 2021 6:07 pm
by jmezomatrix
I need to do this very procedure for 5v control. What is the file name that the changes need to be made in?
Thanks,
John

Re: Configuring Acorn for 0-5V spindle control

Posted: Thu Jan 14, 2021 2:18 pm
by cnckeith
try out the public beta, 0-5 analog out is a selection in the Acorn Wizard.
0-5.PNG