IOtech 488 quick reference guide

0 (0)
GPIB-488

GPIB-488 Programming Reference Manual

Programming Reference Manual
July 2006
371930C-01
© Copyright 1996-2006 by Measurement Computing Corporation’s licensor(s). All rights reserved.
Support

Conventions

[ ] Square brackets indicate the key to be pressed.
» The » symbol leads you through nested menu items and dialog box options
to a final action. The sequence File»Page Setup»Options directs you to
pull down the File menu, select the Page Setup item, and select Options
from the last dialog box.
This icon denotes a note, which alerts you to important information.
This icon denotes a caution, which advises you of precautions to take to
avoid injury, data loss, or a system crash.
When symbol is marked on a product, it denotes a warning advising you to
take precautions to avoid electrical shock.
When symbol is marked on a product, it denotes a component that may be
hot. Touching this component may result in bodily injury.
bold Bold text denotes items that you must select or click in the software, such
as menu items and dialog box options. Bold text also denotes parameter
names.
italic Italic text denotes variables, emphasis, a cross reference, or an introduction
to a key concept. Italic text also denotes text that is a placeholder for a word
or value that you must supply.
monospace Text in this font denotes text or characters that you should enter from the
keyboard, sections of code, programming examples, and syntax examples.
This font is also used for the proper names of disk drives, paths, directories,
programs, subprograms, subroutines, device names, functions, operations,
variables, filenames, and extensions.
GPIB terms used within this manual are:
GPIB General Purpose Interface Bus
System controller The system controller has the unique ability to retrieve active control of the
bus or to enable devices to be remotely programmed. It takes control of the
bus by issuing an IFC (Interface Clear) message for at least 200 µsec. It also
can put devices into the remote state by asserting the REN (Remote Enable)
line.
There is always one system controller in a GPIB system. The system
controller is designated at system initialization either through the use of
hardware switches or by some type of configuration software, and is not
changed. The system controller can be the same controller as the one which
is the current active controller or an entirely different one. Note that if a
controller is both a system controller and the active controller and it passes
control to another controller, the system controller capability is not passed
along with it.
Active controller The active controller is the controller which has the ability to mediate all
communications which occur over the bus. In other words, the active
controller designates (addresses) which device is to talk and which devices
are to listen. The active controller is also capable of relinquishing its
position as active controller and designating another controller to become
the active controller.
Device A device is any IEEE-488 instrument which is not a system controller or
active controller. It can be idle or act as a talker and/or listener when
addressed or unaddressed by the active controller.
Listener A listener is any device which is able to receive data when properly
addressed. There can be up to 14 active listeners on the bus concurrently.
Some devices can also be a talker or controller; however, only one of these
functions can be performed at a time.
Talker A talker is a device which can transmit data over the bus when properly
addressed. Only one device can transmit at a time. Some devices can also
be a listener or controller; however, only one of these functions can be
performed at a time.
GPIB-488 v Programming Reference Manual

Contents

