Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Recording benchtop power supply output via LabVIEW

Solved!
Go to solution

I have a B&K Precision 1688B switching-mode power supply (0-18 V, 20 A max) in a test rig. I simply want to record (not control) its voltage and current output measurements with my rig's VI. The power supply has a USB port, but B&K does not have a LabVIEW driver for the device.

 

BK did make its own software (HCS operating software) to control this power supply. HCS offers datalogging services, but I'd like to record all my measurements into a single location using a single program.

 

Can LabVIEW use HCS' drivers to talk to my power supply? If so, how? BK offers HCS and USB COM drivers for the 1685B in the power supply's software page.

 

I'd rather not use high tolerance resistors, a new power supply, or an expensive new current probe just to record a measurement that an existing device is already making.

 

I'm using an 6361 DAQ along with a 2345 SCC connector block in my test rig.

0 Kudos
Message 1 of 9
(6,747 Views)

Go to the Docs & Software tab on that linked web page.  There is a Programming Manual listed.  Give that a good read and make your own driver set.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 9
(6,700 Views)

Yeah, looking at the manual you only need to send 1 command "GETD".  But you need to set the serial communications and line feed character properly.  Here's an example you could try..

BK168x_IV_Querry.png

 

 

 

0 Kudos
Message 3 of 9
(6,688 Views)

cstorey,

 

Thanks for the example! I can read the display voltage and current readings now, but the VI isn't very stable. Sometimes it just freezes before halting and throwing me a timeout error (Error -1073807339, hex 0xBFFF0015).

 

Here is BK's documentation for the GETD command:getd.PNG

 

 

That last OK part of the return message throws off my string processing, so I compare for an "OK" message after my read. If the read message isn't "OK\r", then I scan it. Otherewise, I ignore it.

 

I'm curious if this OK-check is getting thrown off by a not-OK situation (like if the power supply momentarily sends an error message as I vary the voltage). I tried checking for this by displaying the read buffer to the front panel, but these timed-out iterations just don't return anything and the read buffer string for a previous iteration doesn't indicate anything bad either.

 

Also, I want to incorporate this reading function into another VI where I'm reading voltage and current readings from a Tektronix oscilloscope using Tektronix' own drivers. Will the "Flush buffer" part of this code mess with Tektronix's code? Or does flushing only affect the referenced VISA instance?

0 Kudos
Message 4 of 9
(6,639 Views)

I think you can eliminate all the waits and flushes and just issue two successive VISA read commands, the first to catch the voltage/current/status and the second the OK message.  I missed that there was a termination character after the data and before OK.  So you need to read in a separate call, but you shouldn't issue the GETD command again, or else the PSU is probably throwing errors.

psu_reader_v1_cds.png

 

Try this.  (Edit to include the updated file!)

0 Kudos
Message 5 of 9
(6,629 Views)

What's in the other case of the case structure? I'm using LV 2016, so I can't use your snippet.

0 Kudos
Message 6 of 9
(6,622 Views)
Solution
Accepted by topic author aeroAggie

Here's a 2015 version that should open for you. 

 

The other case is just to handle errors if the reading is incomplete, since the VISA read returned <=5chars, which is more than OK\r but less than I/V/status, you kknow something is wrong.  Hopefully  you never use that case, but you can put in code to handle the error however you like; ignore, display a message, quit, etc..

 

Message 7 of 9
(6,616 Views)

I added a 50 ms wait at the beginning of the while loop so LV wouldn't ping the PSU too quickly. It seems stable so far, but I'll just have to run the new code with my test rig to find out. Thanks for your help cstorey!

0 Kudos
Message 8 of 9
(6,610 Views)

I have a similar problem, Is it ok if you can share your vi to write a voltage to the b&k precision 1697B power supply?

0 Kudos
Message 9 of 9
(4,816 Views)