Using GPIB Interface Sessions
Interface sessions allow direct, low-level control of the specified interface, but the programmer must provide all bus maintenance settings for the interface and must know the technical details about the interface. Also, when using interface sessions, interface-specific functions must be used. Thus, the program cannot be used on other interfaces and becomes less portable.
The subtopics are:
- SICL Functions for GPIB Interface Sessions
- Addressing GPIB Interfaces
- GPIB Interface Session Code Samples
SICL Functions for GPIB Interface Sessions
This section describes how some SICL functions are implemented for GPIB interface sessions.
Function |
Description |
iwrite |
Sends the specified bytes directly to the interface without performing any bus addressing. The iwrite function always clears the ATN line before sending any bytes, thus ensuring that the GPIB interface sends the bytes as data, not as command bytes. |
iread |
Reads the data directly from the interface without performing any bus addressing. |
itrigger |
Performs a broadcast GPIB group execute trigger (GET) without additional addressing. Use this function with igpibsendcmd to send a UNL followed by the appropriate device addresses. This will allow the itrigger function to be used to trigger multiple GPIB devices simultaneously. Passing the I_TRIG_STD value to the ixtrig function also causes a broadcast GPIB group execute trigger (GET). There are no other valid values for the ixtrig function. |
iclear |
Performs a GPIB interface clear (pulses IFC), which resets the interface. |
Addressing GPIB Interfaces
To create an interface session on your GPIB system, specify the particular interface logical unit or symbolic name in the addr parameter of the iopen function. The interface logical unit and symbolic name are set by running Connection Expert.
Opening Connection Expert
There are two methods to launch Connection Expert (CE):
From the Application Finder:
-
Open the Application Finder on your Linux machine.
-
Use any of the following ways to launch Connection Expert:
-
Search for Connection Expert and click to launch the application.
-
Or, search for IO Control and launch it. In the IO Control application, click on the Connection Expert application to it.
-
-
Open your preferred web browser.
-
Enter the URL in the format: https://<IP Address of the machine where IO Libraries Suite is installed>:4211.
For example: https://10.17.68.235:4211.
GPIB |
An interface symbolic name. |
hpib |
An interface symbolic name. |
gpib2 |
An interface symbolic name. |
IEEE488 |
An interface symbolic name. |
7 |
An interface logical unit. |
These code samples open an interface session with the GPIB interface.
C sample:
INST hpib;
hpib = iopen (“hpib”);
Visual Basic sample:
Dim hpib As Integer
hpib = iopen (“hpib”)
GPIB Interface Sessions Interrupts
There are specific interface session interrupts that can be used. See Writing GPIB Interrupt Handlers for more information.
GPIB Interface Sessions and Service Requests
GPIB interface sessions support Service Requests (SRQs). On the GPIB interface, when one device issues an SRQ, the library will inform all GPIB interface sessions that have SRQ handlers installed. See Writing GPIB Interrupt Handlers for more information.
GPIB Interface Session Code Samples
This section provides C language and Visual Basic language sample programs for GPIB interface sessions.
Sample: GPIB Interface Session (C)
/* gpibstat.c
This example retrieves and displays GPIB bus status information. */
#include <stdio.h>
#include <sicl.h>
main()
{
INST id; /* session id */
int rem; /* remote enable */
int srq; /* service request */
int ndac; /* not data accepted */
int sysctlr; /* system controller */
int actctlr; /* active controller */
int talker; /* talker */
int listener; /* listener */
int addr; /* bus address */
/* exit process if SICL error detected */
ionerror(I_ERROR_EXIT);
/* open GPIB interface session */
id = iopen(“gpib0”);
itimeout (id, 10000);
/* retrieve GPIB bus status */
igpibbusstatus(id, I_GPIB_BUS_REM, &rem);
igpibbusstatus(id, I_GPIB_BUS_SRQ, &srq);
igpibbusstatus(id, I_GPIB_BUS_NDAC, &ndac);
igpibbusstatus(id, I_GPIB_BUS_SYSCTLR,
&sysctlr);
igpibbusstatus(id, I_GPIB_BUS_ACTCTLR,
&actctlr);
igpibbusstatus(id, I_GPIB_BUS_TALKER,
&talker);
igpibbusstatus(id, I_GPIB_BUS_LISTENER,
&listener);
igpibbusstatus(id, I_GPIB_BUS_ADDR, &addr);
/* display bus status */
printf(“%-5s%-5s%-5s%-5s%-5s%-5s%-5s%-5s\n”,
REM”, “SRQ”,“NDC”, “SYS”, “ACT”,
“TLK”,“LTN”,“ADDR”);
printf(“%2d%5d%5d%5d%5d%5d%5d%6d\n”, rem, srq,
ndac, sysctlr, actctlr, talker, listener,
addr);
/* This call is no-op for WIN32 programs.*/
_siclcleanup();
return 0;
}
Sample: GPIB Interface Session (Visual Basic)
This section contains information specific to the Windows product.
‘gpibstat.bas
‘ The following example retrieves and displays
‘ GPIB bus status information.
Sub main ()
Dim id As Integer ‘ session id
Dim remen As Integer ‘ remote enable
Dim srq As Integer ‘ service request
Dim ndac As Integer ‘ not data accepted
Dim sysctlr As Integer ‘ system controller
Dim actctlr As Integer ‘ active controller
Dim talker As Integer ‘ talker
Dim listener As Integer ‘ listener
Dim addr As Integer ‘ bus address
Dim header As String ‘ report header
Dim values As String ‘ report output
‘ Open GPIB interface session
id = iopen(“gpib0”)
Call itimeout(id, 10000)
‘ Retrieve GPIB bus status
Call igpibbusstatus(id, I_GPIB_BUS_REM, remen)
Call igpibbusstatus(id, I_GPIB_BUS_SRQ, srq)
Call igpibbusstatus(id, I_GPIB_BUS_NDAC, ndac)
Call igpibbusstatus(id, I_GPIB_BUS_SYSCTLR,
sysctlr)
Call igpibbusstatus(id, I_GPIB_BUS_ACTCTLR,
actctlr)
Call igpibbusstatus(id, I_GPIB_BUS_TALKER,
talker)
Call igpibbusstatus(id, I_GPIB_BUS_LISTENER,
listener)
Call igpibbusstatus(id, I_GPIB_BUS_ADDR, addr)
‘ Display form1 and print results
form1.Show
form1.Print “REM”; Tab(7); “SRQ”; Tab(14);
“NDC”;
Tab(21);“SYS”; Tab(28); “ACT”; Tab(35); “TLK”;
Tab(42); “LTN”; Tab(49);“ADDR” form1.Print
remen;
Tab(7); srq; Tab(14); ndac; Tab(21);sysctlr;
Tab(28); actctlr; Tab(35); talker; Tab(42);
listener; Tab(49); addr
‘ Tell SICL to clean up for this task
Call siclcleanup
End Sub