Easy way to output analog voltage

This is where you talk about Macros, show examples of your macro scripting and SHARE handy segments of script code as examples.

Easy way to output analog voltage

Postby Mcasey » Wed Dec 08, 2021 2:47 pm

Hi guys,

I have what I hope should be fairly straightforward, I just want a way that I can output a analog voltage thru gcode. Is there a simple way to do this? It's a 300eth I'm using, just want something like MXXX 5 would be 5v output, I've been trying to do this using the spindle PWM, but just can't get it to work
Mcasey
 
Posts: 21
Joined: Sun Apr 11, 2021 6:10 pm

Re: Easy way to output analog voltage

Postby dezsoe » Wed Dec 08, 2021 7:05 pm

You can set var# -> analog out to a variable that is not 0, e.g. 1. Then in the g-code write #1=nnn where nnn is 0 to 65535 proportional to 0 to 10V.
dezsoe
 
Posts: 2093
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Re: Easy way to output analog voltage

Postby Mcasey » Wed Dec 08, 2021 9:54 pm

I don't quite understand how to use variables, I thought they were used just for calculations, the manual is a bit vague on these, this was my understanding from the manual

The following code example shows how to use the variables:
#1 = 5 (Sets the value of variable #1 to 5)
#2 = 10 (Sets the value of variable #2 to 10)
G0 X#1 Y#2 Z1 (Moves the axis with rapid to coordinates X=5, Y=10, Z=1)
#2 = 1.5 (Sets the value of variable #2 to 1.5)
G1 X#1 Y#2 Z#2 (Moves the axis with set feedrate to coordinates X=5, Y=1.5,
Z=1.5)
#3 = #1 + #2 (Sets the value of variable #3 to 6.5)
#4 = 100 (Sets the value of variable #4 to 100)
G1 X#3 F#4 (Moves the axis with set feedrate of 100 unit/min to coordinates
X=6.5)
Typing ?#4 into the MDI will return the value stored within variable #4 to the
status message box on screen.

How can I use this to say put 5v for example on the analog pin 6 or 7? Sorry I'm just a little lost with this
Mcasey
 
Posts: 21
Joined: Sun Apr 11, 2021 6:10 pm

Re: Easy way to output analog voltage

Postby Mcasey » Wed Dec 08, 2021 9:57 pm

Is it just type #1=32767, because I can't get this to work
Mcasey
 
Posts: 21
Joined: Sun Apr 11, 2021 6:10 pm

Re: Easy way to output analog voltage

Postby cncdrive » Thu Dec 09, 2021 8:53 am

Yes, you type it just like how you wrote, but to make that work you first have to attach var number 1. to an analog output channel in the configuration.
cncdrive
Site Admin
 
Posts: 5159
Joined: Tue Aug 12, 2014 11:17 pm

Re: Easy way to output analog voltage

Postby Mcasey » Thu Dec 09, 2021 1:02 pm

got it, thanks for the help guys.
Mcasey
 
Posts: 21
Joined: Sun Apr 11, 2021 6:10 pm


Return to Macros

Who is online

Users browsing this forum: No registered users and 1 guest