Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

using NI interface under Liberty Basic

Looking to control my SPD1168X power supply using Liberty basic as part of automated product test. Is this possible, and how do I do it?

I found power supply commands in the manual, but are NI interface dll's needed to interface with Liberty Basic? Or am I making this over complicated and the power supply simply does serial IO?

0 Kudos
Message 1 of 13
(4,595 Views)

Were you expecting us to locate, download, and read the power supply manual?

 

At least have the courtesy to post a link to it if you want us to answer questions that pertain to equipment.

0 Kudos
Message 2 of 13
(4,497 Views)

You can call a shared library (dll) functions from your basic code:

http://www.libertybasicuniversity.com/lb4help/C2ASGG.htm

(I haven't seen on this page any examples showing how to pass a pointer, array or string variable to a dll, you will need to find it somewhere else)

 

With NI boards you can use either gpib32.dll  or NI4882.dll or visa32.dll (usually all installed with NI interfaces, but I would recommend visa).

 

https://www.ni.com/docs/en-US/bundle/ni-visa/page/user-manual-welcome.html

https://www.ni.com/docs/en-US/bundle/321819e/resource/321819e.pdf

https://www.keysight.com/upload/cmc_upload/All/IO_Libraries_Suite_15_visa.pdf

 

 

 

0 Kudos
Message 3 of 13
(3,282 Views)

Already looked at these resources, the Liberty Basic help just explains how to interface to dlls in general. The VISA manuals do not have specifics on commands/arguments. There are just the function calls to do things with no specific explanation of what is actually being passed to the dll by the function. For Liberty Basic I need exact command name/data format, count of arguments and type to use their generic dll interface.

0 Kudos
Message 4 of 13
(3,128 Views)

I see how my initial question/lack of knowledge how a NI connection works could generate one snarking comment. I have resubmitted by query to be more specific question on the VISA32.dll interface. Hoping for better luck this time on hearing some useful information.

0 Kudos
Message 5 of 13
(3,125 Views)

The VISA manuals do not have specifics on commands/arguments. There are just the function calls to do things with no specific explanation of what is actually being passed to the dll by the function. For Liberty Basic I need exact command name/data format, count of arguments and type to use their generic dll interface.

I don't know which Visa manuals you were using (don't remember the refs I cited last time), I do find all the information about function arguments in the official reference manual: 

https://www.ni.com/docs/en-US/bundle/ni-visa/page/user-manual-welcome.html). It also gives the command syntax for Visual Basic (VB6 I suppose), but it might not be helpful if you don't know VB6 data types, I usually start with the C definition and try to find the equivalent data types in the language where I want to import the function.  The floats and integers are easy because they have a standard format, but passing strings may be tricky as varios languages may have different representations. The dll relies on standard C strings which are just pointers to null-terminated arrays (google for "C string" - and skip the sexy stuff 🙂 ). 

 

You need to have a basic understanding of GPIB to understand all the functions described in this manual (NB. the same commands can be used for Visa connections via USB and TCPIP since the protocols used for them basically mimic the GPIB).

But basically you will only need the following functions:

 

At startup: viOpenDefaultRM to initiate Visa, then viOpen to connect to your device (will return a device identifier needed in all subsequent I/O calls);

then ViWrite and viRead to communicate;

and finally viClose to disconnect the device where you are done.

 

I can't help you with Liberty Basic stuff but don't hesitate to ask if you have questions about using these Visa functions.

Hope it helps

 

 

0 Kudos
Message 6 of 13
(3,102 Views)
The VISA manuals do not have specifics on commands/arguments. There are just the function calls to do things with no specific explanation of what is actually being passed to the dll by the function. For Liberty Basic I need exact command name/data format, count of arguments and type to use their generic dll interface.

I don't know which Visa manuals you were using (don't remember the refs I cited last time), I do find all the information about function arguments in the official reference manual: 

https://www.ni.com/docs/en-US/bundle/ni-visa/page/user-manual-welcome.html). It also gives the command syntax for Visual Basic (VB6 I suppose), but it might not be helpful if you don't know VB6 data types, I usually start with the C definition and try to find the equivalent data types in the language where I want to import the function.  The floats and integers are easy because they have a standard format, but passing strings may be tricky as varios languages may have different representations. The dll relies on standard C strings which are just pointers to null-terminated arrays (google for "C string" - and skip the sexy stuff 🙂 ). 

 

You need to have a basic understanding of GPIB to understand all the functions described in this manual (NB. the same commands can be used for Visa connections via USB and TCPIP since the protocols used for them basically mimic the GPIB).

But basically you will only need the following functions:

 

At startup: viOpenDefaultRM to initiate Visa, then viOpen to connect to your device (will return a device identifier needed in all subsequent I/O calls);

then ViWrite and viRead to communicate;

and finally viClose to disconnect the device where you are done.

 

I can't help you with Liberty Basic stuff but don't hesitate to ask if you have questions about using these Visa functions.

Hope it helps

0 Kudos
Message 7 of 13
(3,102 Views)

I don't know which Visa manuals you were using (don't remember the refs I cited last time), I do find all the information about function arguments in the official reference manual: https://www.ni.com/docs/en-US/bundle/ni-visa/page/user-manual-welcome.html). It also gives the command syntax for Visual Basic (VB6 I suppose), but it might not be helpful if you don't know VB6 data types, I usually start with the C definition and try to find the equivalent data types in the language where I want to import the function.  The floats and integers are easy because they have a standard format, but passing strings may be tricky as various languages may have different representations. The dll relies on standard C strings which are just pointers to null-terminated arrays (google for "C string" - and skip the funny stuff 🙂 ). 

 

You need to have a basic understanding of GPIB to understand all the functions described in this manual (NB. the same commands can be used for Visa connections via USB and TCPIP since the protocols used for them basically mimic the GPIB).

But basically you will only need the following functions:

 

At startup: viOpenDefaultRM to initiate Visa, then viOpen to connect to your device (will return a device identifier needed in all subsequent I/O calls);

then ViWrite and viRead to communicate;

and finally viClose to disconnect the device where you are done.

 

I can't help you with Liberty Basic stuff but don't hesitate to ask if you have questions about using these Visa functions.

Hope it helps

0 Kudos
Message 8 of 13
(3,107 Views)

oops, sorry, I think the server has a problem, first it didn't want to show my answers, now it dug out all my trials but doesn't allow me to delete them 🙂

0 Kudos
Message 9 of 13
(3,098 Views)

Still trying to interface VISA32 dll with Liberty Basic.

 

In Liberty Basic, when I use the LabJack dll, this is what I do:

 

open "ljackuw.dll" for dll as #lj      ' start LabJack.dll access

calldll #lj, "GetFirmwareVersion", gv as struct, reply as double     ' get Labjack version

 

So in the NI-VISA Programmer Reference Manual, there are call special functions such as:

viOpen( ...), ViOpenDefaultPM( ...)

 

The parameters ... are well defined in this manual, but are "viOpen" or "viOpenDefaultPM" the strings I should be sending the dll to access these functions?

0 Kudos
Message 10 of 13
(3,052 Views)