Chapter 1
GPIB Software Overview
Supported Languages.....................................................................................................1-1
GPIB Library Utility Programs......................................................................................1-2
Support For VISA Calls ..................................................................................1-2
GPIB-32.DLL function support.......................................................................1-2
ibnotify ............................................................................................................1-2
Chapter 2
Programming with the GPIB Library
General Concepts...........................................................................................................2-2
Device vs. Board I/O .......................................................................................2-2
Device I/O .......................................................................................................2-2
Board l/O .........................................................................................................2-3
Device Handles................................................................................................2-3
Global Variables ...............................................................................2-4
iberr—The Error Variable.................................................................2-4
ibcnt and ibcntl—Count Variables....................................................2-4
Chapter 3
GPIB 488.1 Library Reference
IBASK ...........................................................................................................................3-3
IBCAC ...........................................................................................................................3-6
IBCLR............................................................................................................................3-7
IBCMD ..........................................................................................................................3-8
IBCMDA .......................................................................................................................3-10
IBCONFIG..................................................................................................................... 3-11
IBDEV ...........................................................................................................................3-15
IBDMA ..........................................................................................................................3-17
IBEOS............................................................................................................................3-18
IBEOT............................................................................................................................3-20
IBFIND ..........................................................................................................................3-21
IBGTS............................................................................................................................3-22
IBIST .............................................................................................................................3-24
IBLINES ........................................................................................................................3-25
IBLN ..............................................................................................................................3-27
IBLOC ...........................................................................................................................3-28
IBONL ...........................................................................................................................3-29
Contents
Programming Reference Manual vi GPIB-488
IBPAD ...........................................................................................................................3-30
IBPCT............................................................................................................................3-31
IBPPC............................................................................................................................ 3-32
IBRD.............................................................................................................................. 3-34
IBRDA...........................................................................................................................3-36
IBRDF ...........................................................................................................................3-37
IBRPP............................................................................................................................ 3-39
IBRSC............................................................................................................................ 3-40
IBRSP............................................................................................................................ 3-41
IBRSV ...........................................................................................................................3-42
IBSAD ...........................................................................................................................3-43
IBSIC............................................................................................................................. 3-44
IBSRE............................................................................................................................3-45
IBSTOP ......................................................................................................................... 3-46
IBTMO .......................................................................................................................... 3-47
IBTRG ...........................................................................................................................3-49
IBWAIT......................................................................................................................... 3-50
IBWRT .......................................................................................................................... 3-52
IBWRTA ....................................................................................................................... 3-54
IBWRTF........................................................................................................................ 3-55
Chapter 4
GPIB 488.2 Library Reference
AllSpoll.......................................................................................................................... 4-2
DevClear........................................................................................................................4-3
DevClearList.................................................................................................................. 4-4
EnableLocal................................................................................................................... 4-5
EnableRemote................................................................................................................ 4-6
FindLstn......................................................................................................................... 4-7
FindRQS........................................................................................................................ 4-8
PassControl.................................................................................................................... 4-9
Ppoll............................................................................................................................... 4-10
PPollConfig ................................................................................................................... 4-11
PPollUnconfig ............................................................................................................... 4-12
RcvRespMsg.................................................................................................................. 4-13
ReadStatusByte.............................................................................................................. 4-14
Receive .......................................................................................................................... 4-15
ReceiveSetup ................................................................................................................. 4-16
ResetSys ........................................................................................................................4-17
Send ...............................................................................................................................4-18
SendCmds...................................................................................................................... 4-19
SendDataBytes .............................................................................................................. 4-20
SendIFC.........................................................................................................................4-21
Contents
GPIB-488 vii Programming Reference Manual
SendList .........................................................................................................................4-22
SendLLO........................................................................................................................4-23
SendSetup ......................................................................................................................4-24
SetRWLS .......................................................................................................................4-25
TestSRQ.........................................................................................................................4-26
TestSys...........................................................................................................................4-27
Trigger ...........................................................................................................................4-28
TriggerList .....................................................................................................................4-29
WaitSRQ........................................................................................................................4-30
Appendix A
Multiline Interface Messages
Appendix B
IBSTA
Appendix C
IBERR
GPIB-488 1-1 Programming Reference Manual
1
GPIB Software Overview
The GPIB software includes the 488.1 library, the 488.2 library, and a set
of utility programs. The 488.1 library consists of all of the functions and
subroutines that begin with the letters "
ib". The 488.1 library routines refer
to devices on the GPIB bus by their device names and handles rather than
by their GPIB addresses.
The 488.2 library consists of all the routines that do not begin with the
letters "
ib". The 488.2 library routines refer to devices on the GPIB
bus by their GPIB addresses rather than by their names or handles.
Note The GPIB library is available only in a 32-bit version.

Supported Languages

The GPIB library provides identical routines for each supported language.
Languages supported by the GPIB library at the time this manual was
published are listed below.

Table 1-1. Programming Languages

Programming Languages
Delphi
C
VB
Chapter 1 GPIB Software Overview
Programming Reference Manual 1-2 GPIB-488

GPIB Library Utility Programs

The following utility programs are installed with the GPIB library
software.

Support For VISA Calls

VISA (Virtual Instrument Software Architecture) drivers are command
drivers that convert company and program-independent VISA calls into
company-dependent calls.

GPIB-32.DLL function support

Each library function defined by GPIB 488.1 and GPIB 488.2 has a
corresponding entry point in
gpib-32.DLL.

ibnotify

