LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

generating sine wave using array of values

Highlighted

I am using the VISA pallete to acquire array of amplitude values (100 values) from CCS C compiler. Using this array, how would I generate a sine wave? I have attached what I have so far. Help would be much appreciated! 

0 Kudos
Message 1 of 14
(2,474 Views)

You need to explain what you are trying to do. Right now you are calculating the sine of your acquired data, is it what you want?

You will only get a 'sine wave' out of this if your acquired data is a ramp signal of some kind. Also your converted data is integer, so probably not a good resolution to use as input to a sine function. What is you data range and what are these 'amplitudes' representing? What is your end goal?

0 Kudos
Message 2 of 14
(2,420 Views)

So, I have connected a microcontroller (pic18f6722) to the function generator. I have set the ampltude to 4.5V and the freq to 60 Hz on the function generator. If i were to connect the function generator to an oscilloscope I see a unipolar sine wave with an offset of 2.25V. I basically want to recreate that sine wave on labview. I have written code to collect the values of the sine wave and now I have used the VISA palletes to get the array of values in labview and make a graph out of it.

0 Kudos
Message 3 of 14
(2,411 Views)

Hi beginner,

 

I basically want to recreate that sine wave on labview.

check.png

 

I have written code to collect the values of the sine wave and now I have used the VISA palletes to get the array of values in labview and make a graph out of it.

And what's your problem when you already have written code?

Best regards,
GerdW
CLAD expired, using LV2011SP1 + LV2017 (+LV2019 sometimes) on Win7+cRIO
Kudos are welcome Smiley Wink

0 Kudos
Message 4 of 14
(2,407 Views)

Thanks for the reply! And the code is over at CCS C and since I am a begineer at serial communication and labview I had some trouble generating a sine wave. I came close but the wave looked like a step function.

0 Kudos
Message 5 of 14
(2,404 Views)

and it still doesn't explain why you are calculating the sine of your data (sine of sine if you original data already represents a sine wave). Could you at least post a data file with 'Voltages' values so we understand what you are acquiring?

0 Kudos
Message 6 of 14
(2,400 Views)

I have attached an excel sheet with the voltage values acquired. For the time, it starts at 333us because that was the delay i used over at CCS C compiler. The graph shown in the excel sheet should be the graph i should be getting in labview

0 Kudos
Message 7 of 14
(2,397 Views)

ok, get it. Your data consists of your sine tone data but I guess you do not read the time array.

If you extracted the two columns in your spreadsheet and created X (time) Y(Voltages) data arrays then you could graph it on a LabVIEW XY graph and get the same look as in your spreadsheet.

 

In your actual VI I would suggest you to try the following (to start with)

1 - Remove the sine primitive

2 - Replace the Decimal String to Number primitive in your FOR look with a Fract/Exp String to Number

3 - Graph the array out of your FOR loop directly to a waveform graph

 

If it looks like a sine tone, then you can move on and work on the time information (dt)

0 Kudos
Message 8 of 14
(2,391 Views)

I only extracted the voltages from labview. I just used the time on excel to see how the graph would look like. How would I create a time array?

0 Kudos
Message 9 of 14
(2,387 Views)

From your XLS it looks like you are sampling at 3 kS/s (dt = 0.33 ms).

Use the Build Waveform (Waveform palette) and input 1/3000 to the dt terminal and your data array to the Y terminal and graph it (likewise on a Waveform Graph).

 

If you can't get it to work, try to post you Voltage string array with saved values so we can check your string formatting.

0 Kudos
Message 10 of 14
(2,383 Views)