how to use M66 as code
17 Sep 2012 15:08 - 17 Sep 2012 15:34 #24336
by shine
how to use M66 as code was created by shine
hello everyone,
I am a beginner in Linux and LinuxCNC.
I tried to read the manual for moving it.
Now I want to operate two analog outputs and inputs each.
when setting the stepConf about a pin, I could find only one choice for not analog but digital.
Is there other ways to set analog outputs and inputs? or Does it mean that digital and analog is same as choice?
Please let me know the way to set analog output and input.
then, I want to pause it with M0 code and if conditional in a program, when analog input0 is turned on.
Though it is wrong as structure, I described a following program as sample for explanation.
#1= M66 E0
o102 if [#1 NE 0 ] (input0 is turned on as mean)
M0
o102 else
G0 X5 Y5
o102 endif
Show me a correct code.
Regards
I am a beginner in Linux and LinuxCNC.
I tried to read the manual for moving it.
Now I want to operate two analog outputs and inputs each.
when setting the stepConf about a pin, I could find only one choice for not analog but digital.
Is there other ways to set analog outputs and inputs? or Does it mean that digital and analog is same as choice?
Please let me know the way to set analog output and input.
then, I want to pause it with M0 code and if conditional in a program, when analog input0 is turned on.
Though it is wrong as structure, I described a following program as sample for explanation.
#1= M66 E0
o102 if [#1 NE 0 ] (input0 is turned on as mean)
M0
o102 else
G0 X5 Y5
o102 endif
Show me a correct code.
Regards
Last edit: 17 Sep 2012 15:34 by shine.
Please Log in or Create an account to join the conversation.
17 Sep 2012 21:27 #24339
by andypugh
Replied by andypugh on topic Re:how to use M66 as code
Firstly, you can't do an analogue output from the parallel port. (You probably know this, but I thought it worth saying).
The M66 etc analogue/digital inputs/outputs are from G-code to HAL.
Stepconf will allow you to set a parallel port pin to be digital_out 0 to 3 if it is an output pin, or a digital input for an input pin.
It might be worth setting up a pin as a digital in or out to see what that looks like in the HAL file.
It creates a link in HAL between the pin motion.digital-out-n to the selected p-port pin.
Typically the analogue inputs and outputs from G-code never escape the software layers, being linked to user-interface elements. However there is no reason that you couldn't connect in HAL to the command value of a PWM generator, or the read value of an encoder velocity.
It might help to tell use what you want to do, rather than ask for help with your specific solution.
The M66 etc analogue/digital inputs/outputs are from G-code to HAL.
Stepconf will allow you to set a parallel port pin to be digital_out 0 to 3 if it is an output pin, or a digital input for an input pin.
It might be worth setting up a pin as a digital in or out to see what that looks like in the HAL file.
It creates a link in HAL between the pin motion.digital-out-n to the selected p-port pin.
Typically the analogue inputs and outputs from G-code never escape the software layers, being linked to user-interface elements. However there is no reason that you couldn't connect in HAL to the command value of a PWM generator, or the read value of an encoder velocity.
It might help to tell use what you want to do, rather than ask for help with your specific solution.
Please Log in or Create an account to join the conversation.
18 Sep 2012 00:51 - 18 Sep 2012 00:52 #24345
by shine
Replied by shine on topic Re:how to use M66 as code
Last edit: 18 Sep 2012 00:52 by shine.
Please Log in or Create an account to join the conversation.
18 Sep 2012 08:53 #24352
by andypugh
Replied by andypugh on topic Re:how to use M66 as code
shine wrote:
Indeed. Digital-to-analog is relatively easy using a PWM component and then a hardware filter (resistor and capacitor) to convert to a voltage.
Analogue input is rather more difficult. It is generally easier to use a voltage-to-frequency device and measure the frequency using the HAL encoder function.
Alternatively, there are non-parallel-port solutions.
andypugh
I might understand what you mean.
for using analog output and input, we must use DAC( digital to analog converter) to parallel port on the circuit.
Indeed. Digital-to-analog is relatively easy using a PWM component and then a hardware filter (resistor and capacitor) to convert to a voltage.
Analogue input is rather more difficult. It is generally easier to use a voltage-to-frequency device and measure the frequency using the HAL encoder function.
Alternatively, there are non-parallel-port solutions.
Please Log in or Create an account to join the conversation.
Time to create page: 0.375 seconds