LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Increment Analog Output Voltage using DAQmx API in LabVIEW

Hello everyone,

 

I am trying to make a test program in which increments voltage as follows:

  • Output large voltage and wait 30 s.
  • Set it to 0 V (signaling the start of the test), and every 30 s, increment it by 1 mV, to 10 V.
  • Wait 30 s, and change it to 0 V to signal the end of the test.

 

I am new to LabView and DAQmx, are there any examples of a program which increments an analog output voltage of a specified interval?

 

Any guidance is greatly appreciated, thank you!

0 Kudos
Message 1 of 6
(1,675 Views)

Hi quadehowald,

 


@quadehowald wrote:

Hello everyone,

 

I am trying to make a test program in which increments voltage as follows:

  • Output large voltage and wait 30 s.
  • Set it to 0 V (signaling the start of the test), and every 30 s, increment it by 1 mV, to 10 V.
  • Wait 30 s, and change it to 0 V to signal the end of the test.

 

I am new to LabView and DAQmx, are there any examples of a program which increments an analog output voltage of a specified interval?


What about using a statemachine when you describe (atleast) 3 different states/steps in your test procedure!?

"Incrementing an output voltage" is the same as "incrementing a value in a loop": you may use a shift register to store a value to be used in the next iteration of a loop…

 

As you don't seem to know about shift registers (and from the way you spell LabVIEW) I think you really should take the "Training resources" as offered in the header of the LabVIEW board to actually learn LabVIEW!

 

Off-topic note: please stick to the default font and font size when writing messages here. No need to decrease the font size…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 6
(1,658 Views)

Thank you for your reply! I am new to visual programming interfaces. I like the idea of the using the state machine and shift registers. All I need to do is configure 1 analog output from 1 port to vary the output as mentioned above. For my case, I believe the best course would be to have 5 states, process 1 (set to large voltage, wait 30s), process 2 (set to 0V, wait 30s), process 3 ( increase previous voltage by 1mv every 30s until 10V is reached, using shift register?), process 4 (wait 30s and set to 0V signaling the end of the test). Do you know of any examples where this is done using the DAQmx library? 

 

Thanks again.

0 Kudos
Message 3 of 6
(1,617 Views)

Hi quade,

 


@quadehowald wrote:

For my case, I believe the best course would be to have 5 states, process 1 (set to large voltage, wait 30s),…


Create more states:

  • initialize DAQmx task
  • wait(30s) (no need to combine that wait into several states when it could be its own state)
  • de-init DAQmx task

 


@quadehowald wrote:

Do you know of any examples where this is done using the DAQmx library? 


You just need to learn from the examples coming with LabVIEW.

There are DAQmx examples and there is an example statemachine project…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 6
(1,614 Views)

So I've applied your recommendations and the attached is what I have come up with. What do you think @GerdW?

Download All
0 Kudos
Message 5 of 6
(1,580 Views)

Hi quade,

 


@quadehowald wrote:

What do you think @GerdW?


There are still several problems in your VI:

  • Why are there so many coercion dots in the vlock diagram? Why don't you use the correct datatypes far basic function inputs?
  • Why don't you use the enum typedef IN ALL PLACES? This is another source of coercion dots and also a source of more problems…
  • Why don't you use a separate "Wait" state?
  • Waiting for 30s without any options to interrupt/exit will give the user the impression your program is crashed!
  • What about a wait state, waiting for 1s? Then just call that state 30 times, but check an "Exit" button each time to give the user a way to end the program…
  • Why does your VI ends up in an endless loop once the "Array of steps" is empty? Why not just end your program in that case?
  • You don't need to unbundle the error "status", you can OR the error wire with your stop boolean…
  • BIG PROBLEM: Why do you stop/kill the DAQmx task in the "+1mV" state in the FOR loop???
  • This "+1mV" state should not contain that FOR loop: just call that state as long as there is no error, no stop, no limit reached! Right now this loop is set to iterate 10000 times, and each iteration will wait for 30s: you want your users to wait for 3½ days before they can operate that VI???
  • Frontpanel: why are the FP elements arranged like this? Why are there FP elements not visible immediately?
  • Frontpanel: Why is the FP origin moved out of sight? The origin should stay at the upper left corner as a "programming habit", otherwise you might get problems once you learn about subPanels…
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 6
(1,564 Views)