Ni ESP-488 Software Reference User Manual
تبلیغات
تبلیغات
ESP-488 Software Reference Manual for the VXIcpu-030
®
National Instruments IEEE-488 Engineering Software Package for the VxWorks Operating System
bus
July 1994 Edition
Part Number 320345-01
© Copyright 1991, 1994 National Instruments Corporation.
All Rights Reserved.
National Instruments Corporate Headquarters
6504 Bridge Point Parkway
Austin, TX 78730-5039
(512) 794-0100
Technical support fax: (800) 328-2203
(512) 794-5678
Branch Offices:
Australia (03) 879 9422, Austria (0662) 435986, Belgium 02/757.00.20, Canada (Ontario) (519) 622-9310,
Canada (Québec) (514) 694-8521, Denmark 45 76 26 00, Finland (90) 527 2321, France (1) 48 14 24 24,
Germany 089/741 31 30, Italy 02/48301892, Japan (03) 3788-1921, Netherlands 03480-33466, Norway 32-848400,
Spain (91) 640 0085, Sweden 08-730 49 70, Switzerland 056/20 51 51, U.K. 0635 523545
Limited Warranty
The media on which you receive National Instruments software are warranted not to fail to execute programming instructions, due to defects in materials and workmanship, for a period of 90 days from date of shipment, as evidenced by receipts or other documentation. National Instruments will, at its option, repair or replace software media that do not execute programming instructions if National Instruments receives notice of such defects during the warranty period. National Instruments does not warrant that the operation of the software shall be uninterrupted or error free.
A Return Material Authorization (RMA) number must be obtained from the factory and clearly marked on the outside of the package before any equipment will be accepted for warranty work. National Instruments will pay the shipping costs of returning to the owner parts which are covered by warranty.
National Instruments believes that the information in this manual is accurate. The document has been carefully reviewed for technical accuracy. In the event that technical or typographical errors exist, National Instruments reserves the right to make changes to subsequent editions of this document without prior notice to holders of this edition. The reader should consult National Instruments if errors are suspected. In no event shall National
Instruments be liable for any damages arising out of or related to this document or the information contained in it.
E XCEPT AS SPECIFIED HEREIN , N ATIONAL I NSTRUMENTS MAKES NO WARRANTIES , EXPRESS OR IMPLIED ,
AND SPECIFICALLY DISCLAIMS ANY WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR
PURPOSE . C USTOMER ' S RIGHT TO RECOVER DAMAGES CAUSED BY FAULT OR NEGLIGENCE ON THE PART
OF N ATIONAL I NSTRUMENTS SHALL BE LIMITED TO THE AMOUNT THERETOFORE PAID BY THE CUSTOMER .
N ATIONAL I NSTRUMENTS WILL NOT BE LIABLE FOR DAMAGES RESULTING FROM LOSS OF DATA , PROFITS ,
USE OF PRODUCTS , OR INCIDENTAL OR CONSEQUENTIAL DAMAGES , EVEN IF ADVISED OF THE POSSIBILITY
THEREOF . This limitation of the liability of National Instruments will apply regardless of the form of action, whether in contract or tort, including negligence. Any action against National Instruments must be brought within one year after the cause of action accrues. National Instruments shall not be liable for any delay in performance due to causes beyond its reasonable control. The warranty provided herein does not cover damages, defects, malfunctions, or service failures caused by owner's failure to follow the National Instruments installation, operation, or maintenance instructions; owner's modification of the product; owner's abuse, misuse, or negligent acts; and power failure or surges, fire, flood, accident, actions of third parties, or other events outside reasonable control.
Copyright
Under the copyright laws, this publication may not be reproduced or transmitted in any form, electronic or mechanical, including photocopying, recording, storing in an information retrieval system, or translating, in whole or in part, without the prior written consent of National Instruments Corporation.
Trademarks
NI-488
®
and VXIcpu-030
®
are trademarks of National Instruments Corporation.
Product names and company names listed are trademarks or trade names of their respective companies.
Warning Regarding Medical and Clinical Use of National Instruments Products
National Instruments products are not designed with components and testing intended to ensure a level of reliability suitable for use in treatment and diagnosis of humans. Applications of National Instruments products involving medical or clinical treatment can create a potential for accidental injury caused by product failure, or by errors on the part of the user or application designer. Any use or application of National Instruments products for or involving medical or clinical treatment must be performed by properly trained and qualified medical personnel, and all traditional medical safeguards, equipment, and procedures that are appropriate in the particular situation to prevent serious injury or death should always continue to be used when National Instruments products are being used.
National Instruments products are NOT intended to be a substitute for any form of established process, procedure, or equipment used to monitor or safeguard human health and safety in medical or clinical treatment.
Contents
About This Manual
..............................................................................................................vii
Organization of This Manual.............................................................................................vii
Conventions Used in This Manual .................................................................................. viii
Related Documentation ................................................................................................... viii
Customer Communication............................................................................................... viii
Chapter 1
Introduction
..........................................................................................................................1-1
Important Considerations...............................................................................................1-1
Chapter 2
The C Language Library
.................................................................................................2-1
Global Variables ............................................................................................................2-1
Status Word – ibsta ............................................................................................2-1
Error Variable – iberr.........................................................................................2-2
Count Variable – ibcnt .......................................................................................2-3
Read and Write Termination..........................................................................................2-3
Compiling C Programs...................................................................................................2-4
GPIB Function Descriptions ..........................................................................................2-4
Device-Level Functions .................................................................................................2-4
Low-Level Functions .....................................................................................................2-5
Chapter 3
IBIC
..........................................................................................................................................3-1
Running IBIC.................................................................................................................3-1
Syntax Translation Guidelines.......................................................................................3-1
Sample Session ..............................................................................................................3-2
Auxiliary Functions........................................................................................................3-3
Chapter 4
ESP-488 Functions and Utilities Reference
...............................................................4-1
IBIC(1)...........................................................................................................................4-2
IBTEST(1) .....................................................................................................................4-6
DVCLR(3) .....................................................................................................................4-7
DVRD(3)........................................................................................................................4-8
DVRSP(3) ......................................................................................................................4-10
DVTRG(3) .....................................................................................................................4-12
DVWRT(3) ....................................................................................................................4-13
IBCAC(3).......................................................................................................................4-15
IBCMD(3)......................................................................................................................4-16
IBEOS(3) .......................................................................................................................4-18
IBEOT(3) .......................................................................................................................4-20
IBGTS(3) .......................................................................................................................4-21
© National Instruments Corporation v ESP-488 for the VXIcpu-030
Contents
IBLINES(3)....................................................................................................................4-22
IBONL(3).......................................................................................................................4-23
IBPAD(3).......................................................................................................................4-24
IBRD(3) .........................................................................................................................4-25
IBRPP(3)........................................................................................................................4-27
IBRSV(3) .......................................................................................................................4-28
IBSAD(3).......................................................................................................................4-29
IBSIC(3).........................................................................................................................4-30
IBSRE(3)........................................................................................................................4-31
IBTMO(3) ......................................................................................................................4-32
IBWAIT(3).....................................................................................................................4-34
IBWRT(3) ......................................................................................................................4-36
Appendix A
Multiline Interface Command Messages
....................................................................A-1
Appendix B
Software Configuration and Installation
....................................................................B-1
Appendix C
GPIB Programming Example
........................................................................................C-1
Appendix D
Customer Communication
...............................................................................................B-1
Glossary
...................................................................................................................... Glossary-1
Tables
Table 2-1.
Status Word Layout ..........................................................................................2-1
Table 2-2.
GPIB Error Codes.............................................................................................2-2
Table 3-1.
Auxiliary Functions That IBIC Supports..........................................................3-3
Table 4-1.
Syntax of ESP-488 Functions in IBIC..............................................................4-2
Table 4-2.
Status Word Layout ..........................................................................................4-4
Table 4-3.
GPIB Error Codes.............................................................................................4-5
Table 4-4.
Auxiliary Functions That IBIC Supports..........................................................4-5
Table 4-5.
Data Transfer Termination Method..................................................................4-18
Table 4-6.
Timeout Settings...............................................................................................4-32
Table 4-7.
Wait Mask Layout ............................................................................................4-34
Table B-1.
Software Distribution Files...............................................................................B-1
ESP-488 for the VXIcpu-030 vi © National Instruments Corporation
About This Manual
This manual describes the IEEE 488 Engineering Software Package (ESP-488) for the VxWorks operating system (Version 5.0 and higher) from Wind River Systems, Inc. This package is intended to be used with the VXIcpu-030 controller.
Organization of This Manual
This manual is organized as follows:
Chapter 1, Introduction, contains an overview of the ESP-488 VxWorks software and describes important considerations for using the software.
Chapter 2, The C Language Library, contains a general description of the C language programming interface to the ESP-488 VxWorks device driver, including the GPIB device-level and low-level functions.
Chapter 3, IBIC, introduces you to the Interface Bus Interactive Control ( ibic ) program. This chapter also contains instructions for running ibic , contains guidelines for translating ibic syntax, contains a sample session, and summarizes the auxiliary functions that ibic supports.
Chapter 4, ESP-488 Functions and Utilities Reference, contains detailed information for using the functions and utilities contained in the ESP-488 software package. For ease of use, this material is presented in a format familiar to most users of the UNIX and VxWorks operating systems.
Appendix A, Multiline Interface Command Messages, is a listing of multiline interface messages.
Appendix B, Software Configuration and Installation, describes how to configure and install the software.
Appendix C, GPIB Programming Example, illustrates the steps involved in programming a representative IEEE 488 instrument from a terminal using the ESP-488 functions in C language.
This appendix is designed to help you learn how to use the ESP-488 driver software to execute certain programming and control sequences.
Appendix D, Customer Communication, contains forms you can use to request help from
National Instruments or to comment on our products and manuals.
Glossary, contains an alphabetical list and description of terms used in this manual, including abbreviations, acronyms, metric prefixes, and symbols.
© National Instruments Corporation vii ESP-488 for the VXIcpu-030
About This Manual
Conventions Used in This Manual
The following conventions are used to distinguish elements of text throughout this manual: italic Italic text denotes emphasis, a cross reference, or an introduction to a key concept.
bold italic Bold italic text denotes a note.
monospace Text in this font denotes text or characters that are to be literally input 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, variables, filenames and extensions, and for statements and comments taken from program code.
Note: References in this manual to IEEE 488 and IEEE 488.2 are referring to the
ANSI/IEEE Standard 488.1-1987 and the ANSI/IEEE Standard 488.2-1987, respectively, which define the GPIB specification.
Related Documentation
The following documents contain information that you may find helpful as you read this manual:
• ANSI/IEEE Standard 488-1987, IEEE Standard Digital Interface for Programmable
Instrumentation
• ANSI/IEEE Standard 488.2-1987, IEEE Standard Codes, Formats, Protocols, and Common
Commands.
• ESP-488 for VxWorks and the GPIB-1014/1014D Software Reference Manual (part number
320429-01)
• Getting Started with Your VXIcpu-030 and the NI-VXI Software for the VxWorks Operating
System
• VxWorks Programmer's Guide, Wind River Systems
• VXIbus System Specification, Revision 1.4, VXIbus Consortium (available from National
Instruments, part number 350083-01)
Customer Communication
National Instruments wants to receive your comments on our products and manuals. We are interested in the applications you develop with our products, and we want to help if you have problems with them. To make it easy for you to contact us, this manual contains comment and configuration forms for you to complete. These forms are in Appendix D, Customer
Communication, at the end of this manual.
ESP-488 for the VXIcpu-030 viii © National Instruments Corporation
Chapter 1
Introduction
This chapter contains an overview of the ESP-488 VxWorks software and describes important considerations for using the software.
ESP-488 is a functional subset of the industry standard NI-488 GPIB driver software. Standard
ESP-488 implements an optimized set of 10 fundamental GPIB functions for low-level communication and control through a single GPIB interface. In addition to this core set of 10 functions, ESP-488 for VxWorks includes several functions for interface configuration and highlevel device communication. Other features include timeout support, error reporting, and an interactive control utility ( ibic ) similar to the ibic included with NI-488 software packages.
Important Considerations
Before using the ESP-488 VxWorks software, you must install the software from tape. Refer to your Getting Started manual and also to Appendix B, Software Configuration and Installation, of this manual for instructions about installing the software.
Consider also the following points when using the ESP-488 software:
• The ESP-488 functions support synchronous I/O transfers through a single GPIB interface.
The functions are intended to be accessed by only one program task at a time.
• All functions return a subset of the standard NI-488 status bit vector as described later in this manual. The result of the last call is also available in the global variable, ibsta . Additional information on the result of the last call is sometimes contained in the global variables ibcnt and iberr . Refer to Chapter 2, The C Language Library, for more information on the global variables.
• The GPIB interface is normally designated to be the System Controller. Most ESP-488 functions are optimized to assume the GPIB interface is also the Controller-In-Charge (CIC).
• Call the ibonl function to initialize the GPIB interface before any other call is made.
• Prior to calling ibrd or ibwrt , you must address the appropriate devices, including the
GPIB interface, by calling ibcmd with the proper addressing commands.
• Five device-level calls are included with this package. All of these calls need the primary address (PAD) and secondary address (SAD) of the device you want to communicate with.
If the device does not have a secondary address, pass a zero for the SAD portion of the address argument.
• Include the header file ugpib.h
in any application program that uses the ESP-488 functions.
© National Instruments Corporation 1-1 ESP-488 for the VXIcpu-030
Introduction Chapter 1
• Refer to the Readme file on the software distribution media for additional information on a specific ESP-488 VxWorks kit.
ESP-488 for the VXIcpu-030 1-2 © National Instruments Corporation
Chapter 2
The C Language Library
This chapter contains a general description of the C language programming interface to the
ESP-488 VxWorks device driver, including the GPIB device-level and low-level functions.
Global Variables
The following sections explain the status word ( ibsta ), the error variable ( iberr ), and the count variable ( ibcnt ). These variables are updated each time a driver call is made, to reflect the status of the GPIB interface.
Status Word – ibsta
All functions return a status word which reports the success of the function call and information about the state of the GPIB interface. The status word is also available as the external variable ibsta .
The status word contains 16 bits, nine of which are meaningful. A bit value of one indicates that the corresponding condition is in effect; a bit value of zero indicates that the condition is not in effect. Table 2-1 lists each condition and the corresponding bit position to be tested for that condition.
Mnemonic
ERR
TIMO
END
SRQI
CMPL
CIC
ATN
TACS
LACS
Table 2-1. Status Word Layout
Bit
Position
15
14
4
3
2
13
12
8
5
Hex
Value
8000
4000
2000
1000
100
20
10
8
4
A description of each status bit and its condition follows.
Description
GPIB error
Time limit exceeded
END detected
SRQ is asserted
I/O completed
Controller-In-Charge
Attention is asserted
Talker
Listener
© National Instruments Corporation 2-1 ESP-488 for the VXIcpu-030
The C Language Library Chapter 2
ERR The ERR bit is set in the status word following any call that results in an error; the particular error can be determined by examining the iberr variable. The ERR bit is cleared following any call that does not result in an error.
TIMO The TIMO bit indicates whether the time limit for I/O completion has been exceeded.
END The END bit indicates whether the END message has occurred during a read operation.
SRQI The SRQI bit indicates whether the GPIB line SRQ is asserted.
CMPL The CMPL bit indicates that the previous I/O operation is complete. Because I/O is synchronous, CMPL is always set.
CIC
ATN
The CIC bit indicates whether the GPIB interface is the Controller-In-Charge.
The ATN bit indicates whether the GPIB line ATN is asserted.
TACS The TACS bit indicates whether the GPIB interface is addressed to talk.
LACS The LACS bit indicates whether the GPIB interface is addressed to listen.
Error Variable – iberr
When the ERR bit is set in the status word, a GPIB error has occurred. One of the following error codes is returned in the external variable iberr.
Suggested
Mnemonic
ECIC
ENOL
EADR
EARG
EABO
ENEB
EDMA
EBUS
Table 2-2. GPIB Error Codes
Decimal
Value
1
2
8
14
6
7
3
4
Explanation
Function requires GPIB interface to be CIC
Write handshake error (e.g., no listener)
GPIB interface not addressed correctly
Invalid argument to function call
I/O operation aborted
GPIB interface is offline
DMA hardware error
GPIB bus error
A description of each error and some conditions under which it may occur follow:
ESP-488 for the VXIcpu-030 2-2 © National Instruments Corporation
Chapter 2 The C Language Library
ECIC (1) This code is returned when a call requiring the GPIB interface to be Controller-In-
Charge (CIC) is made, but the interface is not CIC. This could have happened because the interface was never made CIC, or it passed control to another controller.
ENOL (2) The most common cause of this error code is when a write operation is attempted with no listeners addressed. For a device write, this indicates that the GPIB address passed in to the driver does not match the GPIB address of any device connected to the bus. For a low-level write, the appropriate addressing commands were not previously sent.
This error may also occur in situations in which the GPIB interface is not the
Controller-In-Charge and the controller asserts ATN before the write call in progress has ended.
EADR (3) This error results from the GPIB interface not addressing itself before read and write calls when it is the Controller-In-Charge.
EARG (4) This error results when an invalid argument is passed to a function call.
EABO (6) This error indicates that I/O has been cancelled. This error usually results from a timeout condition.
ENEB (7) This error, which literally means non-existent board, occurs when the GPIB interface is offline.
EDMA (8) This error indicates that a DMA hardware error occurred during an I/O operation.
EBUS (14) This error indicates a GPIB bus error during a device call. This is usually the result of the internal time limit being exceeded.
Count Variable – ibcnt
The ibcnt variable is updated after each read, write, or command function call with the number of bytes actually transferred by the operation.
Read and Write Termination
The IEEE 488 specification defines two methods of identifying the last byte of device-dependent
(data) messages. The two methods permit a talker to send data messages of any length without the listener(s) knowing in advance the number of bytes in the transmission. The two methods are as follows:
• END message. In this method, the talker asserts the End Or Identify (EOI) signal simultaneously with transmission of the last data byte. By design, the listener stops reading when it detects a data message accompanied by EOI, regardless of the value of the byte.
• End-Of-String (EOS) character. In this method, the talker uses a special character at the end of its data string. By prior arrangement, the listener stops receiving data when it detects that character. Either a 7-bit ASCII character or a full 8-bit binary byte can be used.
© National Instruments Corporation 2-3 ESP-488 for the VXIcpu-030
The C Language Library Chapter 2
These two methods can be used individually or in combination. However, it is important that the listener be properly configured to unambiguously detect the end of a transmission.
The GPIB interface always terminates ibrd operations on the END message. For ibwrt operations, the GPIB interface always sends the END message with the last byte in the transfer.
Use the ibeos and ibeot functions to select other modes of operation.
Compiling C Programs
In addition to any VxWorks or other required include files, always include the file ugpib.h
in every GPIB program. This file defines all status bits, error codes, and externals needed.
Compile the application program on a suitable UNIX host system using the native C compiler.
For example, to compile the program prog.c
, enter the following command: cc -c -I/usr/vw/h -O prog.c
The resulting object module, prog.o
, can be linked directly with the GPIB driver library esp488.o
and then loaded into the VxWorks system, or prog.o
can be loaded separately into a VxWorks system that already contains esp488.o
. In the latter case, all ESP function references in prog.o
are resolved dynamically by the VxWorks loader. Dynamic linking is the method used by the ESP-488 utility programs ibic.o
, ibtsta.o
, and ibtstb.o
.
For more information on creating and running VxWorks applications, refer to cc(1) or the equivalent in your UNIX documentation, and to the Cross-Development section in the VxWorks
Programmer's Guide.
GPIB Function Descriptions
The remainder of this chapter is intended as a quick reference to the GPIB device-level and
GPIB low-level functions. Refer to Chapter 4, ESP-488 Functions and Utilities Reference, in this manual for more thorough information and specific examples.
Device-Level Functions
The following functions can be performed on a GPIB device at the specified address. All controller sequences conform to the IEEE 488.2 specification.
dvclr(a) Sends the message Selected Device Clear (SDC) to a device at address a .
dvrd(a,buf,cnt) Reads from the device at address a into a buffer.
dvrsp(a,buf) Performs a serial poll of a device at address a .
dvtrg(a) Triggers the device at address a by sending the message Group Execute
Trigger (GET).
dvwrt(a,buf,cnt) Writes from a buffer to the device at address a .
ESP-488 for the VXIcpu-030 2-4 © National Instruments Corporation
Chapter 2 The C Language Library
Low-Level Functions
The following functions can be performed directly on or through the GPIB interface.
ibcac(v) Takes the interface from Controller Standby to Active Controller state
(asserts ATN). v equal to 1 takes control synchronously, if possible. v equal to 0 takes control asynchronously. The interface must be CIC.
ibcmd(buf,cnt) Sends a buffer of command messages. The interface must be CIC, but need not be Active Controller.
ibeos(v) ibeot(v)
Changes the end-of-string (EOS) mode. The low byte contains the eos character and the high byte is any of REOS , XEOS , or BIN . v equal to 0 disables EOS checking.
Enables sending END with the last byte of every GPIB write. A value of 0 disables.
ibgts() Puts the interface in standby state (deasserts ATN).
iblines(clines) Returns the state of the GPIB control lines in clines .
ibonl(v) ibpad(v) ibrd(buf,cnt)
Reinitializes the GPIB software and hardware. v equal to 1 places the interface online. v equal to 0 places the interface offline.
Changes the value of the primary GPIB address.
Reads from the GPIB into a buffer. The interface must have been previously addressed to listen.
ibrpp(buf) ibrsv(v) ibsad(v) ibsic() ibsre(v)
Executes a parallel poll. The interface must be CIC.
Sets the serial poll response byte of the board. If bit 0x40 is set, the board asserts SRQ. If the board is CIC, it will not assert SRQ.
Changes the secondary GPIB address. v equal to 0 disables secondary address recognition.
Pulses Interface Clear (IFC).
Asserts Remote Enable (REN) if v equal to 1. v equal to 0 clears REN.
ibtmo(v) ibwait(mask)
Changes the timeout value. v equal to 0 disables timeouts. Timeout values are given in ugpib.h
.
Waits for events to occur. Valid mask bits are: TIMO, SRQI, CIC,
TACS, and LACS.
ibwrt(buf,cnt) Writes from a buffer to the GPIB. The interface must have been previously addressed to talk.
© National Instruments Corporation 2-5 ESP-488 for the VXIcpu-030
Chapter 3
IBIC
This chapter introduces you to the Interface Bus Interactive Control ( ibic ) program. This chapter also contains instructions for running ibic , contains guidelines for translating ibic syntax, contains a sample session, and summarizes the auxiliary functions that ibic supports.
Refer to Chapter 4, ESP-488 Functions and Utilities Reference, for detailed descriptions of the C language functions.
Running IBIC
From the VxWorks shell, load ibic.o
using the ld command. For example, ld < host:ibic.o
One or more ESP-488 driver modules must also be loaded into the system before running ibic .
Once the required modules are loaded, run ibic by entering the following command at the shell prompt: ibic
If more than one driver module is loaded, ibic will initially direct all calls to the first module it can find in memory. Other modules can be activated using the set command (refer to the
Auxiliary Functions section later in this chapter).
Syntax Translation Guidelines
To translate between C syntax and ibic syntax, use the following guidelines:
• Omit the parentheses around the function argument list.
• Regardless of which driver modules are loaded, all functions are called using the default naming syntax.
ib2wrt becomes: ibwrt
• Functions with a single numeric argument are followed by a number.
ibsre(1) becomes: ibsre 1
• Functions that write a buffer are followed by a string, but no count.
ibwrt("text",4) becomes: ibwrt "text"
© National Instruments Corporation 3-1 ESP-488 for the VXIcpu-030
IBIC Chapter 3
• Functions that read a buffer are followed by a count only.
ibrd(buf,50) becomes: ibrd 50
• Functions that perform a poll take no buffer argument.
ibrpp(buf) becomes: ibrpp
• Functions that take a mask argument are followed by a list of mask bits in parentheses.
ibwait(TIMO|SRQI) becomes: ibwait (timo srqi)
Sample Session
The following is a sample session of ibic that triggers a digital voltmeter at address 3, waits for a service request, and reads in a buffer of data. User inputs are underlined.
[0100] ( cmpl )
[0100] ( cmpl )
3 "F3R7T3"
[0100] ( cmpl )
(srqi timo)
[0900] ( srqi cmpl )
[0100] ( cmpl )
Poll: 0xC0
3 10000
[2100] ( end cmpl ) count: 10
01 02 03 04 05 06 25 07
62 03
. . . . . . % .
a .
ESP-488 for the VXIcpu-030 3-2 © National Instruments Corporation
Chapter 3
Auxiliary Functions
Table 3-1 summarizes the auxiliary functions that ibic supports.
IBIC
Table 3-1. Auxiliary Functions That IBIC Supports
Function Syntax set ESP[x]
Description
Direct all subsequent calls to driver module x .
help [option] Display help information. All available functions are briefly described.
!
Repeat previous command.
-
+ n* function n* !
Turn printing off. This is most often used with the $ command.
Turn printing on.
Execute command n times.
Execute previous command n times.
$ filename print string e , q , or ^d
Execute indirect file.
Display string on screen.
Exit or quit ibic .
© National Instruments Corporation 3-3 ESP-488 for the VXIcpu-030
Chapter 4
ESP-488 Functions and Utilities Reference
This chapter contains detailed information for using the functions and utilities contained in the
ESP-488 software package. For ease of use, this material is presented in a format familiar to most users of the UNIX and VxWorks operating systems.
© National Instruments Corporation 4-1 ESP-488 for the VXIcpu-030
ESP-488 Functions and Utilities Reference Chapter 4
IBIC(1) GPIB IBIC(1)
Name ibic - interface bus interactive control program
Synopsis ld < host:ibic.o
ibic
Description ibic is a command language for controlling the National Instruments GPIB interface. It executes commands read from stdin or a file and returns detailed status information.
All commands from the GPIB library esp488.o
are supported.
Commands
Table 4-1 summarizes the ESP-488 functions and syntax when called from ibic .
Function
Syntax ibeot [v] ibgts iblines ibonl [v] ibpad v ibrd v
Table 4-1. Syntax of ESP-488 Functions in IBIC
Description dvclr a dvrd a v dvrsp a dvtrg a
Clear specified device
Read data from a device
Return serial poll byte
Trigger selected device dvwrt a string Write data to a device ibcac [v] Become Active Controller ibcmd string ibeos v
Send commands from string
Change/disable EOS message
Enable/disable END message
Go from Active Controller to Standby
Get state of GPIB control lines
Place GPIB interface online or offline
Change primary address
Read data
Function
Type device-level device-level device-level device-level device-level low-level low-level low-level low-level low-level low-level low-level low-level low-level
Note
4
3
1,4
2,3
2,3
1
1
1
1,5
2,3
3
5
(continues)
ESP-488 for the VXIcpu-030 4-2 © National Instruments Corporation
Chapter 4 ESP-488 Functions and Utilities Reference
Table 4-1. Syntax of ESP-488 Functions in IBIC (continued)
Function
Syntax
Description ibrpp ibrsv v ibsad v ibsic
Conduct a parallel poll
Request service
Change secondary address
Send interface clear ibsre [v] ibtmo v
Set/clear remote enable line
Change/disable time limit ibwait [mask] Wait for selected event ibwrt string Write data
Function
Type low-level low-level low-level low-level low-level low-level low-level low-level
Note
3
3
2,3
3
2,6
4
Notes
1.
a is the hex, octal, or decimal integer (see note 3) specifying the GPIB address of the device.
The least significant byte (bits 0 through 7) contains the primary address and the next least significant byte (bits 8 through 15) contains the secondary address. If the device has no secondary address, pass a zero in bits 8 through 15.
2. Values enclosed in square brackets ( [] ) are optional. The default value is zero for ibwait and one for all other functions.
3.
v is a hex, octal, or decimal integer. Hex numbers must be preceded by zero and x (for example, 0xD ). Octal numbers must be preceded by zero only (for example, 015 ). Other numbers are assumed to be decimal.
4.
string consists of a list of ASCII characters, octal or hex bytes, or special symbols. The entire sequence of characters must be enclosed in quotation marks. An octal byte consists of a backslash character followed by the octal value. For example, octal 40 would be represented by \40 . A hex byte consists of a backslash character and a character x followed by the hex value. For example, hex 40 would be represented by \x40 . Two special symbols are \r for a carriage return character and \n for a linefeed character. These symbols are a convenient method for inserting the carriage return and linefeed characters into a string, as shown in the following string: "F3R5T1\r\n" . Because the carriage return can be represented equally well in hex, \xD and \r are equivalent strings.
5.
v is the number of bytes to read.
6.
mask is a hex, octal, or decimal integer (see note 3) or a mask bit mnemonic.
© National Instruments Corporation 4-3 ESP-488 for the VXIcpu-030
ESP-488 Functions and Utilities Reference Chapter 4
Return Values
All ibic functions return a status word in both hex and bit mnemonic form. Table 4-2 lists the mnemonics of the status word. (This is the same information that is given in
Table 2-1.)
Table 4-2. Status Word Layout
Mnemonic
ERR
TIMO
END
SRQI
CMPL
CIC
ATN
TACS
LACS
Bit
Position
15
14
13
12
8
5
4
3
2
Hex
Value
8000
4000
2000
1000
100
20
10
8
4
Description
GPIB error
Time limit exceeded
END detected
SRQ is asserted
I/O completed
Controller-In-Charge
Attention is asserted
Talker
Listener
If the ERR bit is set, an error mnemonic will be displayed as shown in Table 4-3. (This is the same information that is given in Table 2-2.)
ESP-488 for the VXIcpu-030 4-4 © National Instruments Corporation
Chapter 4 ESP-488 Functions and Utilities Reference
Table 4-3. GPIB Error Codes
Suggested
Mnemonic
ECIC
ENOL
EADR
EARG
EABO
ENEB
EDMA
EBUS
Decimal
Value
1
2
8
14
6
7
3
4
Explanation
Function requires GPIB interface to be CIC
Write handshake error (e.g., no listener)
GPIB interface not addressed correctly
Invalid argument to function call
I/O operation aborted
GPIB interface is offline
DMA hardware error
GPIB bus error
Auxiliary Functions
Table 4-4 summarizes the auxiliary functions that ibic supports. (This is the same information that is given in Table 3-1.)
Table 4-4. Auxiliary Functions That IBIC Supports
Function Syntax set ESP[x]
Description
Direct all subsequent calls to driver module x .
help [option] Display help information. All available functions are briefly described.
!
Repeat previous command.
-
+ n* function n* !
Turn printing off. This is most often used with the $ command.
Turn printing on.
Execute command n times.
Execute previous command n times.
$ filename print string e , q , or ^d
Execute indirect file.
Display string on screen.
Exit or quit ibic .
See Also
Chapter 2, The C Language Library
Chapter 3, ibic
© National Instruments Corporation 4-5 ESP-488 for the VXIcpu-030
ESP-488 Functions and Utilities Reference
IBTEST(1)
Chapter 4
IBTEST(1) GPIB
Name ibtsta , ibtstb - installation tests (parts A and B) for ESP-488
Synopsis ld < host:ibtsta.o
ibtsta [x] ld < host:ibtstb.o
ibtstb [x]
Description ibtsta and ibtstb are test programs for verifying the correct installation and operation of an ESP-488 library. If the optional argument x is specified, the test is run on the indicated driver module. For example, ibtsta 1 will run installation test part A on esp488_1.o
. If the x argument is omitted, the test is run on the default module, esp488.o
, or on the first module found in memory.
ibtsta checks for basic driver functionality, takes only a few seconds to complete, and requires no interaction from the user. ibtstb performs a more thorough check of I/O and interrupt operation and requires the use of a GPIB analyzer. Both tests give onscreen instructions at program startup for the user to set up and run the test.
ibtsta should be run first. If ibtsta completes with no errors and a GPIB analyzer is available, ibtstb should then be run. ibtstb may be omitted if an analyzer is not available.
See Also ibic (1)
Chapter 2, The C Language Library
ESP-488 for the VXIcpu-030 4-6 © National Instruments Corporation
Chapter 4
DVCLR(3) device-level
ESP-488 Functions and Utilities Reference
DVCLR(3)
Name dvclr - send Selected Device Clear (SDC) to a GPIB device
Synopsis
#include "ugpib.h" dvclr (a) int a;
Description a is the GPIB address of the device. The least significant byte (bits 0 through 7) contains the primary address and the next least significant byte (bits 8 through 15) contains the secondary address. If the device has no secondary address, pass a zero in bits 8 through
15.
The dvclr function sends the message SDC, the meaning of which depends on the specific device. SDC usually resets all device functions. dvclr sends the following commands and information:
• Talk address of the GPIB interface
• Secondary address of the GPIB interface, if applicable
• Unlisten (UNL)
• Listen address of the device
• Secondary address of the device, if applicable
• Selected Device Clear (SDC)
Examples
1. Clear the device at address 3.
dvclr(3);
2. Clear the device at primary address 5 and secondary address 0x61.
dvclr(0x6105);
See Also ibcmd(3)
Chapter 2, The C Language Library
© National Instruments Corporation 4-7 ESP-488 for the VXIcpu-030
ESP-488 Functions and Utilities Reference
DVRD(3) device-level
Chapter 4
DVRD(3)
Name dvrd - read data from a GPIB device into a buffer
Synopsis
#include "ugpib.h" dvrd (a,buf,cnt) int a,cnt; char buf[];
Description a is the GPIB address of the device. The least significant byte (bits 0 through 7) contains the primary address and the next least significant byte (bits 8 through 15) contains the secondary address. If the device has no secondary address, pass a zero in bits 8 through
15. buf identifies the buffer to use. cnt specifies the number of bytes to read from the
GPIB.
The dvrd function reads cnt bytes of data from a GPIB device. Prior to reading the data, dvrd sends the following commands and information:
• Unlisten (UNL)
• Listen address of the GPIB interface
• Secondary address of the GPIB interface, if applicable
• Talk address of the device
• Secondary address of the device, if applicable
When the dvrd function returns, ibsta holds the latest GPIB status; ibcnt is the actual number of data bytes read from the device; and iberr is the first error detected if the ERR bit in ibsta is set.
The dvrd operation terminates on any of the following events.
• Allocated buffer becomes full.
• Error is detected.
• Time limit is exceeded.
• END message is detected.
After termination, ibcnt contains the number of bytes read. A short count can occur on any of the above events but the first.
ESP-488 for the VXIcpu-030 4-8 © National Instruments Corporation
Chapter 4 ESP-488 Functions and Utilities Reference
Examples
1. Read 56 bytes of data from the device at address 5 and secondary address 0x61.
dvrd(0x6105,rdbuf,56);
/* Check ibsta to see how the read terminated: on CMPL, */
/* END, TIMO, or ERR.
/* Data is stored in rdbuf.
*/
*/
2. Read 1024 bytes of data from the device at talk address 0x4C (ASCII L).
dvrd(0x4c,rdbuf,1024);
/* Check ibsta to see how the read terminated: on CMPL, */
/* END, TIMO, or ERR. */
/* Data is stored in rdbuf.
*/
See Also
ibcmd(3) and ibrd(3)
Chapter 2, The C Language Library
© National Instruments Corporation 4-9 ESP-488 for the VXIcpu-030
ESP-488 Functions and Utilities Reference
DVRSP(3) device-level
Chapter 4
DVRSP(3)
Name dvrsp - return serial poll status byte from a GPIB device
Synopsis
#include "ugpib.h" dvrsp (a,spr) int a; char spr[];
Description a is the GPIB address of the device. The least significant byte (bits 0 through 7) contains the primary address and the next least significant byte (bits 8 through 15) contains the secondary address. If the device has no secondary address, pass a zero in bits 8 through
15. spr is the buffer in which the poll response is stored.
The dvrsp function is used to serial poll one device and obtain its status byte. If the
0x40 (RQS) bit of the response is set, the status response is positive, that is, the device is requesting service.
dvrsp sends the following commands and information:
• Unlisten (UNL)
• Listen address of the GPIB interface
• Secondary address of the GPIB interface, if applicable
• Serial Poll Enable (SPE)
• Talk address of the device
• Secondary address of the device, if applicable
After the response byte is read, dvrsp sends the following commands:
• Serial Poll Disable (SPD)
• Untalk (UNT)
The interpretation of the response in spr , other than the RQS bit, is device-specific. For example, the polled device might set a particular bit in the response byte to indicate that it has data to transfer, and another bit to indicate a need for reprogramming. Consult the documentation for the device for interpretation of the response byte.
ESP-488 for the VXIcpu-030 4-10 © National Instruments Corporation
Chapter 4 ESP-488 Functions and Utilities Reference
Example
Obtain the serial poll response byte from the device at address 7.
dvrsp (7,spr);
/* The application program would then analyze the response*/
/* in spr. */
See Also
ibcmd(3) and ibrd(3)
Chapter 2, The C Language Library
© National Instruments Corporation 4-11 ESP-488 for the VXIcpu-030
ESP-488 Functions and Utilities Reference
DVTRG(3) device-level
Chapter 4
DVTRG(3)
Name dvtrg - send Group Execute Trigger (GET) to a GPIB device
Synopsis
#include "ugpib.h" dvtrg (a) int a;
Description a is the GPIB address of the device. The least significant byte (bits 0 through 7) contains the primary address and the next least significant byte (bits 8 through 15) contains the secondary address. If the device has no secondary address, pass a zero in bits 8 through
15.
The dvtrg function addresses and triggers the specified device. dvtrg sends the following commands and information:
• Talk address of the GPIB interface
• Secondary address of the GPIB interface, if applicable
• Unlisten (UNL)
• Listen address of the device
• Secondary address of the device, if applicable
• Group Execute Trigger (GET)
The response to a trigger is device-dependent.
Examples
1. Trigger the device at address 3.
dvtrg(3);
2. Trigger the device at primary address 5 and secondary address 0x61.
dvtrg(0x6105);
See Also ibcmd(3)
Chapter 2, The C Language Library
ESP-488 for the VXIcpu-030 4-12 © National Instruments Corporation
Chapter 4
DVWRT(3) device-level
ESP-488 Functions and Utilities Reference
DVWRT(3)
Name dvwrt - write data to a GPIB device from a buffer
Synopsis
#include "ugpib.h" dvwrt (a,buf,cnt) int a,cnt; char buf[];
Description a is the GPIB address of the device. The least significant byte (bits 0 through 7) contains the primary address and the next least significant byte (bits 8 through 15) contains the secondary address. If the device has no secondary address, pass a zero in bits 8 through
15. buf contains the data to be sent over the GPIB. cnt specifies the number of bytes to be sent over the GPIB.
The dvwrt function writes cnt bytes of data to a GPIB device. Prior to writing the data, dvwrt sends the following commands and information:
• Talk address of the GPIB interface
• Secondary address of the GPIB interface, if applicable
• Unlisten (UNL)
• Listen address of the device
• Secondary address of the device, if applicable
When the dvwrt function returns, ibsta holds the latest GPIB status, ibcnt is the actual number of data bytes written to the device, and iberr is the first error detected if the ERR bit in ibsta is set.
The dvwrt operation terminates on any of the following events:
• All bytes are transferred.
• Error is detected.
• Time limit is exceeded.
After termination, ibcnt contains the number of bytes written. A short count can occur on any of the above events but the first.
© National Instruments Corporation 4-13 ESP-488 for the VXIcpu-030
ESP-488 Functions and Utilities Reference Chapter 4
Examples
1. Write 10 instruction bytes to the device at address 5 and secondary address 0x61.
dvwrt(0x6105,"F3R1X5P2G0",10);
2. Write five instruction bytes terminated by a carriage return and a linefeed to the device at address 3.
dvwrt(3,"IP2X5\r\n",7);
See Also
ibcmd(3) and ibwrt(3)
Chapter 2, The C Language Library
ESP-488 for the VXIcpu-030 4-14 © National Instruments Corporation
Chapter 4
IBCAC(3)
ESP-488 Functions and Utilities Reference
IBCAC(3) low-level
Name ibcac - become Active Controller
Synopsis
#include "ugpib.h" ibcac (v) int v;
Description v identifies the method used to take control.
If v is non-zero, the GPIB interface takes control synchronously with respect to data transfer operations; otherwise, the GPIB interface takes control immediately (and possibly asynchronously).
To take control synchronously, the GPIB interface waits before asserting the ATN signal so that data being transferred on the GPIB will not be corrupted. If a data handshake is in progress, the take control action is postponed until the handshake is complete; if a handshake is not in progress, the take control action is done immediately. Synchronous take control is not guaranteed if an ibrd or ibwrt operation completed with a timeout or error.
Asynchronous take control should be used in situations where it appears to be impossible to gain control synchronously (for example, after a timeout error).
It is generally not necessary to use the ibcac function. Functions, such as ibcmd and ibrpp (which require that the GPIB interface take control), take control automatically.
The ECIC error results if the GPIB interface is not Controller-In-Charge.
Examples
1. Take control immediately without regard to any data handshake in progress.
ibcac(0);
2. Take control synchronously and assert ATN following a read operation.
ibrd(rd,512) ; ibcac(1);
See Also
Chapter 2, The C Language Library
© National Instruments Corporation 4-15 ESP-488 for the VXIcpu-030
ESP-488 Functions and Utilities Reference
IBCMD(3)
Chapter 4
IBCMD(3) low-level
Name ibcmd - send command message to GPIB
Synopsis
#include "ugpib.h" ibcmd (cmd,cnt) int cnt; char cmd[];
Description cmd contains the commands to be sent over the GPIB. cnt specifies the number of bytes to be sent over the GPIB.
The ibcmd function is used to transmit interface messages (commands) over the GPIB.
These commands, which are listed in Appendix A, Multiline Interface Command
Messages, include device talk and device listen addresses, secondary addresses, serial and parallel poll configuration messages, and device clear and device trigger instructions.
The ibcmd function is also used to pass GPIB control to another device. This function is not used to transmit programming instructions to devices; programming instructions and other device-dependent information are transmitted with the ibwrt or dvwrt functions.
The ibcmd operation terminates on any of the following events:
• All commands are successfully transferred.
• Error is detected.
• Time limit is exceeded.
• Take Control (TCT) command is sent.
After termination, the ibcnt variable contains the number of commands sent. A short count can occur on any of the above events but the first.
An ECIC error results if the GPIB interface is not Controller-In-Charge. If it is not
Active Controller, it takes control and asserts ATN prior to sending the command bytes.
It remains Active Controller afterward.
In the examples that follow, GPIB commands and addresses are coded as printable ASCII characters. When the hex values to be sent over the GPIB correspond to printable ASCII characters, this is the simplest means of specifying the values. Refer to Appendix A for conversions of hex values to ASCII characters.
ESP-488 for the VXIcpu-030 4-16 © National Instruments Corporation
Chapter 4 ESP-488 Functions and Utilities Reference
Examples
1. Unaddress all listeners with the Unlisten command (ASCII ?) and address a talker at 0x46
(ASCII F) and a listener at 0x31 (ASCII 1).
ibcmd("?F1",3); /* UNL TAD LAD */
2. Unaddress all listeners with the Unlisten command (ASCII ?) and address a talker at 0x46
(ASCII F) and a listener at 0x31 (ASCII 1) and 0x6E (ASCII n).
ibcmd("?F1n",4); /* UNL TAD LAD SAD
3. Clear all GPIB devices (that is, reset internal functions) with the Device Clear (DCL) command (0x14).
ibcmd("\024",1); /* DCL (octal 24 or hex 14)
*/
*/
4. Clear two devices with listen addresses of 0x21 (ASCII !) and 0x28 (ASCII ( ) with the
Selected Device Clear (SDC) command (0x4).
ibcmd("?!(\004",4); /* UNL LAD LAD SDC */
5. Trigger any devices previously addressed to listen with the Group Execute Trigger (GET) command (0x8).
ibcmd("\010",1); /* GET */
6. Unaddress all listeners and serial poll a device at talk address 0x52 (ASCII R) using the
Serial Poll Enable (0x18) and Serial Poll Disable (0x19) commands (the listen address of the GPIB interface is 0x20 or ASCII blank).
ibcmd("?R \030",4); /* UNL TAD MLA SPE */ ibrd(rd,1); /* read one byte */
/* After checking the status byte in rd[0], disable this*/
/* device and unaddress it with the Untalk (UNT) command*/
/* (0x5F or ASCII _) before polling the next one.
*/ ibcmd("\031_",2); /* SPD UNT */
See Also
dvtrg(3), dvclr(3), dvrsp(3), ibcac(3), ibgts(3), and ibtmo(3).
Chapter 2, The C Language Library
© National Instruments Corporation 4-17 ESP-488 for the VXIcpu-030
ESP-488 Functions and Utilities Reference
IBEOS(3) low-level
Chapter 4
IBEOS(3)
Name ibeos - change or disable end-of-string mode
Synopsis
#include "ugpib.h" ibeos (v) int v;
Description v selects the EOS character and the data transfer termination method according to Table
A-5. ibeos is needed only to alter the value from its default setting of zero.
The assignment made by this function remains in effect until ibeos is called again or the ibonl function is called.
Table 4-5. Data Transfer Termination Method
Method
A. Terminate read when EOS is detected.
B. Set EOI with EOS on write function.
C. Compare all 8 bits of EOS byte rather than low 7 bits (all read and write functions).
Value of v
High Byte Low Byte
0x04 ( REOS )
0x08 ( XEOS )
EOS
EOS
0x10 ( BIN ) EOS
Methods A and C determine how read operations terminate. If Method A alone is chosen, reads terminate when the low seven bits of the byte that is read match the low seven bits of the EOS character. If Methods A and C are chosen, a full 8-bit comparison is used.
Methods B and C together determine when write operations send the END message. If
Method B alone is chosen, the END message is sent automatically with the EOS byte when the low seven bits of that byte match the low seven bits of the EOS character. If
Methods B and C are chosen, a full 8-bit comparison is used.
The options coded in v are used for both low-level and device-level reads and writes.
ESP-488 for the VXIcpu-030 4-18 © National Instruments Corporation
Chapter 4 ESP-488 Functions and Utilities Reference
Examples
1. Send END when the linefeed character is written for all subsequent write operations.
v = (XEOS<<8) | '\n'; /* or v = 0x080A ibeos(v); wrt[0] = '1'; wrt[1] = '2';
/* data bytes to be written wrt[2] = '3'; wrt[3] = '\n'; dvwrt(3,wrt,4);
/* EOS character is last byte
2. Program the GPIB interface to terminate a read on detection of the linefeed character
( '\n'==0x0A ) that is expected to be received within 512 bytes.
*/
*/
*/ v = (REOS<<8) | '\n'; /* or v = 0x040A */ ibeos(v);
/* assume interface has been addressed; do low-level read */ ibrd(rd,512);
/* The END bit in ibsta is set if the read terminated */
/* on the EOS character, with the actual number of bytes */
/* received contained in ibcnt.
*/
3. Program the GPIB interface to terminate read operations on the 8-bit value 0x82 rather than the 7-bit character 0x0A.
v = ((BIN | REOS)<<8) | 0x82; /* or v = 0x1482 ibeos(v);
*/
/* assume interface has been addressed; do low-level read */ ibrd(rd,512);
/* The END bit in ibsta is set if the read terminated */
/* on the EOS character, with the actual number of bytes */
/* received contained in ibcnt.
*/
4. Disable use of the EOS character for all subsequent read and write operations.
ibeos(0); /* No EOS modes enabled */
5. Send END with linefeeds and terminate reads on linefeeds for all subsequent I/O operations.
v = ((REOS | XEOS)<<8) | 0x0A;/* or v = 0x180A ibeos(v); wrt[0] = '1'; /* data bytes to be written wrt[1] = '2'; wrt[2] = '3'; wrt[3] = 0x0A; ibwrt(wrt,4);
/* EOS character is last byte
*/
*/
*/
See Also
ibeot(3) and ibonl(3)
Chapter 2, The C Language Library
© National Instruments Corporation 4-19 ESP-488 for the VXIcpu-030
ESP-488 Functions and Utilities Reference
IBEOT(3)
Chapter 4
IBEOT(3) low-level
Name ibeot - change or disable END termination mode
Synopsis
#include "ugpib.h" ibeot (v) int v;
Description
If v is non-zero, the END message is sent automatically with the last byte of each write operation. If v is zero, END is not sent. ibeot is needed only to alter the value from its default setting of one.
The END message is sent by asserting the GPIB EOI signal during a data transfer. It is used to identify the last byte of a data string without having to use an End-Of-String character. ibeot is used primarily to send variable length binary data.
The option specified in v is used for both low-level and device-level write operations.
The assignment made by this function remains in effect until ibeot is called again or the ibonl function is called.
Examples
1. Send the END message with the last byte of all subsequent write operations.
ibeot(1); /* enable sending of EOI */
/* It is assumed that wrt contains the data to be written */
/* to the GPIB device at address 7 */ dvwrt(7,wrt,3); /* write 3 bytes */
2. Stop sending END with the last byte for all subsequent write operations.
ibeot(0); /* disable sending EOI
See Also
ibeos(3) and ibonl(3)
Chapter 2, The C Language Library
*/
ESP-488 for the VXIcpu-030 4-20 © National Instruments Corporation
Chapter 4
IBGTS(3)
ESP-488 Functions and Utilities Reference
IBGTS(3) low-level
Name ibgts - go from Active Controller to standby
Synopsis
#include "ugpib.h" ibgts ()
Description
The ibgts function causes the GPIB interface to go to the Controller Standby state and to deassert the ATN signal if it is the Active Controller. ibgts permits GPIB devices to transfer data without the GPIB interface being a party to the transfer.
The ECIC error results if the GPIB interface is not Controller-In-Charge.
Example
Turn the ATN line off.
ibgts();
See Also
ibcmd(3) and ibcac(3)
Chapter 2, The C Language Library
© National Instruments Corporation 4-21 ESP-488 for the VXIcpu-030
ESP-488 Functions and Utilities Reference
IBLINES(3)
Chapter 4
IBLINES(3) low-level
Name iblines - return the status of the GPIB control lines
Synopsis
#include "ugpib.h" iblines (clines) int *clines;
Description
A valid mask is returned along with the GPIB control line state information in clines . The low-order byte (bits 0 through 7) of clines contains a mask indicating the capability of the GPIB interface to sense the status of each GPIB control line. The next-order byte (bits 8 through 15) contains the GPIB control line state information. Bits 16 through 31 are undefined. The pattern of the defined bits is as follows:
7 6 5 4 3 2 1 0
EOI ATN SRQ REN IFC NRFD NDAC DAV
To determine if a GPIB control line is asserted, first check the appropriate bit in the lower byte to determine if the line can be monitored. If the line can be monitored
(indicated by a 1 in the appropriate bit position), check the corresponding bit in the upper byte. If the bit is set (1), the corresponding control line is asserted. If the bit is clear (0), the control line is deasserted.
Example
Test for Remote Enable (REN).
if (iblines(&clines) < 0) error(); if ( !
(clines & 0x10)) {
printf("GPIB interface can't monitor REN!");
exit();
} if (clines & 0x1000)
printf("REN is asserted."); else
printf("REN is not asserted.");
See Also ibwait(3)
Chapter 2, The C Language Library
ESP-488 for the VXIcpu-030 4-22 © National Instruments Corporation
Chapter 4
IBONL(3)
ESP-488 Functions and Utilities Reference
IBONL(3) low-level
Name ibonl - place the GPIB interface online or offline
Synopsis
#include "ugpib.h" ibonl (v) int v;
Description v specifies online or offline.
ibonl initializes all hardware and software and is used to bring the GPIB interface online for the first time. ibonl must be called with v non-zero before any other GPIB functions can be called. If v is zero, the GPIB interface will be left offline, not participating in GPIB activity.
During program operation, call ibonl with v non-zero to reset the GPIB hardware and software to its power-on state.
Examples
1. Bring the GPIB interface online for the first time.
ibonl(1);
2. Disable the GPIB interface.
ibonl(0);
See Also
Chapter 2, The C Language Library
© National Instruments Corporation 4-23 ESP-488 for the VXIcpu-030
ESP-488 Functions and Utilities Reference
IBPAD(3)
Chapter 4
IBPAD(3) low-level
Name ibpad - change primary address of the GPIB interface
Synopsis
#include "ugpib.h" ibpad (v) int v;
Description v specifies the primary GPIB address.
ibpad is used to alter the primary address from its default setting of zero. The listen address is formed by adding 0x20 to the primary address; the talk address is formed by adding 0x40 to the primary address.
Only the low five bits of v are significant and they must be in the range of 0 through
0x1E.
The assignment made by this function remains in effect until ibpad is called again or the ibonl function is called.
Example
Change the primary GPIB listen and talk address of the GPIB interface from its current value to 0x27 and 0x47, respectively.
ibpad(7);
See Also ibsad(3)
Chapter 2, The C Language Library
ESP-488 for the VXIcpu-030 4-24 © National Instruments Corporation
Chapter 4
IBRD(3)
ESP-488 Functions and Utilities Reference
IBRD(3) low-level
Name ibrd - read data from the GPIB into a buffer
Synopsis
#include "ugpib.h" ibrd (buf,cnt) int cnt; char buf[];
Description buf identifies the buffer to use. cnt specifies the number of bytes to read from the
GPIB.
The ibrd function reads cnt bytes of data from a GPIB device. The device is assumed to be already properly initialized and addressed.
If the GPIB interface is Controller-In-Charge (CIC), the ibcmd function must be called prior to ibrd to address a device to talk and the interface to listen. If the interface is not
CIC, the device on the GPIB that is the CIC must perform the addressing.
If the GPIB interface is Active Controller, the interface is first placed in Standby
Controller state, with ATN off, and remains there after the read operation is completed.
An EADR error results if the interface is CIC but has not been addressed to listen with the ibcmd function. An EABO error results if the interface is not the CIC and is not addressed to listen within the time limit. An EABO error also results if the device that is to talk is not addressed and/or the operation does not complete for whatever reason within the time limit.
The ibrd operation terminates on any of the following events.
• Allocated buffer becomes full.
• Error is detected.
• Time limit is exceeded.
• END message is detected.
After termination, ibcnt contains the number of bytes read. A short count can occur on any of the above events but the first.
© National Instruments Corporation 4-25 ESP-488 for the VXIcpu-030
ESP-488 Functions and Utilities Reference Chapter 4
Example
Read 1024 bytes of data from a device at talk address 0x4C (ASCII L) and then unaddress it (the GPIB interface is at listen address 0x20 or ASCII blank).
ibcmd("?L ",3); /* UNL TAD MLA */ ibrd(rdbuf,1024);
/* Check ibsta to see how the read terminated: on CMPL, */
/* END, TIMO, or ERR.
/* Data is stored in rdbuf.
/* Unaddress the talker and listener.
ibcmd("_?",1); /* UNT UNL
*/
*/
*/
*/
See Also
ibcmd(3) and dvrd(3)
Chapter 2, The C Language Library
ESP-488 for the VXIcpu-030 4-26 © National Instruments Corporation
Chapter 4
IBRPP(3)
ESP-488 Functions and Utilities Reference
IBRPP(3) low-level
Name ibrpp - conduct a parallel poll
Synopsis
#include "ugpib.h" ibrpp (ppr) char *ppr;
Description ppr identifies the address where the parallel poll response byte is stored.
The ibrpp function causes the GPIB interface to conduct a parallel poll of previously configured devices by sending the Identify (IDY) message (ATN and EOI both asserted).
An ECIC error results if the GPIB interface is not Controller-In-Charge. If the GPIB interface is Standby Controller, it takes control and asserts ATN (becomes Active) prior to polling. It remains Active Controller afterward.
Examples
1. Remotely configure a device at listen address 0x23 to respond positively on DIO3 if its individual status bit is one, and then parallel poll all configured devices.
cmd[0] = 0x23; /* device listen address cmd[1] = PPC; cmd[2] = PPE | S | 2; /* send PPR3 if ist = 1 cmd[3] = UNL; ibcmd(cmd,4); ibrpp(&ppr); /* PPR returned in ppr
*/
*/
*/
2. Disable and unconfigure all GPIB devices from parallel polling using the PPU command.
*/ ibcmd("\x15",1); /* PPU
See Also ibcmd(3)
Chapter 2, The C Language Library
© National Instruments Corporation 4-27 ESP-488 for the VXIcpu-030
ESP-488 Functions and Utilities Reference
IBRSV(3)
Chapter 4
IBRSV(3) low-level
Name ibrsv - request service and/or set serial poll status byte
Synopsis
#include "ugpib.h" ibrsv (v) int v;
Description v specifies the serial poll response byte of the GPIB interface.
If the 0x40 bit is set in v , the GPIB interface additionally requests service from the controller by asserting the GPIB SRQ line.
The function is used to request service from the controller using the SRQ signal and to provide a system-dependent status byte when the controller serial polls the GPIB interface.
It is not an error to call the ibrsv function when the GPIB interface is the Controller-In-
Charge (CIC), although doing so makes sense only if control will be passed later to another device. In this case, the call updates the status byte, but the SRQ signal is asserted only if the 0x40 bit is set and only when control is passed.
Examples
1. Set the serial poll status byte to 0x41, which simultaneously requests service from an external CIC.
ibrsv(0x41);
2. Stop requesting service (unassert SRQ).
ibrsv(0);
3. Change the status byte without requesting service.
ibrsv(0x01); /* new status byte value
See Also dvrsp(3)
Chapter 2, The C Language Library
*/
ESP-488 for the VXIcpu-030 4-28 © National Instruments Corporation
Chapter 4
IBSAD(3)
ESP-488 Functions and Utilities Reference
IBSAD(3) low-level
Name ibsad - change or disable secondary address of the GPIB interface
Synopsis
#include "ugpib.h" ibsad (v) int v;
Description v is a valid secondary address.
If v is a number between 0x60 and 0x7E, that number becomes the secondary GPIB address of the GPIB interface. If v is 0 or 0x7F, secondary addressing is disabled.
ibsad is needed only to alter the value from its default setting of zero (disabled).
The assignment made by this function remains in effect until ibsad is called again or the ibonl function is called.
Examples
1. Change the secondary GPIB address of the GPIB interface from its current value to
0x6A.
ibsad(0x6A);
2. Disable secondary addressing for the GPIB interface.
ibsad(0);
See Also
ibpad(3) and ibcmd(3)
Chapter 2, The C Language Library
© National Instruments Corporation 4-29 ESP-488 for the VXIcpu-030
ESP-488 Functions and Utilities Reference
IBSIC(3)
Chapter 4
IBSIC(3) low-level
Name ibsic - send Interface Clear (IFC)
Synopsis
#include "ugpib.h" ibsic ()
Description
The ibsic function causes the GPIB interface to assert the IFC signal for at least 100
µ s. This action initializes the GPIB and makes the interface Controller-In-Charge (CIC).
It is generally used to become CIC or to clear a bus fault condition.
The IFC signal is supposed to reset only the GPIB interface functions of bus devices and is not intended to reset internal device functions. Device functions are reset with the
Device Clear (DCL) and Selected Device Clear (SDC) commands. To determine the effect of these messages, consult the device documentation.
Example
Initialize the GPIB and become CIC at the beginning of a program.
ibsic();
See Also
dvclr(3) and ibcmd(3)
Chapter 2, The C Language Library
ESP-488 for the VXIcpu-030 4-30 © National Instruments Corporation
Chapter 4
IBSRE(3)
ESP-488 Functions and Utilities Reference
IBSRE(3) low-level
Name ibsre - set or clear the Remote Enable (REN) line
Synopsis
#include "ugpib.h" ibsre (v) int v;
Description v specifies set or clear.
If v is non-zero, the Remote Enable (REN) signal is asserted. If v is zero, the signal is deasserted.
The ibsre function turns the REN signal on and off. REN is used by devices to select between local and remote modes of operation. REN enables the remote mode. A device does not actually enter remote mode until it receives its listen address.
Examples
1.
Place a device at listen address 0x23 (ASCII #) in remote mode with local ability to return to local mode.
ibsre(1); ibcmd("#",1);
/* set REN to true
/* LAD
*/
*/
2.
Exclude the local ability of the device to return to local mode by sending the Local
Lockout command (0x11), or include it in the command string in Example 1.
/* LLO ibcmd("\x11"); or ibsre(1); ibcmd("#\x11");
/* REN true
/* LAD LLO
*/
*/
*/
3.
Return all devices to local mode.
ibsre(0); /* set REN to false
See Also ibsic(3)
Chapter 2, The C Language Library
*/
© National Instruments Corporation 4-31 ESP-488 for the VXIcpu-030
ESP-488 Functions and Utilities Reference
IBTMO(3) low-level
Name ibtmo - change or disable time limit synopsis
# include "ugpib.h" ibtmo (v) int v;
Description v is a code specifying the time limit. Table 4-6 lists the timeout settings.
Table 4-6. Timeout Settings
T1s
T3s
Code
TNONE
T10us
T30us
T100us
T300us
T1ms
T3ms
T10ms
T30ms
T100ms
T300ms
T10s
T30s
T100s
T300s
T1000s
Actual
Value
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Minimum
Timeout disabled*
10
µ s
30
µ s
100
µ s
300
µ s
1 ms
3 ms
10 ms
30 ms
100 ms
300 ms
1 s
3 s
10 s
30 s
100 s
300 s
1000 s
* If you select TNONE, no limit will be in effect and I/O operations could proceed indefinitely.
Chapter 4
IBTMO(3)
ESP-488 for the VXIcpu-030 4-32 © National Instruments Corporation
Chapter 4 ESP-488 Functions and Utilities Reference ibtmo is needed only to alter the value from its default setting of T10s .
The time limit is an escape mechanism used to exit gracefully from a "hung bus" condition. Since the GPIB is an asynchronous bus, read and write operations can be held up indefinitely.
Timeout values are approximate, though never less than indicated.
Examples
1. Change the time limit for GPIB I/O operations to approximately 300 ms.
ibtmo(T300ms);
2. Perform I/O operations with no timeout in effect (not recommended).
ibtmo(0);
See Also
Chapter 2, The C Language Library
© National Instruments Corporation 4-33 ESP-488 for the VXIcpu-030
ESP-488 Functions and Utilities Reference
IBWAIT(3) low-level
Chapter 4
IBWAIT(3)
Name ibwait - wait for selected events
Synopsis
#include "ugpib.h" ibwait (mask) int mask;
Description mask is a bit mask with the same bit assignments as the status word, ibsta .
A mask bit is set to wait for the corresponding event to occur.
The ibwait function is used to monitor the events selected in mask and to delay processing until any of them occur. These events and bit assignments are shown in Table
4-7.
Table 4-7. Wait Mask Layout
Mnemonic Bit
Position
TIMO 14
SRQI 12
CIC
TACS
LACS 2
5
3
Hex
Value
4000
1000
20
8
4
Description
Time limit exceeded
GPIB interface is CIC
GPIB interface is talker
GPIB interface is listener
If mask =0, the function returns immediately. This is used to report the current GPIB interface state.
The TIMO bit is automatically included with any non-zero mask . If the time limit is set to 0, timeouts are disabled. Disabling timeouts should be done only when it is certain the selected event will occur.
All activity on the GPIB interface is suspended until the event occurs.
ESP-488 for the VXIcpu-030 4-34 © National Instruments Corporation
Chapter 4 ESP-488 Functions and Utilities Reference
Examples
1. Wait for a service request or a timeout.
ibwait(SRQI|TIMO);
2. Report the current status for ibsta .
ibwait(0);
3. Wait until control is passed from another Controller-In-Charge (CIC).
ibwait(CIC);
4. Wait until addressed to talk or listen by another CIC.
ibwait(TACS|LACS);
See Also ibtmo(3)
Chapter 2, The C Language Library
© National Instruments Corporation 4-35 ESP-488 for the VXIcpu-030
ESP-488 Functions and Utilities Reference
IBWRT(3)
Chapter 4
IBWRT(3) low-level
Name ibwrt - write data to GPIB from a buffer
Synopsis
#include "ugpib.h" ibwrt (buf,cnt) int cnt; char buf[];
Description buf contains the data to be sent over the GPIB. cnt specifies the number of bytes to be sent over the GPIB.
The ibwrt function writes cnt bytes of data to a GPIB device. The device is assumed to be already properly initialized and addressed.
If the GPIB interface is Controller-In-Charge (CIC), the ibcmd function must be called prior to ibwrt to address the device to listen and the interface to talk. Otherwise, the device on the GPIB that is the CIC must perform the addressing.
If the GPIB interface is Active Controller, the interface is first placed in Standby
Controller state with ATN off and remains there after the write operation has completed.
Otherwise, the write operation commences immediately. An EADR error results if the interface is CIC but has not been addressed to talk with the ibcmd function. An EABO error results if the interface is not the CIC and is not addressed to talk within the time limit. An EABO error also results if the operation does not complete for whatever reason within the time limit.
The ibwrt operation terminates on any of the following events:
• All bytes are transferred.
• Error is detected.
• Time limit is exceeded.
After termination, ibcnt contains the number of bytes written. A short count can occur on any of the above events but the first.
ESP-488 for the VXIcpu-030 4-36 © National Instruments Corporation
Chapter 4 ESP-488 Functions and Utilities Reference
Example
Write 10 instruction bytes to a device at listen address 0x35 (ASCII 5) and then unaddress it (the talk address of the GPIB interface is 0x40 or ASCII @).
ibcmd("?@5",3); /* UNL MTA LAD
/* send instruction bytes ibwrt("F3R1X5P2G0",10);
/* unaddress all listeners and talkers ibcmd("_?",2); /* UNT UNL
See Also
ibcmd(3) and dvwrt(3)
Chapter 2, The C Language Library
*/
*/
*/
*/
© National Instruments Corporation 4-37 ESP-488 for the VXIcpu-030
Appendix A
Multiline Interface Command Messages
The following tables are multiline interface messages (sent and received with ATN TRUE).
© National Instruments Corporation A-1 ESP-488 for the VXIcpu-030
Multiline Interface Command Messages
Multiline Interface Messages
Appendix A
Hex Oct Dec ASCII Msg
10
11
12
13
14
15
16
17
00
01
02
03
04
05
06
07
08
09
010
011
0A 012
0B 013
0C 014
0D 015
0E 016
0F 017
000
001
002
003
004
005
006
007
020
021
022
023
024
025
026
027
0 NUL
1 SOH
2 STX
3 ETX
4 EOT
5 ENQ
6 ACK
7 BEL
8 BS
9 HT
10 LF
11 VT
12 FF
13 CR
14 SO
15 SI
16 DLE
17 DC1
18 DC2
19 DC3
20 DC4
21 NAK
22 SYN
23 ETB
Hex Oct
GTL
SDC
PPC
GET
TCT
LLO
30
31
32
DCL
33
34
PPU 35
36
37
20
21
22
23
24
25
26
27
28
29
050
051
2A 052
2B 053
2C 054
2D 055
2E 056
2F 057
040
041
042
043
044
045
046
047
060
061
062
063
064
066
067
Dec
48
49
50
51
52
54
55
44
45
46
47
40
41
42
43
32
33
34
35
36
37
38
39
ASCII Msg
5
6
3
4
7
0
1
2
'
#
$
%
&
SP
!
"
MLA0
MLA1
MLA2
MLA3
MLA4
MLA5
MLA6
MLA7
*
+
)
( MLA8
MLA9
MLA10
MLA11
/
.
, MLA12
- MLA13
MLA14
MLA15
MLA16
MLA17
MLA18
MLA19
MLA20
MLA21
MLA22
MLA23
18
19
030
031
1A 032
1B 033
24 CAN
25 EM
26 SUB
27 ESC
SPE
SPD
38
39
070
071
3A 072
3B 073
56
57
58
59 ;
:
8
9
MLA24
MLA25
MLA26
MLA27
1C 034
1D 035
1E 036
1F 037
28
29
30
31
FS
GS
RS
US
3C
3D
3E
3F
074
075
076
077
60
61
62
63
<
=
>
?
MLA28
MLA29
MLA30
UNL
Message Definitions
DCL Device Clear
GET Group Execute Trigger
GTL Go To Local
LLO Local Lockout
MLA My Listen Address
MSA My Secondary Address
MTA My Talk Address
PPC Parallel Poll Configure
PPD Parallel Poll Disable
ESP-488 for the VXIcpu-030 A-2 © National Instruments Corporation
Appendix A Multiline Interface Command Messages
Multiline Interface Messages
Hex Oct Dec ASCII Msg Hex Oct Dec ASCII Msg
40
41
42
43
44
45
46
47
48
49
110
111
4A 112
4B 113
4C 114
4D 115
4E 116
4F 117
100
101
102
103
104
105
106
107
76
77
78
79
72
73
74
75
64
65
66
67
68
69
70
71
L
M
N
O
I
H
J
K
C
D
E
F
G
@
A
B
MTA0
MTA1
MTA2
MTA3
MTA4
MTA5
MTA6
MTA7
MTA8
MTA9
MTA10
MTA11
MTA12
MTA13
MTA14
MTA15
60 140
61 141
62 142 98
63 143 99
64 144 100
65 145 101
66 146 102
67 147 103
68 150 104
69 151 105
6A 152
6B 153
6C 154
6D 155
6E156 110
6F 157 111
96 ` MSA0,PPE
97 a MSA1,PPE b MSA2,PPE c MSA3,PPE d MSA4,PPE e MSA5,PPE f MSA6,PPE g MSA7,PPE h MSA8,PPE i MSA9,PPE
106 j
107 k
MSA10,PPE
MSA11,PPE
108 l MSA12,PPE
109 m MSA13,PPE n MSA14,PPE o MSA15,PPE
50
51
52
53
54
55
56
57
120
121
122
123
124
125
126
127
80
81
82
83
84
85
86
87
P
Q
R
S
T
U
V
W
MTA16
MTA17
MTA18
MTA19
MTA20
MTA21
MTA22
MTA23
70 160 112
71 161 113
72 162 114
73 163 115
74 164 116
75 165 117
76 166 118
77 167 119 p MSA16,PPD q MSA17,PPD r MSA18,PPD s MSA19,PPD t MSA20,PPD u MSA21,PPD v MSA22,PPD w MSA23,PPD
58
59
130
131
5A 132
5B 133
88
89
90
91
X
Y
[
Z
MTA24
MTA25
MTA26
MTA27
78 170 120
79 171 121
7A 172
7B 173 x MSA24,PPD y MSA25,PPD
122 z
123 {
MSA26,PPD
MSA27,PPD
5C 134
5D 135
5E 136
5F 137
92
93
94
95
\
]
^
_
MTA28
MTA29
MTA30
UNT
7C
7D
174
175
7E176 126
7F 177 127
124
125
~
DEL
|
}
MSA28,PPD
MSA29,PPD
MSA30,PPD
PPE Parallel Poll Enable
PPU Parallel Poll Unconfigure
SDC Selected Device Clear
SPD Serial Poll Disable
SPE Serial Poll Enable
TCT Take Control
UNL Unlisten
UNT Untalk
© National Instruments Corporation A-3 ESP-488 for the VXIcpu-030
Appendix B
Software Configuration and Installation
This appendix contains instructions for configuring and installing the GPIB software.
The ESP-488 VxWorks software is distributed as part of the VxWorks distribution for the
VXIcpu-030. Please refer to Getting Started with Your VXIcpu-030 and the NI-VXI Software for
the VxWorks Operating System for instructions on how to install the distribution media. The
ESP-488 files are contained in the GPIB directory. Table B-1 describes the files included in the distribution media.
File Name
Readme esp488.o
ibic.o
ibsta.o
ibstb.o
ugpib.h
Table B-1. Software Distribution Files
Description
Up-to-date information not included in this manual
ESP-488 driver library module
Interface Bus Interactive Control program
Software Installation Test, Part A
Software Installation Test, Part B
User include file for ESP-488 applications
A separate ESP-488 package is also available to control GPIB-1014/1014D VME boards. The kit includes the GPIB-1014/1014D board, VxWorks ESP-488 software, and a GPIB reference manual.
Please refer to ESP-488 for VxWorks and the GPIB-1014/1014D Software Reference Manual
(part number 320429-01) for more information.
© National Instruments Corporation B-1 ESP-488 for the VXIcpu-030
Appendix C
GPIB Programming Example
This appendix illustrates the steps involved in programming a representative IEEE-488 instrument from a terminal using the ESP-488 functions in C language. This appendix is designed to help you learn how to use the ESP-488 driver software to execute certain programming and control sequences.
The target instrument is a digital voltmeter (DVM). This instrument is otherwise unspecified.
The purpose here is to explain how to use the driver software to execute certain programming and control sequences, not how to determine those sequences.
Because the instructions that are sent to program a device as well as the data that might be returned from the device are called device-dependent messages, the format and syntax of the messages used in this example are unique to this device. Furthermore, the interface messages or
bus commands that must be sent to devices will also vary, but to a lesser degree. The exact sequence of messages to program and to control a particular device are contained in its documentation.
For example, the following sequence of actions is assumed to be necessary to program this DVM to make and return measurements of a high-frequency AC voltage signal in the autoranging mode:
1. Initialize the GPIB interface circuits of the DVM so that it can respond to messages.
2. Place the DVM in remote programming mode and turn off the front panel control.
3. Initialize the internal measurement circuits.
4. Program the DVM to perform the proper function (F3 for high-frequency AC volts), range
(R7 for autoranging), and trigger source (T3 for external or remote).
5. For each measurement: a. Send the Group Execute Trigger (GET) command to trigger the DVM.
b. Wait until the DVM asserts Service Request (SRQ) to indicate that the measurement is ready to be read.
c. Serial poll the DVM to determine if the measured data is valid (status byte = 0xC0) or if a fault condition exists (the 0x40 bit and another bit of the status byte, other than 0x80, are set).
d. If the data is valid, read 16 bytes from the DVM.
6. End the session.
The example program given here also assumes that the GPIB interface is the designated
System Active Controller of the GPIB and that the DVM is the only instrument connected to the bus.
© National Instruments Corporation C-1 ESP-488 for the VXIcpu-030
GPIB Programming Example Appendix C
Example Program
#include "ugpib.h" char char char cmd[512]; rd[512]; wrt[512];
/* command buffer
/* read buffer
/* write buffer
*/
*/
*/ unsigned int mask; /* events to be waited for */ main() { int dvm;
/* Bring GPIB interface online and initialize the bus.
*/ ibonl (1); ibsic ();
/* Set the DVM for primary address 3, no secondary
address.
dvm = 3;
*/
/* Place the device in Remote state with Local Lockout
(RWLS).
if (ibsre(1) & ERR) err(); if (ibcmd("#\021",2) & ERR) err(); /* LAD3 LLO
*/
*/
/* Send the Selected Device Clear (SDC) message to clear
internal device functions.
if (dvclr(dvm) & ERR) err();
*/
/* Write the function, range, and trigger source
instructions to the DVM.
if (dvwrt(dvm,"F3R7T3",6) & ERR) err();
/* Send the Group Execute Trigger (GET) message to
trigger a measurement reading.
if (dvtrg(dvm) & ERR) err();
/* Wait for the DVM to set SRQ or for a timeout.
if (ibwait(TIMO|SRQI) & (ERR|TIMO)) err();
*/
*/
*/
/* Read serial poll response; if not equal to 0xC0,
report dvm error.
if (dvrsp(dvm,rd) & ERR) err(); if ( (rd[0] & 0xFF) != 0xC0) dvmerr();
/* Read the measurement.
if (dvrd(dvm,rd,16) & ERR) err();
/* Take the GPIB interface offline. ibonl(0);
*/
*/
*/
}
ESP-488 for the VXIcpu-030 C-2 © National Instruments Corporation
Appendix C GPIB Programming Example err(){
/* An error checking routine at this location would, among other
things, check iberr to determine the exact cause of the error
condition and then take action appropriate to the application.
For errors during data transfers, ibcnt can be examined to
determine the actual number of bytes transferred.
}
*/ dvmerr() {
/* A routine at this location would analyze the fault code
returned in the DVM's status byte and take appropriate
action.
}
*/
© National Instruments Corporation C-3 ESP-488 for the VXIcpu-030
Appendix D
Customer Communication
For your convenience, this appendix contains forms to help you gather the information necessary to help us solve technical problems you might have as well as a form you can use to comment on the product documentation. Filling out a copy of the Technical Support Form before contacting National Instruments helps us help you better and faster.
National Instruments provides comprehensive technical assistance around the world. In the U.S. and Canada, applications engineers are available Monday through Friday from 8:00 a.m. to 6:00 p.m. (central time). In other countries, contact the nearest branch office. You may fax questions to us at any time.
Corporate Headquarters
(512) 795-8248
Technical support fax: (800) 328-2203
(512) 794-5678
Branch Offices
Australia
Phone Number
(03) 879 9422
Austria (0662) 435986
Belgium 02/757.00.20
Denmark
Finland
France
Germany
45 76 26 00
(90) 527 2321
(1) 48 14 24 00
089/741 31 30
Italy 02/48301892
Japan (03) 3788-1921
Netherlands 03480-33466
Norway 32-848400
Spain
Sweden
Switzerland
U.K.
(91) 640 0085
08-730 49 70
056/20 51 51
0635 523545
Fax Number
(03) 879 9179
(0662) 437010-19
02/757.03.11
45 76 71 11
(90) 502 2930
(1) 48 14 24 14
089/714 60 35
02/48301915
(03) 3788-1923
03480-30673
32-848600
(91) 640 0533
08-730 43 70
056/20 51 55
0635 523154
© National Instruments Corporation D-1 ESP-488 for the VXIcpu-030
Technical Support Form
___________________________________________________
Photocopy this form and update it each time you make changes to your software or hardware, and use the completed copy of this form as a reference for your current configuration. Completing this form accurately before contacting
National Instruments for technical support helps our applications engineers answer your questions more efficiently.
If you are using any National Instruments hardware or software products related to this problem, include the configuration forms from their user manuals. Include additional pages if necessary.
Name
Company
Address
Fax ( ) Phone ( )
Computer brand Model Processor
Operating system
Speed MHz RAM MB Display adapter
Mouse yes no
Hard disk capacity MB
Other adapters installed
Brand
Instruments used
National Instruments hardware product model Revision
Configuration
National Instruments software product Version
Configuration
The problem is
List any error messages
The following steps will reproduce the problem
ESP-488 Hardware and Software
Configuration Form
Please fill out the VXIcpu-030 Hardware and Software Configuration Form found in the Customer Communication section of Getting Started with Your VXIcpu-030 and the NI-VXI Software for the VxWorks Operating System. In addition, if you are using a GPIB-1014/1014D board in your system, please also fill out the configuration form found in the ESP-488 for VxWorks and the GPIB-1014/1014D Software Reference Manual.
• Did you recompile the ESP-488 driver source files?
• If yes, did you make any changes to the driver source files? Please explain:
Documentation Comment Form
National Instruments encourages you to comment on the documentation supplied with our products. This information helps us provide quality products to meet your needs.
Title: ESP-488 Software Reference Manual for the VXIcpu-030
®
Edition Date: July 1994
Part Number: 320345-01
Please comment on the completeness, clarity, and organization of the manual.
If you find errors in the manual, please record the page numbers and describe the errors.
Thank you for your help.
Name
Title
Company
Address
Mail to: Technical Publications
National Instruments Corporation
6504 Bridge Point Parkway, MS 53-02
Austin, TX 78730-5039
Fax to: Technical Publications
National Instruments Corporation
MS 53-02
(512) 794-5678
Glossary
___________________________________________________
Prefix
µ
m-
M-
Meaning micromillimega-
Value
10 -6
10 -3
10 6
GPIB
GTL hex
Hz
END
EOI
EOS
ERR
GET
ANSI
ATN
American National Standards Institute a GPIB line that distinguishes between commands and data messages.
CIC Controller-in-Charge
CMPL I/O operation completed
DCL Device Clear; a command used to reset the device or internal functions of all devices.
End of a data string
End Or Identify; a line used to signal either the last byte of a data message
(END) or the parallel poll Identify (IDY) message.
End of String character sent as the last byte of a data message.
GPIB Error bit
Group Execute Trigger; a command used to trigger a device or internal function of an address Listener.
General Purpose Interface Bus; the industry standard IEEE 488 bus.
Go To Local; a command used to place an addressed Listener in local
(front panel) control mode.
hexadecimal; the numbering system with base 16, using the digits 0 to 9 and letters A to F.
hertz (cycles per second)
© National Instruments Corporation Glossary-1 ESP-488 for the VXIcpu-030
PPC
PPD
PPE
PPU
REN
Glossary ibic
IDY Identify
IEEE Institute for Electrical and Electronic Engineers
IFC
Interface Bus Interactive Control program; used to communicate with
GPIB devices, troubleshoot problems, and develop your application.
Interface Clear; a GPIB line used by the System Controller to initialize the bus.
I/O
LACS
Listener
LLO input/output
Addressed to listen.
A GPIB device that receives data messages from a Talker.
Local Lockout; a command used to tell all devices that they may or should ignore remote (GPIB) data messages or local (front panel) controls, depending on whether the device is in local or remote program mode.
M
MLA
MSA
MTA octal megabytes of memory
My Listen Address; a command used to address a device to be a Listener.
My Secondary Address; a command used to address a device to be a
Listener or a Talker when extended (two byte) addressing is used.
My Talk Address; a command used to address a device to be a Talker.
numbering system with base 8, using numerals 0 to 7.
SDC
Parallel Poll Configure; a command used to configure an addressed
Listener to participate in polls.
Parallel Poll Disable; a command used to disable a configured device from participating in polls.
Parallel Poll Enable; a command used to enable a configured device to participate in polls and to assign a response line.
Parallel Poll Unconfigure; a command used to disable any device from participating in polls.
Remote Enable; a GPIB line controlled by the System Controller but used by the CIC to place devices in remote program mode.
Selected Device Clear; a command used to reset internal or device functions of an addressed Listener.
ESP-488 for the VXIcpu-030 Glossary-2 © National Instruments Corporation
Glossary s
SPD seconds
Serial Poll Disable; a command used to cancel an SPE command.
SPE
SRQ
Serial Poll Enable; a command used to enable a specific device to be polled. That device must also be addressed to talk.
Service Request; a GPIB line that a device asserts to notify the CIC that the device needs servicing.
SRQ line is asserted.
SRQI
System Controller The single designated controller that can assert control (become CIC of the GPIB) by sending the IFC message. Other devices can become CIC only by having control passed to them.
TACS
Talker
TCT
TIMO
Timeout
UNL
UNT
Addressed to talk.
A GPIB device that sends data messages to Listeners.
Take Control; a command used to pass control of the bus from the current controller to an addressed Talker.
Time limit for I/O completion has been exceeded.
A software feature that prevents I/O functions from hanging indefinitely when there is a problem on the GPIB.
Unlisten; a command used to unaddress any active Listeners.
Untalk; a command used to unaddress an active Talker.
© National Instruments Corporation Glossary-3 ESP-488 for the VXIcpu-030
دانلود
تبلیغات