Academic Hardware Products (myDAQ, myRIO)

cancel
Showing results for 
Search instead for 
Did you mean: 

frequency matching problem with myrio!!

Solved!
Go to solution

currently, I am working with myRIO and Labview 2013 to generate Sine PWM signal.
When I created "analog output" in myRio tab and connected to Oscilloscope, waveform of oscilloscope could not show me the proper frequency matched up with frequency I gave in labiew. Is there any relationship between frequency of "analog input"(myRio tap) between real time frequency? otherwise, is there any certain way to calibrate the frequency in labview? Please help me!!

0 Kudos
Message 1 of 30
(12,432 Views)

Hey nim21k,

 

Based on your description I'm not quite sure what you're trying to do.  Can you provide some more details?

 

If you want to generate a PWM signal you can use the PWM express VIs and the PWM pins on myRIO (not the analog output).  You can specify the PWM frequency in the express VI in Hz and this matches the 'real world' output frequency of the PWM signal.

 

If you want to generate a sine wave you don't need to use PWM.  You can simply use an analog output pin and analog output Express VI.  One thing to keep in mind is that the myRIO currently only supports single point output.  This means that each time you execute the AO express VI one value is written to the AO pin.  You can use a timed loop to control the rate at which values are output and based on the values you write and the loop rate you can generate a sine wave with the desired frequency.  

 

Let us know if that makes sense or if you still have questions.

 

Thanks!

 

-Sam K

LabVIEW Hacker

Join / Follow the LabVIEW Hacker Group on google+

0 Kudos
Message 2 of 30
(12,421 Views)

Thank you for your advice.

my objective is to generate sine PWM so I do not use PWM expressVI.

I used comparator with sine signal and triangle signal so that I made boolean output as a digital output for PWM signal.

However, regardless analog output or digital output, I could not see proper frequency which I gave in labview. 

In order to figure out it, I started to investigate the relationship between "myRIO analog output express VI frequency" and "real world frequency in oscilloscope" by generating sinewave from labview.

However, I could not any 'rules' or 'relationships' between "myRIO analog output express VI frequency" and "real world frequency in oscilloscope".

As your advice, could you explain me more detail about using timed loop to make 'real world' frequency?

 

0 Kudos
Message 3 of 30
(12,411 Views)

Hey nnim21k,

 

Can you explain what you mean by a sine PWM wave.  Do you want to generate a PWM signal with where the duty cycle is fixed but the frequency varies sinuslodally?

 

Thanks!

 

 

-Sam K

LabVIEW Hacker

Join / Follow the LabVIEW Hacker Group on google+

0 Kudos
Message 4 of 30
(12,392 Views)

Hey nnim21k,

 

Can you explain what you mean by a sine PWM wave.  Do you want to generate a PWM signal with where the duty cycle is fixed but the frequency varies sinuslodally?

 

Thanks!

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Yes. I want to generate PWM signal with the duty cycle is fixed but the frequency varies sinusoidally.

However, my problem is I don't know how to make a corresponding the frequency from Labview and Oscilloscope(real world)

I want to generate bigger frequency in real world such as 10Mhz or 100khz etc..

 

 

I attached my screen shot as a word file so please see this as a reference.

 

Thank you very much.

0 Kudos
Message 5 of 30
(12,387 Views)

Hey nim21k,

 

Rather than using an analog output to generate the PWM, try using the PWM express VI.  Start simple by creating a timed loop with the PWM express VI.  Set the  PWM EVI to use a fixed duty cycle and use a numeric control inside the timed loop to pass the frequency value to the EVI.  Run the vi and adjust the frequency control as you monitor the output on the scope.

 

The timed loop will execute at a fixed rate so you can use this to calculate new PWM frequencies using the sine VI.

 

Let us know if that helps.

 

Thanks!

 

-Sam K

LabVIEW Hacker

Join / Follow the LabVIEW Hacker Group on google+

0 Kudos
Message 6 of 30
(12,379 Views)

Hey nim21k,

 

