Changing output format Step/Dir to Integer value
27 May 2013 01:56 #34732
by leix_99
Changing output format Step/Dir to Integer value was created by leix_99
Hi everyone, as this is my first post, i'll introduce myself briefly.
My name is Aleix, i'm from Barcelona and an estrange thought came to my mind recently... Is it possible to modify the output format of an axis in LinuxCNC through a mathematic op before the signal is forwarded to the parallell port?
let's say (without knowing the real deal) that just before the signal exits my computer i've got this:
A commanded move of 100mm in X axis.
I know that:
100 pulses = 1mm
Step output == active HIGH (pin 2)
Dir output == active HIGH (for cw rotation) (pin3)
so, theoretically 10.000 pulses would boost out my PP through pin2 while pin3 outputs 1 (+5v).
Right before this, is it possible to do something like this:
1.- initialise a counter variable, this will track all the steps.) -> counter = 0
2.- if we advance 1mm (100pulses) Clockwise (Dir pin == HIGH) , then counter adds 100 -> counter = 100
3.- if we back 0,5mm (50pulses) CCW (DIR pin == LOW) , then counter subtracts 50 -> counter = 50
That's the best way to express my doubt, i know it's not really clear but i hope it does the job. Thanks for your time and help!
My name is Aleix, i'm from Barcelona and an estrange thought came to my mind recently... Is it possible to modify the output format of an axis in LinuxCNC through a mathematic op before the signal is forwarded to the parallell port?
let's say (without knowing the real deal) that just before the signal exits my computer i've got this:
A commanded move of 100mm in X axis.
I know that:
100 pulses = 1mm
Step output == active HIGH (pin 2)
Dir output == active HIGH (for cw rotation) (pin3)
so, theoretically 10.000 pulses would boost out my PP through pin2 while pin3 outputs 1 (+5v).
Right before this, is it possible to do something like this:
1.- initialise a counter variable, this will track all the steps.) -> counter = 0
2.- if we advance 1mm (100pulses) Clockwise (Dir pin == HIGH) , then counter adds 100 -> counter = 100
3.- if we back 0,5mm (50pulses) CCW (DIR pin == LOW) , then counter subtracts 50 -> counter = 50
That's the best way to express my doubt, i know it's not really clear but i hope it does the job. Thanks for your time and help!
Please Log in or Create an account to join the conversation.
27 May 2013 04:48 #34736
by andypugh
You probably don't even need any maths.
Open a halmeter (machine->halmeter if using the Axis interface) and set it to look at the pin axis.0.motor-pos-cmd then make an X move.
I think what you are looking for is closer to the motion.distance-to-go pin, though. But that shows the net distance.
Can you explain what you want to do with the information, we may be able to suggest a way that works.
Replied by andypugh on topic Changing output format Step/Dir to Integer value
Is it possible to modify the output format of an axis in LinuxCNC through a mathematic op before the signal is forwarded to the parallell port?
You probably don't even need any maths.
Open a halmeter (machine->halmeter if using the Axis interface) and set it to look at the pin axis.0.motor-pos-cmd then make an X move.
I think what you are looking for is closer to the motion.distance-to-go pin, though. But that shows the net distance.
Can you explain what you want to do with the information, we may be able to suggest a way that works.
Please Log in or Create an account to join the conversation.
27 May 2013 21:51 #34755
by leix_99
Replied by leix_99 on topic Changing output format Step/Dir to Integer value
A friend asked if it was possible to drive an analog servo drive that found "abandoned" on his dad's shop, i've only used Mach3, and at first i said no (i don't think you can "modify" the mach's internal ops) but then i started thinking that maybe this was possible to do on linuxCNC.
Anyway, i thought if the machine can generate that step recount, i can set some sort of spi bus to an external DAC, and then map the signal to a specific step count. I've seen some external motion controllers out there, but i just want to know whether this is possible or not
Anyway, i thought if the machine can generate that step recount, i can set some sort of spi bus to an external DAC, and then map the signal to a specific step count. I've seen some external motion controllers out there, but i just want to know whether this is possible or not
Please Log in or Create an account to join the conversation.
27 May 2013 22:05 #34757
by andypugh
There are almost too many options.
Do you want to do it for free? Or are you interested in doing it in a high-performance, reliable way?
Does the servo drive have a reference +10, -10V and 0V line? if it does then you could use a pair of totem-pole opto-isolators each separately controlled by a parallel port pin, and driven by the HAL pwmgen component un up/down mode (Type 2) www.linuxcnc.org/docs/html/man/man9/pwmgen.9.html
This won't have a huge bandwidth, but is probably OK if you do not need extremely good dynamic performance.
Or, you could spend $200 on a 6-axis servo controller PCI card like the Mesa 5i25/7i77 combination. That will just work, but has a whole lot of other capabilities that it sounds like you don't need.
Just stop thinking in terms of step/direction and look at PWM output and PID control in LinuxCNC.
Replied by andypugh on topic Changing output format Step/Dir to Integer value
A friend asked if it was possible to drive an analog servo drive that found "abandoned" on his dad's shop,
...
Anyway, i thought if the machine can generate that step recount, i can set some sort of spi bus to an external DAC, and then map the signal to a specific step count.
There are almost too many options.
Do you want to do it for free? Or are you interested in doing it in a high-performance, reliable way?
Does the servo drive have a reference +10, -10V and 0V line? if it does then you could use a pair of totem-pole opto-isolators each separately controlled by a parallel port pin, and driven by the HAL pwmgen component un up/down mode (Type 2) www.linuxcnc.org/docs/html/man/man9/pwmgen.9.html
This won't have a huge bandwidth, but is probably OK if you do not need extremely good dynamic performance.
Or, you could spend $200 on a 6-axis servo controller PCI card like the Mesa 5i25/7i77 combination. That will just work, but has a whole lot of other capabilities that it sounds like you don't need.
Just stop thinking in terms of step/direction and look at PWM output and PID control in LinuxCNC.
Please Log in or Create an account to join the conversation.
27 May 2013 22:09 #34758
by cncbasher
Replied by cncbasher on topic Changing output format Step/Dir to Integer value
i'd think by the time you're done , it would be simpler to obtain a mesa 5i25 and 7i77 daughter card , but don't let that put you off , if it's only one servo motor , take a pwm pin and convert that to 10v analog
all depends on what you want to do with it
all depends on what you want to do with it
Please Log in or Create an account to join the conversation.
27 May 2013 23:27 - 27 May 2013 23:29 #34765
by leix_99
Replied by leix_99 on topic Changing output format Step/Dir to Integer value
Andypugh:
Interesting, vref goes from -12 to +12, but yes, i think i can try that way
I do not really need it for anything, just to spend an afternoon playing and learning some linuxCNC
Thanks for the advise, i'll give it a try on summertime, now i feel way more relaxed (mentally speaking)
Cncbasher:
Sure it'd be faster and way more easy, but i just want to have some fun and see if it works or not !
Interesting, vref goes from -12 to +12, but yes, i think i can try that way
I do not really need it for anything, just to spend an afternoon playing and learning some linuxCNC
Thanks for the advise, i'll give it a try on summertime, now i feel way more relaxed (mentally speaking)
Cncbasher:
Sure it'd be faster and way more easy, but i just want to have some fun and see if it works or not !
Last edit: 27 May 2013 23:29 by leix_99.
Please Log in or Create an account to join the conversation.
Time to create page: 0.487 seconds