LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

output voltage in a staircase pattern in LabVIEW using myDAQ

Hello Everyone!

I would like to write a program to output voltage in a staircase pattern in LabVIEW using myDAQ. By staircase, I mean that I want to increase the voltage by 0.5V from 0V to 10V and hold it for 10 seconds at each voltage. I am trying to write a program that will do this, but I am having difficulty. Can someone please tell me how to program it? Thank you in advance.

0 Kudos
Message 1 of 7
(813 Views)

What are you having trouble with?  To see a super simple DAQ example that you can use to jump start your program, open Voltage - On Demand Output.  If you were to change the DAQmx Write.vi to single DBL like I did in the pic and connect the iteration terminal (the [i]), you will have a staircase output that steps by 1 volt but doesn't stop (hint: maybe change the while loop to a for loop?). 

 

I also changed the delay time to 1 second.  Play around and try to get what you desire.  If you get stuck, post your current code attempt and we can help you further...

 

NIquist_0-1701718475494.png

 

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 2 of 7
(780 Views)

What have you tried so far?  "Having difficulty" is a pretty broad statement.  We are here to assist, not to do your work for you.

 

You might want to have a look at the examples for DAQmx Analog Output.  They should be located here on your PC:

 

C:\Program Files (x86)\National Instruments\LabVIEW 20xx\examples\DAQmx\Analog Output

 

Adjust the path based on your version.  If you're using 64-bit, it will be in the regular "Program Files" folder (not x86).

Message 3 of 7
(779 Views)

You can also open the examples from the menu:  Help > Find Examples...

 

NIquist_0-1701719622083.png

 

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 4 of 7
(771 Views)

Thank you for your advice!
Based on your advice, I wrote it assuming a range of 0 to 10V with a standby time of 5 seconds and an output voltage increase of 1V each.
However, I did not get the desired result.
I would like your advice. Thank you very much.

 

0 Kudos
Message 5 of 7
(722 Views)

You are now trying to do something vastly more complicated than what you originally described.  I was trying to show you a dynamic DAQ voltage output that you could update in real time using a simple loop.  You have jumped way ahead of yourself in trying to create static waveform in an array.  That means you will have to handle the timing carefully.  I'm not really sure what you are doing with the math nodes and regeneration property nodes.

 

You will also need to build a proper state machine if you want to have the ability to modify the waveform parameters on the fly.  Your trick of stopping the inner generation loop and resetting the hardware may work, but it probably won't scale well.  I will have to find a DAQ card to try this out before I can give much help.  I would advise you to try to get a simple staircase waveform working before you go back to your current design.  It's almost like you jumped off a bike with training wheels and into the cockpit of a jet.  Take it one step at a time!

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 6 of 7
(689 Views)

Thank you very much.
In the attached file, is the program designed to increase the output voltage every 1V in the range of 0 to 10V with a standby time of 3 seconds? Please check.

0 Kudos
Message 7 of 7
(674 Views)