Academic Hardware Products (myDAQ, myRIO)

cancel
Showing results for 
Search instead for 
Did you mean: 

PRoblem in reading PWM signal in myRIO 1900

Solved!
Go to solution

Hi Guys,

 

 

I am working with myRIO to generate PWM pulses.

here is the Block Diagram of my circuit.

 

PWM generation in myRIO.JPG

 

I have connected the PWM pin to the analog input pin externally. So I can observe the PWM pulses in the waveform chart.

But the waveform is not clear. It is as shown in the screenshot.

myRIO PWM waveform.JPG

 

PWM waform myRIO 2.JPG

 

 

See the waveform is not proper. When I am observing the same PWM pulses in the CRO(Cathode Ray Oscilloscope, the actual oscilloscope in the real world), I am getting the waveform accurately. i.e., the PWM pulses are generated properly. But the analog read is unable to read the PWM pulses.

 

I faced the same problem with the analog read pin earlier when I am reading the input voltage. It is not giving the continuous readings of the actual voltage input.

 

Please guide me how to read these pulses using analog read.

 

Please tell me to what range of frequency I can use this myRIO to generate pulses?

Am I able to use 40kHz?

 

 

0 Kudos
Message 1 of 11
(10,139 Views)

I have tried even using analog express. and the response is same as shown below.

 

analog express myRIO.JPGpwm waveform analog express myRIO.JPG

0 Kudos
Message 2 of 11
(10,136 Views)

can anyone help me in this?

 

0 Kudos
Message 3 of 11
(10,107 Views)

can anyone help me in this?

I am stuck in this work.

 

0 Kudos
Message 4 of 11
(10,107 Views)

Hi Bhanu,

 

From seeing the snapshot, it seems that you're generating a PWM with a frequency 1000Hz.

But the loop rate is set to 500ms, which means the sampling rate for your analog input is 2Hz .

You can't acquire a 1kHz signal with a sampling rate of 2Hz. It does not obey Nyquist Theorem of Sampling.

 

Regards

 

Archan Mudwel

Applications Engineer

National Instruments

0 Kudos
Message 5 of 11
(9,994 Views)

Hi rcs,

 

As you said, I have removed the wait block. But still the response is same.

Can you suggest me any other way

0 Kudos
Message 6 of 11
(9,987 Views)

Hi Tripta,

 

I did not mean to remove the wait in the loop. Once you've removed the wait, you'll have to benchmark the loop to check the loop period.

Because you're generating a 1kHz square pulse, you'll have to sample it at least at 10kHz. When you're using the express VIs, if you give a pulse freq of 1Hz or say 10 Hz, you should be able to acquire analog samples correctly if you sample it at 10Hz or 100Hz respectively. You also need to monitor whether the loop itself is taking more time to execute than the delay you've specified.

 

The pulses will defintely be generated according to the settings that you've sent but If you are trying to acquire them back on the analog input pin at that fast a rate, I will recommend you to use the myRIO in the FPGA mode. Have 2 parallel loops in the FPGA. One to generate the pulses and the second one to acquire analog data at a rate such that you acquire the square pulse with a good enough waveform. Please note the higher the sampling freq the better it is.

 

Let me know if you have any further questions.

 

 

Message 7 of 11
(9,985 Views)

HI RCS

Can you Please explain your answer by some block diagram of labview FPGA.

 

0 Kudos
Message 8 of 11
(9,822 Views)

Hi,

 

Try to use the Analog Input Express VI in the n sample mode.

Please refer to the snapshot attached.

You will have to change the instance to be n samples, provide a sampling rate around 10 times the pulse frequency. For e.g. in case the pulse freq is 1kHz, put the sampling rate as 10kHz, put a valid number in the number of samples according to the loop rate required and then use the VI.

 

0 Kudos
Message 9 of 11
(9,703 Views)
Solution
Accepted by topic author bhanu_as_ash
Hi rcs,
The desired pulse frequency is 10 KHz. So my sampling rate should be 100KHz which is not possible in DAQ mode. There is one more problem with the myRIO. Only AI0,BI0 and CI0 has n-sample mode. The rest analog input pins do not have n-sample mode. But in my project, I need 4 AI pins with n-sample mode, which is not possible. Apart from that, the sampling rate should also be supportive, which is not happening in my case. We can say that it is a drawback of myRIO with DAQ mode.
The only alternative to fix this problem is to use FPGA in myRIO.
It can sample at a rate of 25nS.
But little complexity is there
0 Kudos
Message 10 of 11
(9,697 Views)