LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can I (and if so, how would I) connect two encoders (one linear and one angular) to the same chassis (NI 9401) and get their respective NI MAX tasks to run as simultaneously as possible?

Solved!
Go to solution
Solution
Accepted by topic author JosephQ

I was able to reserve both tasks via the Control Task VI... works like a charm! The answer was so simple! Thank you for all of your help!

0 Kudos
Message 11 of 15
(1,350 Views)

How were you able to reserve both tasks at the same time? I'm trying to solve exactly the same problem. Thanks for your help

0 Kudos
Message 12 of 15
(896 Views)

What, specifically, is your "exact same problem."

 

If you want the two measurements to be sync'ed and properly *correlated*, you need to deal with a few distinct things properly:

 

1. Share a sample clock signal so both tasks sample at the same time.

 

2. Start the tasks before starting the sample clock (if possible).

 

3. Read the same # samples from both tasks to keep the data *correlated*.

 

4. Make sure the initial data is also properly correlated.  This one takes a little explaining.

    When you start the task, the counter will start tracking encoder position immediately, even in the absence of a sample clock signal.  The 1st sample will reflect the amount of motion that happened between task start and the 1st sample clock signal.

    One way to deal with this is that both tasks can subtract off this 1st sample value from all its measurements.  This is analogous to a "tare" operation on a weight / force measurement.

    Another way to deal with it is to configure both tasks to use the same "Arm Start" trigger.  This lets you control when the encoder tasks start tracking position.  Again, this is separate and distinct from sampling the position value.

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 13 of 15
(890 Views)

The solution i used:

I didn't need the DAQmx counter. I used the "Digital 2D Nchan 1Samp", DAQmx function to acquire the boolean values. I've written the logic to get the encoder values myself, which wasn't to hard.

0 Kudos
Message 14 of 15
(820 Views)

It sounds like you're using a software-timed on-demand DI task.  Unless your encoder pulse rates are unusually slow (like probably <100 Hz), it's very unlikely you'll be able to regularly sample fast enough to be sure of catching every transition.

 

You'd be very very much better off using software-timed on-demand counter tasks to track position with your hardware.  Hardware-clocked tasks would be even better so you'd know the two position measurements truly correlate in time.

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 15 of 15
(809 Views)