LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I vary the voltage of a DC power source in a sine pattern around a certain voltage?

Jeez, that was silly.  I'm still have a read timeout error occur, and the voltage isn't being ramped on my actual instrument.  The program seems to not be telling my instrument to give a sine wave voltage output.  It's only setting the instrument at 15 V instead of oscillating the voltage in a sine pattern.  I just really need this VI to work, then I can take the tutorials.

0 Kudos
Message 11 of 21
(1,417 Views)

When you add the 15v it needs to be a single scaler numeric constant rather than an array. The array you added only contains one element so your output is also just the one number.

 

If you put a graph indicator on your numeric data you will see what signal you are sending. Adding extra indicators to your code at the development stage can be a big help in solving codeing problems, you should also check out using the Probes.

0 Kudos
Message 12 of 21
(1,416 Views)

I reeeally appreciate your comments, however I still have a VISA Read timeout.  And when I run my VI, nothing shows up on the waveform chart.  This may drive me up the wall.

0 Kudos
Message 13 of 21
(1,409 Views)

You're taking an array of data, turning it into a string, and basically making a very long string of commands to throw at the instrument.

 

Is it possible you are overwhelming the input buffer of the instrument?

 

Also, a lot of times instruments require some sort of termination character when you send it a command such as a line feed and/or carriage return.  I don't see that in any of the commands you are creating.

 

I suggest reading the manual for the instrument and start working with some basic simple, single commands and get that working before you start building up into larger things like working with arrays of commands.

0 Kudos
Message 14 of 21
(1,401 Views)

I should have said a simple scalar, rather than 'single'. Here's what it should look like:

 

 

0 Kudos
Message 15 of 21
(1,400 Views)

You have not followed the suggestions which have been made. You can add a scalar to an array. The result is that the scalar is added to every element of the array. What you did was to add a one-element array (with value 15) to the sine array. The result is a one element array. When two arrays of different lengths the result is the length of the shorter input array.

 

This is what you have: (Note that the constant below the x+y indicator is a constant with teh same values as the indicator.)

 

Add Offset wrong.png

 

Here is the way to add a scalar to an array.

 

Add Offset OK.png

 

Lynn

0 Kudos
Message 16 of 21
(1,394 Views)

Thanks Lynn, my problem now is whenever I try to wire a constant to the y portion of the add function, it automatically makes it a 1D array, and I'm not sure how to add a scalar.  I'm looking through the LabVIEW book now to figure it out, but not finding much...

0 Kudos
Message 17 of 21
(1,365 Views)

Pull a constant from the numeric palette first, then connect it to the + function.

 

Cameron

 

To err is human, but to really foul it up requires a computer.
The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
Profanity is the one language all programmers know best.
An expert is someone who has made all the possible mistakes.

To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):

LabVIEW Unit 1 - Getting Started</ a>
Learn to Use LabVIEW with MyDAQ</ a>
0 Kudos
Message 18 of 21
(1,363 Views)

I'm still getting an error message, but now it's a different one.  It says there's a problem at the VISA Configure Serial Port, but I know I have all of the correct parameters for my instrument.  In fact, now the sine function is ramping, but only from 15 V to 15.4 V, then I get this error message and the VI stops.  My 15 V constant on the Add function is not the same data type as the array, maybe that is the issue.  I know the serial port is configured correctly.  Maybe it would help if I put a Bytes At Port on my VISA Read function?  I've heard some programmers say this is correct, and some say that it creates more problems than it solves.  The error message and VI are attached.

Download All
0 Kudos
Message 19 of 21
(1,359 Views)

You can't add a number to a string, which you do in two places. You have to convert the number to a string and concatenate the two strings.

 

Cameron

 

To err is human, but to really foul it up requires a computer.
The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
Profanity is the one language all programmers know best.
An expert is someone who has made all the possible mistakes.

To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):

LabVIEW Unit 1 - Getting Started</ a>
Learn to Use LabVIEW with MyDAQ</ a>
0 Kudos
Message 20 of 21
(1,355 Views)