LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VISA for BK Precision 1900B/1901B Power Supply

I have been away from the LabView environment for quite a while.  I have a couple of questions.  First, I'd like to state what appears to be obvious:

1.  It doesn't look like there is existing VISA code for this device.

 

Here are my questions regarding setting up a VISA resource for this equipment:

1.  Is there a VISA example that I could follow to get a sense as to how one might generate the code to interface with this Power Supply?

2.  Is there an NI resource I could use to learn how to set up VISA resources for this instrument?

 

BK Precision does have a software program that interfaces quite nicely with it, but I'll also need to run it in conjunction with another program for a load.  So, I need a single software program (i.e. LabView) to coordinate the work of both.  

 

Any help would be greatly appreciated.

 

0 Kudos
Message 1 of 11
(3,935 Views)

I think any of the VISA examples should be able to get you set up with connecting to, reading and writing from a VISA communication line.

 

The manual that you need to look at for the 1900B is its programming manual, found here: 1900B_Series_programming_manual.pdf

Chapter 1 lists the configuration details (baud rate, etc) and then near the end, chapter 3 gives the command set.

An excerpt is given here for easier reference (extra line breaks mine):

3 Command Set

Note: In order to use remote commands, please make sure to use the following communication settings - Baud rate: 9600, Data bits: 8, Parity: none, Stop bits: 1.

If you are using HyperTerminal, make sure to check your ASCII setup to not append line feeds.

Command line format:

COMMAND<parameter 1><parameter 2>...[CR]

Current value will have one decimal place for models 1687B, 1688B, 1900B, 1901B, and 1902B, and two decimal places for Model 1685B.

 

You can use this information together with the table that follows to build a driver fairly quickly/easily. You may also not need all of the functionality, so if a full driver isn't really required, you can just create a couple of VIs for the commands that you need, and ignore the rest.

 

I attach a very basic example for the Init and Set Voltage VIs that I might imagine using. You could instead use LV-OOP if you're comfortable with objects, to hide the VISA Reference, or additional VIs to build the messages to avoid difficulties ensuring the correct line endings and so on, but this hopefully gives you a brief idea.


GCentral
Message 2 of 11
(3,912 Views)

Thank you, CB.  This gives me enough information to be dangerous.  I can figure out the write commands for the Power Supply, and at least I no longer get a timeout error, I just need to figure out the RTN commands to make sure that the Power Supply is understanding the commands properly.

The information you provided was great.  Thanks for entertaining it.  Would you be so kind to provide a "Read" example?  That would help me immensely.

 

Shane  

0 Kudos
Message 3 of 11
(3,815 Views)

Sorry - forgot the returned values!

Here's an updated project with an extra VI. Check the block diagram comments and then you'll be set - I don't *think* the termination character is included in the returned string from VISA Read, but I can't remember for sure...

I saved for 2015 this time, don't remember which version I used last time. Is 2015 OK?

 

Edit: On the Read VI, if you use the For loop you'll need to wire a 2 to N, otherwise you'll get a broken run arrow since there's no auto-indexing...


GCentral
Message 4 of 11
(3,791 Views)

Thank you so much.  I'm not sure if 2015 is ok or not.  I'm using 2017.  I'm assuming the majority of functions should still be the same between the two.

 

Shane

0 Kudos
Message 5 of 11
(3,757 Views)

A quick question.  How did you know to use size 10 for the read function of the byte count for the Get Current and Voltage VI?

 

Shane

0 Kudos
Message 6 of 11
(3,750 Views)

I don't recall the manual exactly (and have poor connection right now to redownload and check) but basically any time you have a working termination character you can just set the bytes to read to a large number (100, 500, etc, anything more than what you will actually read) and then it will read each time to the termination character and stop.

 

If I set it to just 10, I assume the message length it was configured for is only a few characters and so 10 is "much more" than the expected length


GCentral
Message 7 of 11
(3,714 Views)

Gotcha.  That sounds like a pretty smart thing to do when you're not intimately familiar with the system.  Thank you!  I'll check this code out.  There seems to be some interesting things to go over here.

 

Shane

0 Kudos
Message 8 of 11
(3,682 Views)

Quick question on your code regarding the "Format Into Strong" function.  You wrote in "VOLT%03d\r"  Isn't "VOLT" the initial string in this case?  So, shouldn't the format string simply tell the function the output format of the string (i.e. "%04s%03d\r")?  And, should the initial string be "VOLT".  Or is what you wrote considered a shortcut that is an acceptable substitution?    Sorry if this appears to be very basic.  Thank you for your help!

 

Shane

0 Kudos
Message 9 of 11
(3,672 Views)

Yup, the initial string input is just a convenience you might use if it (or the format string) was being created programmatically in another part of your code.  In your case either way is fine.

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019 - Unfortunately now moving back to C#, .NET, Python due to forced change to subscription model by NI. 8^{
Message 10 of 11
(3,668 Views)