Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

counting pulses using digital input channels on 6289

Solved!
Go to solution

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

0 Kudos
Message 1 of 14
(800 Views)

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

ALERT! LabVIEW's subscription-only policy coming to an end (finally!). Permanent license pricing remains WIP. Tread carefully.
Message 2 of 14
(766 Views)

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

0 Kudos
Message 3 of 14
(755 Views)

...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

ALERT! LabVIEW's subscription-only policy coming to an end (finally!). Permanent license pricing remains WIP. Tread carefully.
Message 4 of 14
(744 Views)

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?

0 Kudos
Message 5 of 14
(728 Views)

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.

 

export sample clock.png

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy coming to an end (finally!). Permanent license pricing remains WIP. Tread carefully.
Message 6 of 14
(719 Views)

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.

0 Kudos
Message 7 of 14
(703 Views)
Solution

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

ALERT! LabVIEW's subscription-only policy coming to an end (finally!). Permanent license pricing remains WIP. Tread carefully.
Message 8 of 14
(698 Views)

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.

 

0 Kudos
Message 9 of 14
(684 Views)

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

0 Kudos
Message 10 of 14
(682 Views)