LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Generating a continuous sine wave

Hello all!
 
I'm trying to modulate a laser's wavelength as a sine wave, and I tried to adapt the "continuous sound output.vi" so that I have a sine wave with the frequency I want.
 
My problem is that this .vi gives me (as output) an array with a certain number of samples with the sine wave values, but I only want one of those values at a time.
 
I hope I made myself clear.
 
In other words I want to say my laser to continuously "sweep" a certain range of wavelengths in a sinusoidal manner.
 
I thought about using the event structure's timeout to generate a sine value [sin(wt)] for each time interval (timeout), but I don't know if there are other better ideas...
 
Thanks in advance!
 
0 Kudos
Message 1 of 8
(4,326 Views)
Are you controlling the laser with your vi? If so , how are you doing this.  Might not hurt to post your code.
0 Kudos
Message 2 of 8
(4,322 Views)
My .vi is attached. But I didn't use it yet to control the laser.

The continuous sound output wold be great if I could contrl the laser wth the same frequency as the sin wave was generated...

0 Kudos
Message 3 of 8
(4,319 Views)

You should be able to index the waveform output into the GPIB using a for loop.  I included the for loop in the diagram.  I messed up your stop button tho, i had made it a constant while testing.

give it a try and let me know.

Message Edited by EJW2003 on 12-14-2006 10:02 AM

0 Kudos
Message 4 of 8
(4,311 Views)
Thank you EJW2003!

Unfortunately I'm using LabVIEW 7.1 and I'm not able to open your .vi.
Can you save it in a previousversion for me?

In answer to the solution you gave, using the for loop won't introduce a delay in my  "generation of sine values - communication" with the laser?
0 Kudos
Message 5 of 8
(4,303 Views)
I think I got into a solution.

I used an event structure and its timeout event to generate the sine wave.

The .vi is attached below.

Best regards!
0 Kudos
Message 6 of 8
(4,286 Views)

I like it!  Completely different from how I would have done it.   That's why I love Labview!

 

Good job!

 

eric

0 Kudos
Message 7 of 8
(4,268 Views)

Hello again!

I'm having a doubt with the program I made.

I'm being able to generate a sine value each millisecond that passes (= timeout of the event structure), but if I want to generate these values at a higher rate how can I do it, since the event structure minimum timeout time is 1 millisecond???

I'm asking this because if I start to generate signals at higher frequencies I will want to have more samples per second...

Any help on this?

Thanks in advance!

0 Kudos
Message 8 of 8
(4,251 Views)