LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

fpga-sine wave generation outputting as square wave

I am working on a graduate project where I need to produce some sine waves and I am getting more of a square wave when I output it and measure on the scope. The program I am running is quite simple at the moment to attempt to discover any errors by process of elimination. I have the sine wave generator in a while loop outputting to an AO port. I am using the cRIO 9022 with the 9269 AO module. I will attach screen shots of my code and my oscope image. Thank you for your time

Download All
0 Kudos
Message 1 of 8
(5,670 Views)

You have the amplitude for the sine wave set to 32676.5, which is of course much larger than the analog output can produce. The output is clipped, and you get what looks like a square wave. You can try simply setting the sine wave amplitude to 20, but you might lose resolution. If so, you'll need to use one of the fixed-point conversion functions to convert the the integer output into the correct fixed-point representation, but with the same bit pattern.

0 Kudos
Message 2 of 8
(5,640 Views)

You can see the coersion dot on the AO block , this says ur sine wave generated and your module both are in different limits.

Find the limits of the AO block and scale it appropriately.

 

Also try to change the Calibration Mode in Module Configuration of the analog ouput to Raw.

0 Kudos
Message 3 of 8
(5,600 Views)

if you set the calibration mode to raw on these modules, the error is significant.  better to use the integer to fxp routines and use the calibrated mode of output. see attached code snippet for my preferred approach.


@nmadhaneie wrote:

You can see the coersion dot on the AO block , this says ur sine wave generated and your module both are in different limits.

Find the limits of the AO block and scale it appropriately.

 

Also try to change the Calibration Mode in Module Configuration of the analog ouput to Raw.


 

Stu
Message 4 of 8
(5,585 Views)

Thanks a bunch for your help

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

I am currently attempting your setup Stu and I'm not really getting a signal at all. I'll attach my code with the oscope screenshot(not much of anything). I believe I have my dimension values correct but apparently not if I'm not getting my desired signal. 

0 Kudos
Message 6 of 8
(5,552 Views)

you did not follow the code.

leave the sine generation at full scale. (you changed it to 4).  use +/-16,1 as the integer to fxp type and make sure your amplitude is not zero.

 

Stu
Message 7 of 8
(5,522 Views)

it worked!!!! I'm so happy haha. Thanks for your time Stu, problems been killing me

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