From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, 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: 

Stop button to reset Keithley 2651

Hi, I am new to LabView. I wrote a simple program to control a Keithley 2651 power supply. At the moment, if I encounter an error in my process i have to use the abort button that leaves my power supply in on state stuck supplying the current specified in the run that had the error. This can be very dangerous as we use current in excess of 8 Amps. So, I want to include an emergency stop button that returns my powersupply to its reset state (off) on pressing.

 

Please help

 

Cheers

0 Kudos
Message 1 of 3
(2,613 Views)

Hi Tushki,

 

At the moment, if I encounter an error in my process i have to use the abort button

That's the main problem here!

 

Why did you program it this way? Why didn't you change it right now?

Use a statemachine approach instead of (nearly) endless running loops!

 

So, I want to include an emergency stop button that returns my powersupply to its reset state (off) on pressing.

That would be another state in your statemachine…

 

General note: Sometimes it helps to think about program design before starting to code… 😄

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 3
(2,608 Views)

Your loop can only stop if the stop button is FALSE and an error occurs in the VISA write of the FALSE case.. You also need to program some other exit strategies. 😄

To ensure a proper shutdown procedure, you need to hide the abort button and use an event structure to capture (and discard) window close events, so even if the user presses the X in the upper right, the correct voltages are set before the program ends itself.

 

You said you are a new programmer, so let me point out some other glaring problems:

  • You don't need that huge sequence structure, just wire the code of the second state after the while loop.
  • You don't need to create an array with many 1000 values, just divide by a scalar 1000, LabVIEW will do the rest for you automatically.
  • Don't call it a stop button if it does the exact opposite.
  • You need to pace the loop if nothing needs to be done. Place a small wait inside the loop.
  • Instead of continuously splitting an array in a shift register, leave it intact and use array subset to get a section based in [i]. (small FOR loop)
  • The shift register on the error is pointless if you don't wire to the inside left. There are better ways to disable autoindexing. (small FOR loop)
  • You are interacting with the same VISA device in parallel from two different inner loops. Don't you create potential conflicts or race conditions?
  • "The array-to-cluster-unbundle by name" is plain silly. You don't even set the cluster size. The entire thing can be replaced by "index array" resized to two outputs.
  • ...
Message 3 of 3
(2,587 Views)