Academic Hardware Products (myDAQ, myRIO)

cancel
Showing results for 
Search instead for 
Did you mean: 

myRIO Sine Wave error frequency

Solved!
Go to solution

Hello,

I have a big problem when generating a sinusoidal signal. I am using FPGA core with one Express VI to generate sine wave and set frequency is not the same output when I measure with an oscilloscope. For example, to 100Hz   is output 119Hz; to 1000Hz   is output 1200Hz and to 5000Hz is output  5800Hz.

Please I need some help as soon as possible for my graduate work.

0 Kudos
Message 1 of 8
(5,834 Views)

zip and post your project.  we cant help with just the description you provided.  if you can produce a minimal project that demonstrates the problem, that is even better.

Stu
0 Kudos
Message 2 of 8
(5,831 Views)

Hi,

 

See the attachment. Could you help me how i can use simulated target, because compile is too long time; when I change to the simulated also gives me an error.

 

 

Download All
0 Kudos
Message 3 of 8
(5,799 Views)
Solution
Accepted by topic author Lucas_Tadeu_Salomao

the input to the sine generator takes a +32,0.  your code was not providing the full 32 bits and the result was course frequency steps.

i have attached an updated version.  this one should work much better.  as i noted in the VI, I don't typically put the calculation of the generation increment in the FPGA code.  this calculation is typically done in floating point in the RT code.  but if you need it in FPGA, then, this is one way to do it.

Stu
0 Kudos
Message 4 of 8
(5,788 Views)

Hello

I tested it with your changes and got a satisfactory result, but now I'm having a problem signal amplitude. If I put the output sine generator of direct in the analog output, the signal is distorted, almost square. The frequency is good, but the signal is distorted. I tried to find a sine generator amplitude relation with the level of analog output of Myrio and could not. Can you help me? I also noticed that the signal is very serrated and increasing the number of points also distorts the signal.

0 Kudos
Message 5 of 8
(5,736 Views)

are you saying that the Teste Senoide.vi is doing that?  it should have produced a full amplitude wave.  (i did just notice that the stop condition was not correct)

Stu
0 Kudos
Message 6 of 8
(5,733 Views)

The stop condition "Stop if true" works fine.  Why do you sugest  change to "Continue if true"?

0 Kudos
Message 7 of 8
(5,731 Views)

probably my mistake.  maybe i changed it inadvertantly here.

Stu
0 Kudos
Message 8 of 8
(5,727 Views)