03-03-2015 04:24 PM
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!
12-02-2019 05:24 AM
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
12-02-2019 06:48 AM
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
11-12-2020 02:01 PM
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.
11-12-2020 07:45 PM
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