LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to output negative values for C/AO0 sine wave

Hello all,

 

I am generating an analog sine wave to output through the C/AO0 to read on an external oscilloscope. Currently, I have been able to generate a specified frequency and amplitude through an FPGA VI. . However, the values that I read are all positive (0-20V) instead of the desired -10-10V. How may I obtain both positive and negative values? Could I do it by scaling the 2nd half of each oscillation by -1?

 

I have attached a zipfile of pictures of my front panel, block diagram, and oscilloscope readings. The oscilloscope is a Hantek DSO4102C.

 

I currently do not have an RT Host; it is just the FPGA VI.

 

- Best regards, 2001J

0 Kudos
Message 1 of 8
(1,688 Views)

There is not enough information visible, but what if you would convert to I16 instead of U16?

0 Kudos
Message 2 of 8
(1,667 Views)

Hello attenbach,

 

I did not think about the data type. I will try converting it to I16, then I will update you on whether it fixed it or not.

 

The pictures that i provided actually had all of the code in use, so there is currently no more LabVIEW code for me to provide, if that is what you were alluding to.

 

- Best regards, 2001J

0 Kudos
Message 3 of 8
(1,661 Views)

I wasn't able to tell how the AO was configured. (Range, bits, etc.)

0 Kudos
Message 4 of 8
(1,642 Views)

Oh, yes. That makes sense. I have attached a zipfile of the project. The Host VI is "CustomDAC_RT Main.vi" and the Target is "DAC_FPGA". Let me know if this file has any issues.

 

 

- Best regards, 2001J

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

Also, for generating a signal, I would recommend setting the scale to 0.25 and the frequency to 2.5E-5. These values currently generate a 1kHz sine wave from 0-5V.

0 Kudos
Message 6 of 8
(1,628 Views)

Hello again altenbach,

 

I just wanted to notify you that I fixed the issue of my signal. The way that I did it was by recording the maximum value of the generated sine wave, then subtracting half of this max from all further points. This translates the waveform vertically while maintaining its shape. It results in half of the waveform being positive, while the other half is negative.

 

Thank you for your assistance.

 

- Best regards, 2001J

0 Kudos
Message 7 of 8
(1,612 Views)

Hey, I am currently having the same problem. Care to explain more thoroughly how did you fix it, please?

 

 I am trying to do the same with the blue signal of the image attached.

0 Kudos
Message 8 of 8
(1,334 Views)