From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Power Supply Control/Monitor

Solved!
Go to solution

Hi,

 

I am creating a program that will be able to control a power supply as well as continuously read the output current from the supply.  I created my program such that I have a loop that will handle user events (i.e. user command turning on/off the power supply) and a loop that charts measurements to a live graph, one being the power supply output current.

 

How can I continuously monitor the power supply current while still being able to command it?  What is the best method for doing this? Thanks,

0 Kudos
Message 1 of 4
(2,286 Views)
Solution
Accepted by topic author ANON12345

Create a loop that continually writes the data requests to the port and receives the responses.  For when you want to command it, use a case structure so that after getting the current data, it can write and/or read any commands you send to it.

Message 2 of 4
(2,275 Views)

There are lots of really interesting ways to approach this, but you are generally on the right track with parallel loops.

 

RavensFan is suggesting something like a state machine, which is either asking for current current, telling the power supply to do something or one and then the other. This design is pretty solid and is a good design to practice.

 

We could imagine further states like wait for connection or shutdown. The essential ingredients is a while loop with a case structure inside and an enum on a shift register. The enum controls which case of a case structure is executed on each iteration. The default state could be an event structure with a fast timeout asking if the user has sent a command, if command, then operate appropriate case in the next iteration using the enum, if timeout, then set the next state to ask the power supply what the current is. And so on. The use of the event structure gives you a lot of granularity in response to pressing different front panel buttons.

CLA - Kudos is how we show our appreciation for comments that helped us!
Message 3 of 4
(2,260 Views)

An event driven state machine is the obvious architecture for this. 

 

Basically you measure and display the current until a user event tells it to change or turn off/on the power. 

========================
=== Engineer Ambiguously ===
========================
Message 4 of 4
(2,238 Views)