07-20-2016 07:36 PM
I'm attempting to use 6 optical encoders to track the position of 6 different stepper motors. I understand that I can use port 2.7 as a counter, but won't that only be able to count one input? how would I wire the NI board to have 6 different counters? Or should I be going about this in a different way?
Thanks.
07-20-2016 10:07 PM
07-21-2016 09:55 AM - edited 07-21-2016 10:04 AM
But is there a way to use the other ports instead of just the counting port? Can you explain a little why the 2.7 port is different from the others in terms of getting the digital signal? The motors are moving about 1.5mm/s and there are 4000 pulses per revolution on the optical encoder. The motors also make bilateral movements so I need to detect 2 signals from each encoder.
07-21-2016 10:14 AM
07-21-2016 03:39 PM
And what are maximum pulses per second you can get?
Counters are dedicated hardware elements to count pulses (or generate them), very high resolution (~10 ns), very reliable - they do not skip pulses of sufficient amplitude.
If you are using software timed digital lines, your resolution is determined by software that can pause for a ms before getting data.
I would say 1 pulse per 5 ms down to 0.5 ms is doable, but requires care and work. Dedicated loop, track changes. The faster, the less reliable - you can start skipping pulses.
If you have smaller rate of encoder pulses, it is much easier and you do not require counter.
07-21-2016 03:48 PM
One more thing - how wide are the pulses? Is it 50% duty cycle, or are they 1 us pulses? If pulse is shorter than 0.5 ms, do not even think about software timing - you will definitely skip pulses. Digital board with hardware timing will help untill certain pulse width - it is easier to get multichannel board than 8 channel counter board.
Another options - FPGA, 3-d party motion controller that gives you position over some interface - com, usb, etc.
07-21-2016 04:42 PM
We are looking at about 1 pulse per 10 ms; any hints to start coding for that small of a resolution? it's 50% duty cycle.
07-22-2016 03:52 PM
Help-> Find examples, Hardware I/O -> DAQmx -> Digital measurements -> Read Dig Chan.vi
Set delay to 1 ms and compare with previous iteration to detect edge on each channel (XOR for example). Edge type and value on the second channel will determine direction - increase or decrease counter.
08-04-2016 02:52 PM
I cannot run these as you need hardware timing for them. How do I create a software timed program that will detect the direction changes in the encoder? currently this program only gets about a forth of the counts as it should and im not sure how to go about detecting the A/B channel peaks in order to get positive and negative directions.
08-05-2016 09:01 AM
examples\DAQmx\Digital\Read Values.llb\Read Dig Chan.vi is software timed.
Remove second read, your single read should iterate as fast as possible.