LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading a PWM and determining pulse width using a digital input pin on a NI 9425 DAQ

Hello!

 

I have been experimenting with LabVIEW for about a week now and have run into a brick wall.  I have found a fairly effective way of reading a PWM signal through an analog input and determining the pulse width.  However, it is becoming necessary for this project to do this same thing using a digital input.  I've been playing with this for about a day now and am not making much headway.

For reference, I will be using a 9524 device

Any ideas?

0 Kudos
Message 1 of 11
(7,436 Views)

Hi JPISU,

 

and what's your problem?

 

Before you used some kind of AI: took a signal, checked for threshold value to determine PWM pulse, calc the length of the pulse.

Now you could: use a DI to take a signal, check for TRUE to determine the PWM pulse, calc the length of the pulse...

 

Maybe you need some additional hardware to connect the former analog signal to your digital input?

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 11
(7,433 Views)

That's what I'm hoping to do, actually!  I am trying to think of a way to do it that does not require a counter as my DAQ device does not have one!  I can determine when there is a rising and falling edge, but I am having trouble with the timing in the middle.  Essentially, I haven't been able to calculate the duty cycle.  I understand, mathematically, how it should work (at least I think I do Smiley Tongue) but am having difficulty implementing it in LabVIEW.  I've been searching other forums and most provide solutions using a counter.

 

Thanks!

0 Kudos
Message 3 of 11
(7,431 Views)

Allow me to correct - I thought I was able to detect the rising/falling edge, but I don't have confidence in it.

0 Kudos
Message 4 of 11
(7,430 Views)

Hello JPISU,

 

It is not possible to do PWM at high frequencies using digital lines because the timing used for that has limitations. Check the KB Software-Timed PWM Using a Digital Output Line, it gives examples on how to do it, but you need to have in mind that there might a certain delay.

 

Best Regards,

0 Kudos
Message 5 of 11
(7,408 Views)

amezam,

 

Would you reccommend just sticking to an analog input?

0 Kudos
Message 6 of 11
(7,406 Views)

Hi JPISU,

 

"I thought I was able to detect the rising/falling edge, but I don't have confidence in it."

When you don't have confidence you should do some software testing...

 

Btw. do you use a cDAQ chassis or a cRIO?

 

@amezam:

I don't see the connection between outputting a PWM on a DO line and detecting edges of a DI signal?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 11
(7,403 Views)

Gerd W.

 

I am not going to need to send a PWM from LabVIEW in my final application.  I will be reading the PWM signal off a board I am testing.  I am concerned with reading this signal (coming off the DUT) into LabVIEW via a DI terminal and then determining pulse width.  

 

Jane

0 Kudos
Message 8 of 11
(7,400 Views)

Sorry for omitting this - we use a CDAQ chassis.

0 Kudos
Message 9 of 11
(7,397 Views)

Also, if it is helpful at all, I've attached two vi's.  One, functions just as I need it to - but it doesn't involve data aquisition.  The second should be similar to the first, but is non functional - I keep getting an error that my amplitude is zero.

 

Any thoughts?

Download All
0 Kudos
Message 10 of 11
(7,395 Views)