The GPIB library does not support ibnotify. Applications that utilize the
ibnotify function will not run properly.
Utility program Description
GPIBDIAGNOSTIC.EXE
Hardware test program (Win32)
GPIBINTERACTIVECONTROL.EXE
Interactive control program (Win32)
GPIBCONFIGURATION.EXE
Configuration utility program (Win 32)
GPIB-488 2-1 Programming Reference Manual
2
Programming with the GPIB
Library
The GPIB library contains two different and complete GPIB libraries.
Original 488.1 library—The 488.1 library (also referred to as the original
library), consists of all of the functions and subroutines that begin with the
letters "
ib". This library uses a concept of device names and handles rather
than GPIB addresses when referring to GPIB devices. There are two
advantages to this approach:
The GPIB addresses of each device are not stored in the program, so
the same program can run on different buses where the addresses of
each device are different.
The program can refer to each device with an intelligible name rather
than a number (the GPIB address).
488.2 library—This library consists of all the routines that do not begin
with the letters "
ib". These routines refer to all devices on the bus by their
GPIB addresses rather than by names. The Device I/O section does not
apply to the 488.2 library.
The GPIB library includes different routines that allow you to control the
operations of the GPIB bus in a very specific manner. You may find the
number of routines included in the GPIB library intimidating, however, in
most applications you need to use only a small subset of these routines.
The routines are divided into two distinct libraries. All routines which begin
with "
ib" are part of the "488.1" or "Original GPIB library." All other
routines are part of the "488.2 library." You only need to use one or the
other library. Each library provides a different method of performing the
same tasks. The choice of which library to use is a matter of personal
preference. If you use the original GPIB library, you can perform either
Board Level or Device Level operations.
Chapter 2 Programming with the GPIB Library
Programming Reference Manual 2-2 GPIB-488

General Concepts

This section explains the difference between routines which use Device I/O
and those which use Board I/O, the use of device handles, and the global
variables used by the library routines.

Device vs. Board I/O

The most typical GPIB operations are sending commands to a device
attached to the bus and reading back responses. To do this, program the
GPIB board to execute these steps:
1. Address the selected device as a Listener.
2. Send the secondary address if used.
3. Address the board itself as the GPIB Talker.
4. Send the command bytes to the device.
5. Address the board itself as the Listener.
6. Read the response from the device.
7. Send the GPIB Unlisten (UNL) message.
8. Send the GPIB Untalk (UNT) message.
The original GPIB library interface is comprised of two different types of
routines: Board I/O and Device I/O. These routines are described in
Chapter 3, GPIB 488.1 Library Reference. You can program the board
using either Board I/O routines or Device I/O routines to perform the
sequence of operations outlined above.
The 488.2 library is all "Board I/O" in that you always supply the board ID
and the device address. Refer to Chapter 4, GPIB 488.2 Library Reference.

Device I/O

It is usually easier to use the Device I/O routines. Device I/O is very simple
to use and understand. Device I/O routines are higher-level routines which
conceal most of the underlying complexity of GPIB operations. The Device
I/O routines automatically take care of all of the low-level details involving
GPIB messages and addressing. For example, to accomplish the seven
steps listed above, you use only three routines:
ibdev—to open the device
ibwrt—to send the instrument command
ibrd—to read the data back from the device
Chapter 2 Programming with the GPIB Library
GPIB-488 2-3 Programming Reference Manual

Board l/O

In comparison, the Board I/O routines are low-level routines. If you use
them, you must understand how the GPIB operates in detail. Generally, the
only time you need to use Board I/O is if it is impossible to perform the
same operation using device I/O, such as passing control from one
controller to another.
To perform the same task as the seven steps outlined in Device vs. Board
I/O (send a command to a device), you need to know the codes for the
various forms of addressing and the codes for the GPIB Unlisten and
Untalk commands.
Use the routines in this sequence:
ibfind—to open the board
ibcmd—to send the address of the talker and listener
ibwrt—to send the command to the device
ibcmd—to send the address of the talker and listener
ibrd—to read the data back from the device
ibcmd—to send the Unlisten (UNL) and Untalk (UNT) commands

Device Handles