Rather than using an analog output to generate the PWM, try using the PWM express VI.  Start simple by creating a timed loop with the PWM express VI.  Set the  PWM EVI to use a fixed duty cycle and use a numeric control inside the timed loop to pass the frequency value to the EVI.  Run the vi and adjust the frequency control as you monitor the output on the scope.

 

The timed loop will execute at a fixed rate so you can use this to calculate new PWM frequencies using the sine VI.

 

Let us know if that helps.

 

Thanks!

 -------------------------------------------------------------------------------------------------------

 

Thanks for your reply.

I can create PWM expree VI simply. However, This PWM EVI is unable to generate Sine PWM which is generated by comparing sinewave and triangle wave. Sine PWM is not fixed duty ratio. Therefore, I want to create Sine PWM by using analog output or digital output without using PWM evi.

However, I could not match the frequency. 

let's assume that I just created  square waveform by analog output. however, I could not see any proper frequency in the oscilloscope. how can I give real-time frequency when I create waveform in LV.

0 Kudos
Message 7 of 30
(12,371 Views)

Hey nim21k,

 

I'm pretty sure the myRIO PWM express VI can do everything you need.  I'm suggesting you start simple and just manually control the PWM frequency using the express VI and a control in LabVIEW.  Then generate the frequency programatically to vary the frequency sinusoidally, then later you can add duty cycle adjustment.  I think you need to break this down into smaller tasks so you can develop an understanding of each sub component before jumping into your final goal.  Using the PWM express VI will be much easier than using the analog output and combining sin and triangle waves.

 

The PWM peripheral on the myRIO runs independently of the RT loop which means that when you set the frequency it will remain at that frequency until you change it.  The analog output is single point, which means each time you call the express VI one value is written on the AI channel.  In order to generate a nice square wave you'll have to be able to output several samples per period which means your overall output rate will be limited and will require more CPU time on myRIO.

 

Thanks!

 

-Sam K

LabVIEW Hacker

Join / Follow the LabVIEW Hacker Group on google+

Message 8 of 30
(12,368 Views)

I’ve been trying to use myRio to generate sine PWM using PWM Express VI for inverter applications. So far I haven’t found a way to do that.

 

I am able to generate PWM with fixed duty cycles but I’d like to know a way to generate sinusoidal PWM. I have tried generating a sinusoidal signal and applying it to the duty cycle block of the PWM generator but it just doesn’t work. I’d like to know if there is any way to generate a sinusoidal PWM output using myRIO with a PWM frequency of about 40 kHz.

 

Also, the output of myRIO PWM, when seen on an oscilloscope, doesn’t seem to have the same frequency as the waveform on the computer screen. When it is supposed to produce a 10.1 Hz waveform, the oscilloscope shows me a sinusoidal waveform with a period of 10 seconds. When I enter 10.2 Hz, the oscilloscope shows a signal with period of 10/2 = 5 seconds. Similarly, 10.6 Hz gives me 10/6 = 1.67 seconds. What is the relationship betwwen the frequency I enter into myRIO software on the computer screen and what I get at the output? What does it mean when I ask for a 10.2 Hz wave? What is the significance of this “0.1” Hz? (The default frequency in myRIO is 10.1 Hz) The attached picture is the screen shot with different frequencies.

 

Thanks in advance for your response.

0 Kudos
Message 9 of 30
(12,356 Views)

Hey,

 

Before you said

 

"Yes. I want to generate PWM signal with the duty cycle is fixed but the frequency varies sinusoidally"

 

Then in the post above you said:

 

"I have tried generating a sinusoidal signal and applying it to the duty cycle block of the PWM generator but it just doesn’t work."

 

Which one do you want to do?  Vary the period (frequency) sinusoidally or the duty cycle?  If I don't understand your problem correctly I'm probably going to lead you down the wrong path Smiley Happy.

 

Thanks!

 

-Sam K

LabVIEW Hacker

Join / Follow the LabVIEW Hacker Group on google+

 

Message 10 of 30
(12,348 Views)