Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Time capture

Hi ladies and gentlemen
 
I want to send out a signal (S1) for 1sec from the PCI-DIO-96 to trigger a device that will send 4 signals (S1, S2, S3, S4). I would like to monitor these signals, so I wired them back to the PCI-DIO-96 as inputs.
 
1- I would like to know if the device has sent out signals or not so I wired the LED (VI) to the DAQmx read for each inputs
2- I also want to measure the pulse duration of these signals (S1, S2, S3, S4). It means that I have to capture the rising edge and the falling edge of each signal, then execute a substraction to get the pulse duration. I have tried to do it but it doesn't work. So my question is:
 
1- Is it possible to do this operation with the PCI-DIO-96 ?
2- If yes how ? Can you take a look at my my code (in the attachment). Thank you.
3- I use LabVIEW-8.2 and 8.5
 
0 Kudos
Message 1 of 3
(3,049 Views)

Hi vietwave,

Certainly the task of measuring pulse width would be easier using a counter card. Right now you are trying to measure the width in software, while it would be more accurate by measuring in hardware. How long are the digital pulses you are trying to measure? If accuracy is a strong requirement in your measurement it will be better to use counters for this application, and this card PCI-DIO-96 only has digital lines. Here are some helpful links in case you want to look more into that:

-          Pulse-Width Measurement with a Counter

-          Measuring Period, Semi-Period, Pulse Width, and Two-Edge Separation

Regarding your actual code I see that you are taking the millisecond timer value to calculate the pulse width; however that millisecond timer is the same for the vi inside the case structure and outside the case structure that’s why the actual pulse duration is zero. If you decide that this approach is good enough for your application I suggest that you use shift registers to save the value of the tick count vi. You can save the value of the tick count the first time you read high and save it, then subtract that value with the tick count the first time you read low after reading high, and so on. I hope this is helpful,

Ana P
National Instruments
Applications Engineer
0 Kudos
Message 2 of 3
(3,004 Views)
Hi Ana P

First of all thanks you very much for replying to my question. I'm really busy so I couldn't reply to your msg sooner. I forget to tell you that I’m just a beginner, so I don't have experience with LabVIEW at all.

I tried to put the "Elapsed Time" in the Case loop, so it will display the time when the signal is high. It works, but I have a little problem:

1-After the signal becomes Low, I would like the Elapsed Time Stop, but I don't know how to do it. :(, it just keep adding the high time again. I want to get  the high time of the signal only 1 time.
2-Then, I tried to put the Shift-registers as you suggested and connect them to the "Tick Count", but somehow. it always display 200.

If it is possible, can you help me to measure the Pulse Width of the signal please?  Thank you again for your help.


0 Kudos
Message 3 of 3
(2,977 Views)