Most of the routines in the 488.1 library have a device handle as the first
argument. The first GPIB call in your program is usually
ibfind. This
routine "opens" a board or device and returns a GPIB board or device
handle. If you pass the name of a board, it returns a board handle. Likewise,
if a device name is passed, a device handle is returned. Some library
routines only work with device handles, some only with board handles, and
some with both.
Chapter 2 Programming with the GPIB Library
Programming Reference Manual 2-4 GPIB-488
Global Variables
The following global variables are used in all programming languages:
ibsta Status Word
iberr Error Codes
ibcnt, ibcntl Count Variables (short/long)
The
iberr variables are briefly explained here. For additional information
about
iberr, refer to Appendix C, IBERR.
For additional information about
ibcnt and ibcntl, refer to the routines
which return them.
iberr—The Error Variable
If a GPIB error occurs during a routine, its corresponding error code is
returned into the variable
iberr. Possible error codes and their meanings
are listed in Appendix C, IBERR.
ibcnt and ibcntl—Count Variables
These variables contain an integer which describes how many bytes were
actually transferred during a read or write operation.
ibcnt is an integer
value (16-bits wide) and
ibcntl is a long integer value (32-bits wide).
GPIB-488 3-1 Programming Reference Manual
3
GPIB 488.1 Library Reference
This chapter describes each of the 488.1 GPIB library routines. A short
description of the routine, its syntax, parameters, any values that are
returned, any special usage notes, and an example are included for each
routine. The routines are listed in alphabetical order. The following table
lists all of the 488.1 GPIB library routines. A full description of each
routine follows the table.

Table 3-1. 488.1 Library routines

Name Description
ibask
Returns software configuration information
ibcac
Become Active Controller
ibclr
Clear specified device
ibcmd
Send GPIB commands from a string
ibcmda
Send GPIB commands asynchronously from a string
ibconfig
Configure the driver
ibdev
Open and initialize a device when the device name is unknown
ibdma
Enable/Disable DMA
ibeos
Change EOS
ibeot
Change EOI
ibfind
Open a device and return its unit descriptor
ibgts
Go from Active Controller to standby
ibist
Define IST bit
iblines
Return status of GPIB bus lines
ibln
Check for presence of device on bus
ibloc
Go to Local
ibonl
Place device online/offline
Chapter 3 GPIB 488.1 Library Reference
Programming Reference Manual 3-2 GPIB-488
ibpad
Change Primary address
ibpct
Pass Control
ibppc
Parallel Poll Configure
ibrd
Read data to a string
ibrda
Read data asynchronously
ibrdf
Read data to file
ibrpp
Conduct parallel poll
ibrsc
Request/release system control
ibrsp
Return serial poll byte
ibrsv
Request service
ibsad
Define secondary address
ibsic
Send IFC
ibsre
Set/clear REN line
ibstop
Stop asynchronous I/O operation
ibtmo
Define time limit
ibtrg
Trigger selected device
ibwait
Wait for event
ibwrt
Write data from a string
ibwrta
Write data asynchronously from a string
ibwrtf
Write data from file
Table 3-1. 488.1 Library routines (Continued)
Name Description
Chapter 3 GPIB 488.1 Library Reference
GPIB-488 3-3 Programming Reference Manual

IBASK

Returns software configuration information.
Syntax
C ibask (int boarddev, int option, unsigned int
*value)
Parameters
boarddev A board handle or device handle
option Specifies which configuration item to return; see Table.
value Current value of specified item returned here

Table 3-2. ibask Options

