Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Recording quadrature encoder and AI signals simultaneously and generating output TTL signals in one VI

I want to record simultaneously encoder, pressure and other AI signals and output a TTL signal for every other pressure signal. I have two VIs: One is to record all signals and the other is to generate TTL signals.

1. Since I'm new to Labview, I would like to double check with experts that if my VI (attachment 1) did what I expect. I would like to have DAQ box read and write encoder signals and pressure signals at the same time so I can plot PV diagram.

2. During acquisition, some data points are usually missed, shown in attachment 2. Is there any way to solve it?

3. I tried to combine two VIs but it never work (attachment 3). Can anyone give me any suggestions?

PS. Labview 9.0 and NI USB-6216 are used.
Dummy signals are 30Hz sine waves for pressure and 2 TTL signals for encoder A and B at 5kHz.

Thank you!

0 Kudos
Message 1 of 4
(6,015 Views)

Here are the attachments.

0 Kudos
Message 2 of 4
(6,014 Views)

Your USB-6216 can definitely take multiple measurements at the same time as long as they are not using the same channel. The chart in the first attachment does seem like it is acquiring all of those inputs at the same time. However, I do see that you are missing a few of the points. What sampling rate are you using in for those measurements? If it is too fast for your device to handle, you could be missing data points.

 

Also, what is the code you used initially to take the measurements in attachments 1 and 2 (those two attachments were the same file)?

 

In regards to question 3, it is possible to combine the two VIs. From looking at your code, it looks like you have the basic analog input and encoder DAQmx tasks set up correctly. I would look at the example for generating a pulse/pulse train to correctly set that up. You can find that in the Example Finder at the following location:

 

Hardware Input and Output>>DAQmx>>Generating Digital Pulses>>Gen Dig Pulse Train-Finite-Retriggerable.vi

 

 

Let me know if you have any questions! Have a great day!

 

Peter E
Applications Engineer
National Instruments
0 Kudos
Message 3 of 4
(5,991 Views)

Thank you for your help, Peter!

 

I attached the wrong file for attachment 1. The initial code for measurement is attached here.

The sampling rate is 20000 and the sample mode is continuous.

For missing data points, it improved when I add "wait until next ms multiple" in while loop.

 

Follow the example you gave me, I'm able to generate TTL signals in one vi, attachment 2. Could you please check if it's correct?

It looked fine with simulated signals and hope it will go well with real engine tests.

 

I have two more questions:

1. Does the input number for wait until next ms multiple should always be the same as "samples per channel" in sample clock?

2. How will the value of "samples per channel" in sample clock affect data acquisition? I tried 1000 and 10 but didn't see any difference between these two.

 

Thanks a lot.

 

Download All
0 Kudos
Message 4 of 4
(5,966 Views)