Can an unused axis be used as a -10 to 10 volt output?

All things related to Centroid Oak, Allin1DC, MPU11 and Legacy products

Moderator: cnckeith

Post Reply
bakeng
Posts: 66
Joined: Wed Nov 16, 2011 5:50 pm
Allin1DC CNC Controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC11: Yes
CPU10 or CPU7: Yes

Can an unused axis be used as a -10 to 10 volt output?

Post by bakeng »

Can an unused axis be used as a -10 to 10v output?
I would like to control an external device that takes a -10 to 10 v signal. I would like to be able to write values to an un used axis's dac line from the Plc program.
cncsnw
Posts: 3763
Joined: Wed Mar 24, 2010 5:48 pm

Re: Can an unused axis be used as a -10 to 10 volt output?

Post by cncsnw »

Yes, you can do that.

Calculate the desired 16-bit output in a word variable: 0 = -10V, 32768 = 0V, 65535 = +10V.
Then write it to the desired analog output addresses with the WTB command.
You have to set the axis enable as well.
This will only work if the axis is not in use by the motion control (i.e. if the label is 'N').

For example, the following would write the value from Machine Parameter 175 to the GPIO4D fourth axis output any time the Aux3 LED is turned on using the Aux3 key:

Code: Select all

Axis_4_Enable IS OUT20      ; fourth axis enable on GPIO4D
;...
Axis4AnalogOut IS OUT289  ; fourth axis DAC on GPIO4D
;...
IF Aux3Key THEN (Aux3PD)
IF (Aux3PD ^ Aux3LED) && !SV_STOP THEN (Aux3LED)
;...
IF Aux3LED THEN AnalogOut_W = SV_MACHINE_PARAMETER_175,  ; get number from parameter table
                WTB AnalogOut_W Axis4AnalogOut 16,
                (Axis_4_Enable)
This method can also be used for spindle speed control, if your spindle drive requires a bipolar analog signal or you need more resolution than the standard 12-bit output.
bakeng
Posts: 66
Joined: Wed Nov 16, 2011 5:50 pm
Allin1DC CNC Controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC11: Yes
CPU10 or CPU7: Yes

Re: Can an unused axis be used as a -10 to 10 volt output?

Post by bakeng »

Great. Now the last piece of my puzzle, How do I pass a variable from a g-code program to the Plc?
I need to setup a variable speed in my g- code and let the Plc read it and convert it to the -10v to 10v output.
cncsnw
Posts: 3763
Joined: Wed Mar 24, 2010 5:48 pm

Re: Can an unused axis be used as a -10 to 10 volt output?

Post by cncsnw »

Use G10 to set the 170-series parameters.

You need to stop read-ahead in the G code processing prior to the G10; otherwise the parameter value gets changed before CNC program execution actually gets to that line.

You can prevent read-ahead by writing, for example, "IF #50001". That expression cannot be evaluated in advance because it tests the state of PLC INP1. Therefore the CNC processor stops reading ahead and waits for execution to catch up before proceeding.
bakeng
Posts: 66
Joined: Wed Nov 16, 2011 5:50 pm
Allin1DC CNC Controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC11: Yes
CPU10 or CPU7: Yes

Re: Can an unused axis be used as a -10 to 10 volt output?

Post by bakeng »

Finally got around to trying this. I did have to set the drive assignment to 0 in the parameters.
I can see bits 289-304 changing as I change parameter 175, but there is no voltage coming out of the axis terminal.
I also noticed when I enable the axis through the PLC the enable light is very dim.
bakeng
Posts: 66
Joined: Wed Nov 16, 2011 5:50 pm
Allin1DC CNC Controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC11: Yes
CPU10 or CPU7: Yes

Re: Can an unused axis be used as a -10 to 10 volt output?

Post by bakeng »

I got it to work.
You must have the axis your using NOT assigned to a drive in the parameters.
Also be sure Axis_x_Enable is not being written to elsewhere in the PLC program.
Post Reply