Option Valid for Information returned
IbaPAD bd/dev
Primary address of board or device
IbaSAD bd/dev
Secondary address of board or dev
IbaTMO bd/dev
The current timeout value for I/O commands (refer to
ibtmo for a list of possible values)
IbaEOT bd/dev
0 = EOI asserted at end of write
non zero = EOI is not asserted at end of write
IbaPPC bd
The current parallel poll configuration of the board
IbaREADDR dev
0 = Forced re-addressing is disabled
non zero = Forced re-addressing is enabled.
IbaAUTOPOLL bd
0 = automatic at end of write
non zero = automatic serial poll is disabled
IbaCICPROT bd
0 = CIC protocol is disabled
non zero = CIC protocol is enabled
IbaSC bd
0 = board is not system controller
non zero = board is system controller
IbaSRE bd
0 = do not automatically assert REN line when system
controller
non zero = automatically assert REN line when system
controller
Chapter 3 GPIB 488.1 Library Reference
Programming Reference Manual 3-4 GPIB-488
IbaEOSrd bd/dev
0 = ignore EOS char during reads
non zero = terminate read when EOS char is received
IbaEOSwrt bd/dev
0 = don’t assert EOI line when EOS char is sent
non zero = assert EOI line whenever EOS char is sent
IbaEOScmp bd/dev
0 = 7 bit compare is used when checking for EOS char
non zero = 8 bit compare is used when checking for EOS
char
IbaEOSchar bd/dev
0 = The current EOS char of board or device
IbaPP2 bd
0 = board is in remote parallel poll configuration
non zero = board is in local parallel poll configuration
IbaTiming bd
Current T1 timing delay 1 = Normal (2 us), 2 = High
Speed (500 ns), 3 = Very High Speed (350 ns)
IbaDMA bd
0 = The interface does not use DMA for GPIB transfers
non zero = The interface uses DMA for GPIB transfers
IbaSendLLO bd
0 = LLO command is not sent when device is put online
non zero = LLO command is sent
IbaSPollTime dev
Length of time to wait for parallel poll response before
timing out
IbaPPollTime bd
Length of time to wait for parallel port response
IbaEndBitIsNormal bd
0 = The END bit of ibsta is not set when the EOS
character is received without EOI.
non zero = The END bit of ibsta is set when the EOS
character is received
IbaUnAddr dev
0 = The untalk and unlisten (UNT, UNL) are not sent after
each device level read/write
non zero = The UNT, UNL commands are sent after each
device lever read/write
IbaIST bd
The individual status (ist) bit of the interface
IbaBNA dev
Device’s access board
Table 3-2. ibask Options (Continued)
Option Valid for Information returned
Chapter 3 GPIB 488.1 Library Reference
GPIB-488 3-5 Programming Reference Manual
Returns ibsta will contain a 16-bit status word; refer to Appendix B,
IBSTA.
iberr will contain an error code if an error occurred
value will contain the current value of selected configuration
item
Usage notes Some options apply to boards, some to devices and some apply to
both boards and devices.
A program may modify many of these configuration items via
library routines (for example,
ibtmo, ibeos, etc.). In that case,
ibask returns the modified version.
Example Returns the
ist bit of a device at PAD 3.
C int dev, istbit;
dev = ibdev (0,3,0,13,1,0);
ibask (dev, IbaIST, &istbit);
Chapter 3 GPIB 488.1 Library Reference
Programming Reference Manual 3-6 GPIB-488

IBCAC

Makes the specified board the Active Controller.
Syntax
C ibcac (int board, int sync)
Parameters
board is an integer containing the board handle
sync specifies if the GPIB board is to take control synchronously or asynchronously. If sync
is 0, the GPIB board takes control asynchronously. Otherwise, it takes control synchronously
(immediately).
When the board takes control, the GPIB interface board asserts the ATN line. When taking
control synchronously, the board waits for any data transfer to be completed and then takes
control. Note that if synchronous take control is specified while an
ibrd or ibwrt operation
is in progress, the synchronous take control may not occur if a timeout or other error occurs
during the
ibrd/ibwrt.
In comparison, if the board is to take control asynchronously, it takes control immediately,
without waiting for any data transfers to be completed.
Returns
ibsta will contain a 16-bit status word as described in Appendix B, IBSTA.
iberr will contain an error code, if an error occurred. In particular, the ECIC error occurs if
the specified GPIB board cannot become an Active Controller.
Usage Notes
This routine is only used when doing board level I/O.
Example
GPIB board 1 takes control asynchronously.
C ibcac (brd1, 0);
Chapter 3 GPIB 488.1 Library Reference
GPIB-488 3-7 Programming Reference Manual

IBCLR

