Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Measure a pulse width by using software

Hi,
I'm a beginner of LabVIEW. I'm trying to measure the pulse width of a signal in msec by using 2 methods (while loop iteration and tick counts). Here are some problems that I have (my piece of software is in the attachment):

1- While loop Iteration
Either the signal is High or Low, the Iteration continues to add up. It supposes to:

Start to count when it detects a Rising edge (Signal is high) and stop when it detects a fallen edge (signal is LOW) . And restart, counting from 0, when a rising edge is detected again

I would like to do : If the signal is Low, then just go back to the "big while loop of the input part" and wait for the next rising edge, but I don't know how to do that.

2- The Tick Count:
The Tick Count doesn't seem to count anything, where should I put the Tick Count and the Shift register, so It will record the Start time and the End time of the while loop and I can get the difference between them.

3- The Input LED:
If I connect the LED to the output of the DAQmx Read, it will flash when When the DAQmx Read is High But if I connect the LED with the Case Structure, it won't work anymore.

I'm using LabVIEW 8.2 and PCI-DIO-96

Please help me to solve this problem. Thank you very much
0 Kudos
Message 1 of 2
(2,922 Views)
Hi vietwave,

For point #1, I am assuming when you mention go to the big loop you are referring to the outer lower loop. From the code it appears that due to the local variable you are using, the only way you would get out of the inner loop is to press the stop button. This is why it appears not to be exiting. Also, for the tick counts, you mentioned that it does not count anything. You should remove the shift registers, this will allow the count value to increment and display a value once the program exits the loop. Also, the reason why when you attach the LED to the Case Structure it appears not to work is because when you get into the case structure, you go into a while loop which essentially goes into an infinite loop (until you press the stop button). Please let me know if you have any questions about this. Would you happen to have a board with two counters? This would be a more effective method to measure a pulse width. If not please let me know if you have any questions on the suggestions I have proposed to your current code.

Best regards,

Steven
0 Kudos
Message 2 of 2
(2,885 Views)