02-27-2024 12:22 AM
I am using PCI 6289 card. where 2 counter ctr0 and ctr1 are already being used for stepper motor driver. Now we want to read the position of the stepper motor using installed rotatory encoder at the same time or in real time. Can we use digital input channels available or any method other then counter input, to read the position of the encoder/stepper motor.
NI PCI 6289
LabVIEW 2014
Solved! Go to Solution.
02-27-2024 02:40 PM
Short answer: no, not really. A counter that supports quadrature (such as the 2 you have in a 6289) is really the only practical way to capture position from an incremental encoder. There are things you could try if truly desperate, but there's probably a better workaround.
Workaround: can you perhaps create a dummy AI or AO task and use its sample clock in place of the counter pulse train I assume you're generating with at least one of your counters? There are ways to configure an analog task so that the sample clock gets exported out to a physical terminal you could wire to your stepper driver. Bonus: with an AO task, you are also likely to be able to change the sample rate (i.e., step rate) on the fly, if that's something you need.
-Kevin P
02-27-2024 11:49 PM
Workaround: can you perhaps create a dummy AI or AO task and use its sample clock in place of the counter pulse train I assume you're generating with at least one of your counters? There are ways to configure an analog task so that the sample clock gets exported out to a physical terminal you could wire to your stepper driver. Bonus: with an AO task, you are also likely to be able to change the sample rate (i.e., step rate) on the fly, if that's something you need.
counter number 1 output is being used for clockwise rotation and
counter number 2 output is being used for anti-clockwise rotation of stepper driver
but this this card 6289 has only two counters , so for reading the encoder position i want to workout on digital in channels
port A -> encoder A
port B- > encoder B
then applying encoder logic of position and direction using edge / pulse counting
for ex.
if A =! prev A, means rotation happened
like this
02-28-2024 07:03 AM
...but your device can't generate its own internal sample clock for DIO. It only supports "correlated DIO" where the task needs to be given a sample clock from another source. Often that'd be a counter pulse train output but you wouldn't have any available. So for you it'd need to be a (drum roll, wait for it) dummy AI or AO task.
<time passes> I just remembered another issue you might be facing. If you're generating a specific # of pulses when you do your motions, you'll be programming finite pulse trains with your counters. And on your device, one finite pulse train will consume both your counters because they work together -- one generates the pulses while the other works behind the scenes to "gate" them with precise timing, hence a correct # of pulses.
If both AO and AI are available, I'd still advocate that you do your encoder measurement with a counter task. Then you can have dummy finite sampling tasks for both AO and AI, one for each motion direction. Both of them would export their sample clocks out to terminals that you wire to the stepper driver.
Are you using AI and AO for anything in this app? Or could they be available? Or do you have any other DAQ devices available to pair up with your 6289?
-Kevin P
02-28-2024 11:34 PM
Are you using AI and AO for anything in this app? Or could they be available? Or do you have any other DAQ devices available to pair up with your 6289?
Yes, they are available as we are not using AI and AO for other purposes.,. we have PCI 6071 E but our pci slots occupied so we cannot install another pci .
or can we use a d flip flop to implement an encoder from digital input channels?
02-29-2024 06:11 AM
Check me on this, but as I recall a simple Flip-Flop isn't gonna be sufficient.
The dummy AO / AI task approach really isn't that difficult. Here's a simple, possibly ready-to-run example that exports the sample clock from a dummy AO task. It would be very similar for AI. See? There isn't much extra to it, compared to any other task.
-Kevin P
03-01-2024 02:19 AM
sorry I am little confused. Using this Ao task can we sample digital channel ?
or to drive stepper motor i can use AO task and spare the counters for encoder position measurements.
03-01-2024 06:26 AM
My suggestion is to use the AO task to drive the stepper (along with a similar AI task for driving it in the other direction), leaving your counters free for the encoder measurement.
-Kevin P
03-02-2024 03:59 AM
Ok thanks so this is option 1 solution.
In addition for option2 we would like to use PCI expansion slot, to insert one more 6071E card and use the counters to read the position and direction.
03-02-2024 04:04 AM
Ok thanks so this is option 1 solution.
In addition for option2 we would like to use PCI expansion slot, to insert one more 6071E card and use the counters to read the position and direction.
And is there way to filter the list of pci cards that support encoder position and direction read or counters