Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Control a GPIB device using Liberty Basic for Windows

I am looking for some help getting my NI GPIB board to work with Liberty Basic for Windows. I can control the GPIB devices using NI MAX control, so the setup is ok. Liberty Basic supports calls to dll's, so it looks like it should work. 

Has anyone used Liberty Basic with NI GPIB card?

Here is what the Liberty Basic help has on dll's:

 

CALLDLL #handle, "function", param1 as type1 [, param2 as type2 ], return as returnType

Description:

CALLDLL is used to call functions from the Windows API or from a third party DLL.  A DLL is a Dynamic Link Library, which is a module containing functions that can be called by a program while it is running.  The functions are specific to the DLL.  The documentation for the DLL will contain the information needed to call its functions.

#handle

This parameter is the handle that was given to the DLL when it was opened with the OPEN statement.

"function"

This parameter is the name of the function, enclosed in quotes.  It is case-sensitive.

param1 as type1 [, param2 as type2 ]

This is a list of input parameters required by the function.  The number and TYPE of input parameters is dependent upon the function being called. These parameters send information to the function so that it knows how to perform its task as needed by the program.  These parameters must be passed AS TYPE.  See Using Types with STRUCTS and CALLDLL for details. The parameters will include information such as window or control handles, text strings to display, and so on.

return as returnType

This parameter contains the value returned by the function.  It must also be of the correct TYPE expected by the function.  If a function does not return a value, this parameter is passed AS VOID.

Usage:

This example calls the WINDOWS API to minimize a window and change its caption.

    open "An Example" for window as #main

    h = hwnd(#main)

    open "user32" for dll as #user

    calldll #user, "CloseWindow", _

        h as long, _

        result as boolean

    calldll #user, "SetWindowTextA", _

        h as long, _

        "I was minimized!" as ptr, _

        result as void

    close #user

 

I am looking basic communication help to get started. Just being able to send *idn? query and get a answer back would help.

 

Thanks

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

Hi PaulEDC,

 

I'm not very familiar with Liberty Basic, but I wanted to point you to the following document on GPIB Language Interfaces that you can adapt. Have you tried calling into the ni4882.dll or the gpib-32.dll as yet? Does anyone else have experience with the GPIB interface in Liberty Basic?

Best Regards,
Swathi B
0 Kudos
Message 2 of 2
(3,542 Views)