Clears a specified device.
Syntax
C ibclr (int device)
Parameters
device is an integer containing the device handle.
Returns
ibsta will contain a 16-bit status word as described in Appendix B, IBSTA.
iberr will contain an error code, if an error occurred.
Usage Notes
When this routine is executed, the GPIB Interface Board (which is currently the CIC) sends
its talk address over the GPIB. This makes it the active talker. It then unlistens all devices and
addresses the specified device as a listener. Finally, the GPIB board clears the device, by
sending the
Selected Device Clear message.
Example
This example uses ibdev to return the unit descriptor for a device at PAD 5, a DMM, into the
variable dmm. The DMM is then cleared.
C int dmm;
dmm = ibdev(0,5,0,13,1,0);
/*open instrument*/
ibclr (dmm);
/* clear it */
Chapter 3 GPIB 488.1 Library Reference
Programming Reference Manual 3-8 GPIB-488

IBCMD

Sends GPIB commands.
Syntax
C ibcmd (int board, char cmnd[], long bytecount)
Parameters
board is an integer containing the board handle.
cmnd is the command string to be sent. This string is comprised of GPIB multiline commands.
These commands are listed in Appendix A, Multiline Interface Messages.
bytecount is the number of command bytes to be transferred.
Returns
ibsta will contain a 16-bit status word as described in Appendix B, IBSTA.
iberr will contain an error code, if an error occurred.
ibcnt, ibcntl will contain the number of bytes that were transferred. ibcnt is a 16-bit
integer.
ibcntl is a 32-bit integer. If the requested count was greater than 64 K, use ibcntl
instead of
ibcnt.
Usage Notes
This routine passes only GPIB commands. It cannot be used to transmit programming
instructions (data) to devices. Use the
ibrd and ibwrt routines for this purpose.
This routine terminates when any one of the following takes place:
Commands transfer is successfully completed.
An error occurs
A timeout occurs
A Take Control (TCT) command is sent
The system controller asserts the IFC (Interface Clear) line.
Chapter 3 GPIB 488.1 Library Reference
GPIB-488 3-9 Programming Reference Manual
Example
This example prepares the board to talk and addresses three devices (at addresses 8, 9, and
10) to listen.
C char *command;
command = "\0x3f\0x5f\0x40\0x28\0x29\0x2a"
ibcmd (board, command, 6);
Chapter 3 GPIB 488.1 Library Reference
Programming Reference Manual 3-10 GPIB-488

IBCMDA

Transfers GPIB commands asynchronously from a string.
Syntax
C ibcmda (int board, char cmnd[], long bytecount)
Parameters
board is an integer containing the board handle.
cmnd is thecommand string to be sent. This string is comprised of GPIB multiline
commands.These commands are listed in Appendix A, Multiline Interface Messages.
bytecount is the number of command bytes to be transferred. Note that in C, although this
parameter is of type long, integer values and variables can also be passed.
Returns
ibsta will contain a 16-bit status word as described in Appendix B, IBSTA.
iberr will contain an error code, if an error occurred. An ECIC error is generated if the GPIB
Interface Board specified is not the Active Controller. If no listening devices are found, the
ENOL error is returned.
ibcnt, ibcntl will contain the number of bytes that were transferred. ibcnt is a 16-bit
integer.
ibcntl is a 32-bit integer. If the requested count was greater than 64 K, use ibcntl
instead of
ibcnt.
Usage Notes
This routine passes only commands. It is not used to transmit programming instructions (data)
to devices. Use the
ibrd/ibwrt routines for this purpose.
Asynchronous I/O is not explicitly supported and will be treated as synchronous.
Example
This example prepares the board to talk and addresses three devices (at addresses 8, 9, and
10) to listen.
ibcmda executes in the background and the program continues into the WHILE
loop. This loop calls
ibwait to update ibsta and checks ibsta to see if ibcmda has
completed or an error has occurred. The program may do anything within the WHILE loop
except make other GPIB I/O calls.
C char command[] = "\0x3f\0x5f\0x40\0x28\0x29\0x2a"
ibcmda (board, command, 6);
while ( (ibsta & CMPL+ERR) == 0)
ibwait (board, 0);
Chapter 3 GPIB 488.1 Library Reference
GPIB-488 3-11 Programming Reference Manual

IBCONFIG

Changes configuration parameters.
Syntax
C ibconfig (int boarddev, unsigned int option,
unsigned int value)
Parameters
boarddev is an integer containing either a board handle or device handle.
option is a number which represents the configuration option to be changed. See Table 3-3.
value is the new configuration option value. Allowed values differ according to the option
being programmed.

