取消
顯示結果 
搜尋替代 
您的意思是: 

How to use internal counter of cDAQ 9172 to measure PWM and generate frequency ?

已解決!
前往解決方案

Hi,

My project's requirement is to measure 6 PWM channels and generate 5 frequency channels.

From suggestion of NI engineer, I bought cDAQ chassis 9172 and NI 9423 (8 DI correlated) and NI 9474 (8 DO correlated) for this requirement. I have some questions

 

From the article:

 

1> What Do I Need to Know Customize My CompactDaq 9172 Chassis

http://zone.ni.com/devzone/cda/tut/p/id/9367

I know that this system support 32 physical timing channels to correlated I/O pins for slots 1-4.

 

=> I don't really sure how to use these timing support channels.

 

2> Using Internal Counters on a NI cDAQ-9172 as a Sample Clock for Other Tasks

http://digital.ni.com/public.nsf/allkb/ADFC4DD8C9690232862575B70079FBD4

I know that I can change the property of the physical channel so I can get 2 counter externally from chassis 6 and 7.

 

=> I don't think that this solution will have me because I can only use 2 counters with this method.

 

Could anyone please tell me how to solve my project requirement? How to select the setting for DAQmx VIs?

 

I have experience with measure the PWM and generate frequency, but with seperate counter only.

 

Best regards,

Thang Nguyen

 

1 條訊息(共 16 條)
9,053 檢視

Hello Thang,

You can use internal Counter clock and control the DIO lines by using that as a sample clock. Keep in mind that for generation you will have to use custom wavefrom for each line and will have to do little math on freq division. I have attached a pseudo code for you have a look at it this might help you. Put your DIO module in slots 1-4 and you can use internal counter lines.

 

Cheers

 

-Lab

2 條訊息(共 16 條)
9,023 檢視

Thank you so much,

What I want to do is to be able to change the frequency of the output signal. I will try to find a way to do it.

Do you have the sub VI1.vi file?

 

Best regards,
Thang Nguyen

0 積分
3 條訊息(共 16 條)
9,002 檢視
解決方案
接受者 THANG NGUYEN

Hey Thang,

Aha...for that you can use Channel Property node.

Channel Property Node.jpg

Cheers

Lab

0 積分
4 條訊息(共 16 條)
8,986 檢視
 
0 積分
5 條訊息(共 16 條)
8,985 檢視

Sorry forgot to attach VI.

😉

 

0 積分
6 條訊息(共 16 條)
8,984 檢視

Thank you so much,

I think this is the solution for my project without using a more expensive system.

But do you think I can do the same thing to measure the PWM pulse? Use the internal counter to measure the duty cycle?

 

Best regards,

Thang Nguyen

0 積分
7 條訊息(共 16 條)
8,979 檢視

Hey,

I beleive you can do you using Counter input task as Pulse Width use implicit timing and perfrom buffer acqusition. This way you get high and low time measurement of the input signal. Another thing you can try is just perfrom AI and write some code to calculate time period.

 

-Lab

0 積分
8 條訊息(共 16 條)
8,969 檢視

Hi guys,

 

You can measure the duty cycle using the internal counter as Lab mentioned, but instead of a Pulse Width Measurement you would use a Semi Period Measurement.  The Pulse Measurement is only going to measure either high or low (your choice).  Semi Period will measure both high and low.  Here's a link that shows how to do this:

 

DAQmx - Measure Duty Cycle Continuous

 

One caveat is that you need to know which edge is going to occur first--the data returned will be an interleaved array of High and Low times, so you need to know which to start on.

 

 

There are only two counters on the 9172, so you won't be able to use this method for more than two channels (one channel if using the other counter to generate the PWM signal).

John Passiak
0 積分
9 條訊息(共 16 條)
8,944 檢視

Could I use this setup to the 9172 to control a PWM in the NI9403?? I'm trying to generate a PWM using the NI9403 but without sucess. I know the 9403 is not a counter but I'm trying to use the software time control (http://digital.ni.com/public.nsf/allkb/1AE66AE0D542BCB386257522005434BE ). When I test my VI with the a virtual output of the 9403 in the DAQ Assistant, the control is OK and the frequancy is very good. But when I change the DAQ Assistant to a real output to test my VI with my hardware (9403 and Daqmx), the frequency change to a very low speed.

 

Could you please let me know what is happening and what can I do to fix this issue??

 

Thanks to all

 

Galli

0 積分
10 條訊息(共 16 條)
8,328 檢視