Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

independently control multiple channels of a power supply

Solved!
Go to solution

Given

  • Keithley 2230-30-1 triple channel power supply
  • necessary drivers

I've installed the Instrument Drivers and can control the device using the example VI provided by Keithley pictured below.

 

keithleycontroller.png

 

Unfortunately, I can only control one channel at a time. Say I set channel 1 voltage to 15V. When I switch to channel 2, the VI sets channel 2 voltage to 15V as well. If I change the channel 2 voltage to a desired voltage, say 7V and then switch back to channel 1, then the VI sets channel 1 voltage to 7V too. So I decided to make my own simple control VI pictured below.

 

mycontroller.png

 

Problem

my VI sorta won't work.

  • When I run continuously, I get the error below which I know is because I'm not "concluding" the bottom threads that control channel 1.
  • When I run with highlight executions, my VI works, albeit slowly.


Questions

  1. What gives? Why does the VI work in debug mode but not normal?
  2. Can I merge VISA resource names? I feel such a feature would enable me to "conclude" the bottom thread's VISA wire much like a conclude error bundle.
  3. Better yet, what's the proper way of wiring what I'm trying to do?
    I feel like my program doesn't work because I'm asking the PSU to read/write at the same time. Would placing channel 1 control and channel 2 control in sequence structures with 0 programmed delay enable me to "simultaneously" and independently control the 2 channels?

Many thanks!

 

 

 

0 Kudos
Message 1 of 6
(6,793 Views)
Solution
Accepted by topic author aeroAggie
The instrument and the physical interface does not support parallel operation. With highlight execution, you slow things down enough that it is actually running sequentially. Never, ever use the run continuous button except for special debug purposes. That is a major cause of your problem. If you want independent control, your VI could have an event structure that would change each channel when you click on a button you would have for each channel. Label then something like Ch 1 Update, Ch 2 Update, etc. This would have the added benefit of only writing once for each channel on a change instead of constantly hammering the instrument with commands like you are doing now. For operation without user intervention, you wire the functions sequentially. No need at all for a silly sequence structure. The error connections and resource name connections provides all of the dataflow.
Message 2 of 6
(6,781 Views)

I think I understand what you're saying, so I'll have to try out our recommendations tomorrow at the lab and post an update.

Thanks Dennis!

0 Kudos
Message 3 of 6
(6,756 Views)

Howdy Dennis,

I recreated a control scheme using event structures and a while loop. The event structure looks to see if the value of a channel 1 or 2 control has changed and acts accordingly without any errorsSmiley Happy.

controlv2.png

 

Questions

  1. Am I still constantly hammering the power unit with requests since I put everything inside a while loop?
    An experiment of my VI without the while loop leads me to say no because without it I'm just testing for a channel X change once and then exiting the VI.
  2. How can I streamline this?
    Everytime I change the desired voltage, the power unit resets and takes a couple of seconds to set the new voltage. Is this poor programming on my part or a hardware bottleneck?
    I even didn't implement the 1 second delay that Keithley had included in its example.

Many thanks!

0 Kudos
Message 4 of 6
(6,739 Views)
Solution
Accepted by topic author aeroAggie
The beauty of an event structure is that it does not execute anything inside until the actual event fires so your communication is no longer constantly sending. Yes, the while loop is required.

You are initializing the instrument with each event fired. The initializer function and any other code that should only be run once needs to be placed outside of the main while loop.

Also, create an event for the stop button.
0 Kudos
Message 5 of 6
(6,734 Views)

Dennis,

 

I figured out this problem thanks to your help. Could you help me out with another problem?
http://forums.ni.com/t5/Instrument-Control-GPIB-Serial/PID-control-of-power-supply/td-p/3164093

Thanks!

0 Kudos
Message 6 of 6
(6,623 Views)