Table 3-3. ibconfig Options

Option Valid for Description
IbcPAD bd or dev
New Primary Address. Available primary addresses
range from 0 to 30.
value can be from 0 to 30 decimal.
(See
ibpad.)
IbcSAD bd or dev
New Secondary Address. There are 31 secondary
addresses available.
value can be 0 or from 96 to 126
decimal. (See
ibsad.)
IbcTMO bd or dev
Timeout Value. The approximate time that I/O
functions take before a timeout occurs.
value is a
number from 0 to 15 which corresponds to timeout
values ranging from 10 usec to 100 sec. (See ibtmo)
IbcEOT bd or dev
Enable/disable END message. If this option is enabled,
the EOI line is asserted when the last byte of data is sent.
If
value = 0, then the EOI line is not asserted. If value
is non zero, the EOI line is asserted.
IbcPPC bd
Parallel Poll Configure. Redefines the parallel poll
configuration bytes.
value can be 0, or from 96 to 126
decimal.
IbcREADDR dev
Forced re-addressing. If value = 0, forced
re-addressing is disabled
non zero = Forced re-addressing is enabled.
Chapter 3 GPIB 488.1 Library Reference
Programming Reference Manual 3-12 GPIB-488
IbcAUTOPOLL bd
Enable/Disable Automatic Serial Polling. If value is 0,
then Automatic Serial Polling is disabled. Otherwise, it
is enabled.
IbcCICPROT bd
CIC Protocol. If value is 0, then CIC Protocol is not
used. Otherwise, CIC Protocol is used.
IbcIRQ bd
Enable/Disable Hardware Interrupts. If value is 0, then
hardware interrupts are disabled, otherwise
value
specifies the IRQ level the board uses to generate
interrupts.
IbcSC bd
Request/Release System Control. If value is 0, the
board is not able to support routines requiring system
controller capability.
If value is non-zero, the board can support routines
requiring system controller capability.
IbcSRE bd
Assert/Unassert REN. If value is 0, the REN line is
unasserted. Otherwise, the REN line is asserted.
IbcEOSrd bd or dev
Recognize EOS. If value is non-zero, a read is
terminated when the End-Of-String (EOS) character is
detected. Otherwise, EOS detection is disabled.
IbcEOSwrt bd or dev
Assert EOI. If value is non-zero, then EOI is asserted
when the EOS character is sent. Otherwise, EOI is not
asserted.
IbcEOScmp bd or dev
7/8-bit Comparison. If value is zero, compare the
low-order 7 bits of the EOS character. Otherwise,
compare 8-bits.
IbcEOSchar bd or dev
End-Of-String (EOS) Character. value is the new EOS
character.
value can be any 8-bit value.
IbcPP2
Parallel Poll Remote/Local. If value is zero, then the
GPIB Interface Board is remotely configured for a
parallel poll by an external Controller. Otherwise, the
GPIB interface board accepts parallel poll configuration
commands from your application program.
Table 3-3. ibconfig Options (Continued)
Option Valid for Description
Chapter 3 GPIB 488.1 Library Reference
GPIB-488 3-13 Programming Reference Manual
Returns
ibsta will contain a 16-bit status word as described in Appendix B, IBSTA.
iberr will contain an error code, if an error occurred.
Usage Notes
None.
IbcTIMING bd
Handshake Timing. If value is 1, normal timing (> 2
*sec.) is used. If
value is 2, high-speed timing (> 500
nsec.) is used. If
value is 3, very high-speed timing (>
350 nsec.) is used.
IbcDMA bd
Enable/Disable DMA. If value is zero, DMA transfers
are disabled, otherwise
value specifies the DMA
channel that the board uses.
IbcSendLLO bd
Send Local Lockout. If value is 0, LLO command is
not sent when device is put online; non zero = LLO
command is sent
IbcSPollTime bd or dev
Serial Poll Timeout. value ranges from 0 to 17 specify
timeouts of 10 msecs to 1000 secs. Refer to Table 3-6,
Timeout Codes.
IbcEndBitIsNormal bd or dev
If set, causes END status to be set on receipt of EOS.
IbcPPollTime bd
Parallel Poll Timeout. value ranges from 0 to 17
specify timeouts of 10 msecs to 1000 secs. Refer to
Table 3-6, Timeout Codes.
IbcUnAddr dev
If value is 0, the untalk and unlisten (UNT, UNL) are
not sent after each device level read/write; non zero =
the UNT, UNL commands are sent after each device
lever read/write
Table 3-3. ibconfig Options (Continued)
Option Valid for Description
Chapter 3 GPIB 488.1 Library Reference
Programming Reference Manual 3-14 GPIB-488
Example
This example illustrates how to change the timeout value for GPIB Interface Board 1 to 300
msec.
C int device;
device = ibfind ("gpib1");
ibconfig (device, IbcTMO, 10);
Chapter 3 GPIB 488.1 Library Reference
GPIB-488 3-15 Programming Reference Manual

IBDEV

Obtains a device handle for a device whose name is unknown. It opens and initializes the
device with the configuration given.
Syntax
C device = ibdev (int boardindex, int pad, int sad,
int timeout, int eot, int eos)
Parameters
boardindex identifies the GPIB Interface Board with which the device descriptor is
associated. It is an index in the range 0 to (total number of boards - 1).
pad is the primary address of the device. Available addresses range from 0 to 30.
sad is the secondary address of the device. There are 31 secondary addresses available. value
can be 0, or from 96 to 126 decimal; see Appendix A, Multiline Interface Messages. If 0 is
selected, the driver will not expect the device to require a secondary address.
timeout is the timeout of the device. This is a value from 0 to 17 which corresponds to
timeout value ranging from 10 usec to 1000 sec. See Table 3-6, Timeout Codes, for a list of
timeouts and corresponding values.
eot when writing to a device, eot specifies whether or not to assert EOI with the last data byte.
If eot is non-zero, EOI is asserted. If eot is 0, EOI is not asserted.
eos specifies the End-Of-String termination mode to be used when communicating with the
device. See Table 3-4, Selecting EOS, for a description of special formatting features of this
argument.
Returns
device will contain the assigned descriptor or a negative number. If device is a negative
number, then an error occurred. Two types of errors can occur:
•An
EDVR or ENEB error is returned if a device is not available or the board index specifies
a non-existent board.
•An
EARG error is returned if illegal values are given for pad, sad, timeout, eot, eos.
iberr will contain an error code, if an error occurred.
Usage Notes
This routine returns the device handle of the first available user-configurable device it finds
in the device list.
Chapter 3 GPIB 488.1 Library Reference
Programming Reference Manual 3-16 GPIB-488
Example
This example opens an available device, associates it with GPIB interface board 1, and assigns
it the following device configuration parameters.
primary address = 3
secondary address = 19 (115 decimal, 73 hex)
timeout = 10 sec
Assert EOI
EOS Disabled
The new device handle is returned.
C int device;
device = ibdev(1, 3, 0x73, 13, 1, 0);
Chapter 3 GPIB 488.1 Library Reference
GPIB-488 3-17 Programming Reference Manual

IBDMA

Enables/Disables DMA.
Syntax
C ibdma (int board, int dma)
Parameters
board is an integer containing the board handle.
dma is an integer which indicates whether DMA is to be enabled or disabled for the specified
GPIB board. If
dma is non-zero, all read and write operations between the GPIB board and
memory are performed using DMA. Otherwise, programmed I/O is used.
Returns
ibsta will contain a 16-bit status word as described in Appendix B, IBSTA.
iberr will contain an error code, if an error occurred. An ECAP error results if you tried to
enable DMA operations for a board which does not support DMA operation. If no error
occured, the previous value of
dma is stored in iberr.
Usage Notes
The GPIB Interface Board must have been configured for DMA operations in order for this
routine to be executed successfully. This routine is useful for alternating between
programmed I/O and DMA operations. This call remains in effect until one of the following
occurs:
Another
ibdma call is made.
ibonl or ibfind is called.
The program is re-started.
The maximum DMA transfer length in Windows is 64 K bytes.
Example
This example enables DMA transfers for GPIB Interface Board 1. It
assumes that the DMA channel was previously selected in your
configuration program.
C int board, ibsta;
board = ibfind ("gpib1");
ibsta = ibdma (board, 1);
Loading...
+ 86 hidden pages