HP E2261A User manual

Contents
Contents 3
Warranty .......................................................................................................................7
Safety Symbols .............................................................................................................8
WARNINGS.................................................................................................................8
Declaration of Conformity............................................................................................9
Reader Comment Sheet ..............................................................................................11
Chapter 1
Getting Started .............................................................................................................13
What is in this Manual? ..............................................................................................13
HP E2261A Description .............................................................................................13
Installing the Module ..........................................................................................14
Wiring and Configuration...........................................................................................14
Chapter 2
SCPI Programming .....................................................................................................19
Example 1: Reset, Self Test, Module ID ............................................................19
Example 2: Reading and Writing Data ...............................................................21
Chapter 3
SCPI Command Reference .........................................................................................23
DIAGnostic Subsystem...............................................................................................26
DIAGnostic:LINE <interrupt_line> ....................................................................26
DIAGnostic:LINE? .............................................................................................27
DIAGnostic:SERial[1|2|3|4]:CLEARbuffer TX | RX | TXRX ...........................27
DIAGnostic:SERial[1|2|3|4]:RECeive:AVAilable? ............................................27
DIAGnostic:SERial[1|2|3|4]:RECeive:CHANnel ENABle | DISAble ...............27
DIAGnostic:SERial[1|2|3|4]:RECeive:CHANnel? .............................................27
DIAGnostic:SERial[1|2|3|4]:STATus .................................................................27
DIAGnostic:SERial[1|2|3|4]:TRANsmit:BUFFerstatus ......................................27
DIAGnostic:SERial[1|2|3|4]:TRANsmit:CHANnel ENABle | DISAble ............28
DIAGnostic:SERial[1|2|3|4]:TRANsmit:CHANnel? ..........................................28
SENSe Subsystem.......................................................................................................29
SENSe:SERIAL[1|2|3|4][:TEXT?] [n] ................................................................29
SENSe:SERIAL[1|2|3|4]:DATA? [n] ..................................................................30
SOURce Subsystem....................................................................................................31
SOURce:SERial[1|2|3|4][:TEXT] <“text_string”> .............................................31
SOURce:SERial[1|2|3|4]:DATA <data> .............................................................31
STATus Subsystem.....................................................................................................32
STATus:OPERation:CONDition? ......................................................................34
STATus:OPERation:ENABle <mask> ...............................................................34
STATus:OPERation:ENABle? ...........................................................................34
STATus:OPERation[:EVENt]? ...........................................................................35
STATus:PRESet ..................................................................................................35
STATus:QUEStionable:CONDition? .................................................................36
STATus:QUEStionable:ENABle <mask> ..........................................................36
STATus:QUEStionable:ENABle? ......................................................................36
STATus:QUEStionable[:EVENt]? ......................................................................37
HP E2261A Quad Serial M-Module User’s Manual
Edition 1

4 Contents
SYSTem Subsystem ...................................................................................................38
SYSTem . . . :CONTrol:CTS 0 | 1 | OFF | ON ...................................................39
SYSTem . . . :CONTrol:CTS? .............................................................................39
SYSTem . . . :CONTrol:DSR 0 | 1 | OFF | ON ...................................................40
SYSTem . . . :CONTrol:DSR? ............................................................................40
SYSTem . . . :CONTrol:DTR ON | OFF | STANDard | IBFull ..........................40
SYSTem . . . :CONTrol:DTR? ............................................................................40
SYSTem . . . :CONTrol:RTS ON | OFF | STANdard | IBFull ............................41
SYSTem . . . :CONTrol:RTS? .............................................................................41
SYSTem . . . :ERRormode IGNOre | STOP .......................................................41
SYSTem . . . :ERRormode? ................................................................................41
SYSTem . . . :MODE NORMal | ECHO | LLOOP | RLOOP .............................42
SYSTem . . . :MODE? .........................................................................................42
SYSTem . . . [:RECeive]:BAUD <baud_rate> ...................................................42
SYSTem . . . [:RECeive]:BAUD? .......................................................................42
SYSTem . . . [:RECeive]:BITS 5 | 6 | 7 | 8 ..........................................................42
SYSTem . . . [:RECeive]:BITS? .........................................................................42
SYSTem . . . [:RECeive]:BLOCKsize <block_size> ..........................................43
SYSTem . . . [:RECeive]:BLOCKsize? ..............................................................43
SYSTem . . . [:RECeive]:PACE[:PROTocol] XON | NONE .............................43
SYSTem . . . [:RECeive]:PACE[:PROTocol]? ...................................................43
SYSTem . . . [:RECeive]:PACE:THReshold:STARt <characters> ....................44
SYSTem . . . [:RECeive]:PACE:THReshold:STARt? ........................................44
SYSTem . . . [:RECeive]:PACE:THReshold:STOP <characters> ......................45
SYSTem . . . [:RECeive]:PACE:THReshold:STOP? .........................................45
SYSTem . . . [:RECeive]:PARity:CHECk 0 | 1 | OFF | ON ................................46
SYSTem . . . [:RECeive]:PARity:CHECk? ........................................................46
SYSTem . . . [:RECeive]:PARity[:TYPE] EVEN|ODD|ZERO|ONE|NONE .....46
SYSTem . . . [:RECeive]:PARity[:TYPE]? ........................................................46
SYSTem . . . [:RECeive]:SBITs 1 | 1.5 | 2 ..........................................................47
SYSTem . . . [:RECeive]:SBITs? ........................................................................47
SYSTem . . . :TERMinator:TRANsmit CR | LF | CRLF | NONE | <NRf> ........47
SYSTem . . . :TERMinator:TRANsmit? .............................................................47
SYSTem . . . :TERMinator:RECeive CR | LF | CRLF | NONE | <NRf> ...........48
SYSTem . . . :TERMinator:RECeive? ................................................................48
SYSTem . . . :TERMinator:PASSthrough 1 | 0 | ON | OFF ................................48
SYSTem . . . :TERMinator:PASSthrough? .........................................................48
SYSTem . . . :TERMinator:TIMEout <timeout> ................................................49
SYSTem . . . :TERMinator:TIMEout? ................................................................49
SYSTem . . . :TRANsmit:AUTO 1 | 0 | ON | OFF ..............................................49
SYSTem . . . :TRANsmit:AUTO? ......................................................................49
SYSTem . . . :TRANSmit:BAUD <baud_rate> ..................................................49
SYSTem . . . :TRANSmit:BAUD? .....................................................................49
SYSTem . . . :TRANsmit:PACE[:PROTocol] XON | NONE .............................50
SYSTem . . . :TRANsmit:PACE[:PROTocol]? ..................................................50
SYSTem:ERRor? ................................................................................................50
SYSTem:VERSion? ............................................................................................50
IEEE 488.2 Common Command Reference...............................................................51
SCPI Command Quick Reference ..............................................................................52

Contents 5
Chapter 4
Register Programming Information ..........................................................................55
Module Description ....................................................................................................55
Programming the Microcontroller .......................................................................56
Receiver Operation ..............................................................................................56
Transmitter Operation .........................................................................................58
Register Addressing in the VXIbus Environment ......................................................59
Logical address ....................................................................................................59
A16/A24 Memory Mapping ................................................................................59
Determining a Module’s A16 Base Address .......................................................60
Addressing A16 Register ....................................................................................60
Addressing A24 Registers ...................................................................................61
A16 Memory Registers .......................................................................................61
A24 Memory Registers .......................................................................................64
Program Example .......................................................................................................87
Appendix A
HP E2261A Specifications ...........................................................................................89
M-Module Specification Compliance.........................................................................89
Capabilities .................................................................................................................89
HP E2261A Specifications .........................................................................................89
Appendix B
RS-232 Cables ..............................................................................................................91

6 Contents

7
Certification
Hewlett-Packard Company certifies that this product met its published specifications at the time of shipment from the factory. Hewlett-
Packard further certifies that its calibration measurements are traceable to the United States National Institute of Standardsand
Technology (formerly National Bureau of Standards), to the extent allowed by that organization's calibration facility, and to the
calibration facilities of other International Standards Organization members.
Warranty
This Hewlett-Packard product is warranted against defects in materials and workmanship for a period of three years from date of shipment.
Duration and conditions of warranty for this product may be superseded when the product is integrated into (becomes a part of)other HP
products. During the warranty period, Hewlett-Packard Company will, at its option, either repair or replace products which prove to be
defective.
For warranty service or repair, this product must be returned to a service facility designated by Hewlett-Packard (HP). Buyer shall prepay
shipping charges to HP and HP shall pay shipping charges to return the product to Buyer. However, Buyer shall pay all shipping charges,
duties, and taxes for products returned to HP from another country
HP warrants that its software and firmware designated by HP for use with a product will execute its programming instructions when
properly installed on that product. HP does not warrant that the operation of the product, or software, or firmware will be uninterrupted
or error free.
Limitation Of Warranty
The foregoing warranty shall not apply to defects resulting from improper or inadequate maintenance by Buyer, Buyer-supplied products
or interfacing, unauthorized modification or misuse, operation outside of the environmental specifications for the product, or improper
site preparation or maintenance.
The design and implementation of any circuit on this product is the sole responsibility of the Buyer. HP does not warrant the Buyer's
circuitry or malfunctions of HP products that result from the Buyer's circuitry. In addition, HP does not warrant any damage that occurs
as a result of the Buyer's circuit or any defects that result from Buyer-supplied products.
NO OTHER WARRANTY IS EXPRESSED OR IMPLIED. HP SPECIFICALLY DISCLAIMS THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
Exclusive Remedies
THE REMEDIES PROVIDED HEREIN ARE BUYER'S SOLE AND EXCLUSIVE REMEDIES. HP SHALL NOT BE LIABLE FOR
ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER BASED ON CONTRACT,
TORT, OR ANY OTHER LEGAL THEORY.
Notice
The information contained in this document is subject to change without notice. HEWLETT-PACKARD (HP) MAKES NO
WARRANTY OF ANY KIND WITH REGARD TO THIS MATERIAL, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. HP shall not be liable for errors
contained herein or for incidental or consequential damages in connection with the furnishing, performance or use of this material. This
document contains proprietary information which is protected by copyright. All rights are reserved. No part of this document may be
photocopied, reproduced, or translated to another language without the prior written consent of Hewlett-Packard Company. HP assumes
no responsibility for the use or reliability of its software on equipment that is not furnished by HP.
U.S. Government Restricted Rights
The Software and Documentation have been developed entirely at private expense. They are delivered and licensed as "commercial
computer software" as defined in DFARS 252.227- 7013 (Oct 1988), DFARS 252.211-7015 (May 1991) or DFARS 252.227-7014 (Jun
1995), as a "commercial item" as defined in FAR 2.101(a), or as "Restricted computer software" as defined in FAR 52.227-19 (Jun
1987)(or any equivalent agency regulation or contract clause), whichever is applicable. You have only those rights provided for such
Software and Documentation by the applicable FAR or DFARS clause or the HP standard software agreement for the product involved
HP E2261A Quad RS-232 Interface M-Module User's Manual
Edition 1
Copyright © 1997 Hewlett-Packard Company. All Rights Reserved.

8
Safety Symbols
Instruction manual symbol affixed to
product. Indicates that the user must refer to
the manual for specific WARNING or
CAUTION information to avoid personal
injury or damage to the product.
Alternating current (AC)
Instruction manual symbol affixed to
product. Indicates that the user must refer to
the manual for specific WARNING or
CAUTION information to avoid personal
injury or damage to the product.
Indicates the field wiring terminal that must
be connected to earth ground before
operating the equipment — protects against
electrical shock in case of fault.
Direct current (DC).
Indicates hazardous voltages.
or Frameorchassisgroundterminal—typically
connects to the equipment's metal frame.
WARNING Calls attention to a procedure, practice, or
condition that could cause bodily injury or
death.
CAUTION Calls attention to a procedure, practice, or
condition thatcouldpossibly cause damage to
equipment or permanent loss of data.
WARNINGS
The following general safety precautions must be observed during all phases of operation, service, and repair of this product. Failure to
comply with these precautions or with specific warnings elsewhere in this manual violates safety standards of design, manufacture, and
intended use of the product. Hewlett-Packard Company assumes no liability for the customer's failure to comply with these requirements.
Ground the equipment: For Safety Class 1 equipment (equipment having a protective earth terminal), an uninterruptible safety earth
ground must be provided from the mains power source to the product input wiring terminals or supplied power cable.
DO NOT operate the product in an explosive atmosphere or in the presence of flammable gases or fumes.
For continued protection against fire, replace the line fuse(s) only with fuse(s) of the same voltage and current rating and type. DO NOT
use repaired fuses or short-circuited fuse holders.
Keep away from live circuits: Operating personnel must not remove equipment covers or shields. Procedures involving the removal of
covers or shields are for use by service-trained personnel only. Under certain conditions, dangerous voltages may exist even with the
equipment switched off. To avoid dangerous electrical shock, DO NOT perform procedures involving cover or shield removal unless you
are qualified to do so.
DO NOT operate damaged equipment: Whenever it is possible that the safety protection features built into this product have been
impaired, either through physical damage, excessive moisture, or any other reason, REMOVE POWER and do not use the product until
safe operation can be verified by service-trained personnel. If necessary, return the product to a Hewlett-Packard Sales and Service Office
for service and repair to ensure that safety features are maintained.
DO NOT service or adjust alone: Do not attempt internal service or adjustment unless another person, capable of rendering first aid and
resuscitation, is present.
DO NOT substitute parts or modify equipment: Because of the danger of introducing additional hazards, donotinstallsubstitute parts
or perform any unauthorized modification to the product. Return the product to a Hewlett-Packard Sales and Service Office for service
and repair to ensure that safety features are maintained.
Documentation History
All Editions and Updates of this manual and their creation date are listed below. The first Edition of the manual is Edition 1. The Edition
number increments by 1 whenever the manual is revised. Updates, which are issued between Editions, contain replacement pages to
correct or add additional information to the current Edition of the manual. Whenever a new Edition is created, it will contain all of the
Update information for the previous Edition. Each new Edition or Update also includes a revised copy of this documentation history page.
Edition 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . September, 1997

9
Jim White, QA Manager
European contact: Your local Hewlett-Packard Sales and Service Office or Hewlett-Packard GmbH, Depart-
ment HQ-TRE, Herrenberger Straße 130, D-71034 Böblingen, Germany (FAX +49-7031-14-3143)
Declaration of Conformity
according to ISO/IEC Guide 22 and EN 45014
Manufacturer's Name: Hewlett-Packard Company
Loveland Manufacturing Center
Manufacturer's Name: Hewlett-Packard Company
Loveland Manufacturing Center
declares, that the product:
Product Name: Quad RS-232 Interface M-Module
Model Number: HP E2261A
Product Options: All
conforms to the following Product Specifications:
Safety: IEC 1010-1 (1990) Incl. Amend 2 (1996)/EN61010-1 (1993)
CSA C22.2 #1010.1 (1992)
UL 3111-1 (1994)
EMC: CISPR 11:1990/EN55011 (1991): Group 1, Class A
EN61000-3-2:1995 Class A
EN61000-3-3:1995
EN50082-1:1992
IEC 1000-4-2:1995 : 4kV CD, 8kV AD
IEC 1000-4-3:1995: 3 V/m
IEC 1000-4-4:1995: 1kV Power Line, 0.5kV Signal Lines
ENV50141:1993/prEN50082-1 (1995): 3 Vrms
EN61000-4-8: 1993/prEN50082-1 (1995): 3 A/m
SupplementaryInformation: The product herewith complies with the requirements of the Low Voltage Directive
73/23/EEC and the EMC Directive 89/336/EEC and carries the "CE" mark accordingly.
Tested in a typical configuration in an HP C-Size VXI mainframe.
April 30, 1997

10
Notes:

NO POSTAGE
NECESSARY
IF MAILED
IN THE
UNITED STATES
fold here
Please fold and tape for mailing
Reader Comment Sheet
HP E2261A Quad RS-232 Interface M-Module User’s Manual & SCPI Programming Guide
Edition 1
You can help us improve our manuals by sharing your comments and suggestions. In appreciation of your time, we will
enter you in a quarterly drawing for a Hewlett-Packard Palmtop Personal Computer (U.S. government employees
are not eligible for the drawing).
Your Name
Company Name
Job Title
Address
City, State/Province
Country
Zip/Postal Code
Telephone Number with Area Code
Please list the system controller, operating system, programming language, and plug-in modules you are using.
BUSINESS REPLY MAIL
FIRST CLASS PERMIT NO. 37 LOVELAND, CO
POSTAGE WILL BE PAID BY ADDRESSEE
HEWLETT-PACKARD COMPANY
Measurement Systems Division
Learning Products Department
P.O. Box 301
Loveland, CO 80539-9984
fold here
Please pencil-in one circle for each statement below: Disagree Agree
•The documentation is well organized. OOOOO
•
Instructions are easy to understand. OOOOO
•
The documentation is clearly written. OOOOO
•Examples are clear and useful. OOOOO
•
Illustrations are clear and helpful. OOOOO
•
The documentation meets my overall expectations. OOOOO
Please write any comments or suggestions below–be specific.
cut along this line


Getting Started 13
Chapter 1
Getting Started
What is in this Manual?
This manual contains information about installing and using the HP E2261A
Quad RS-232 Port M-Module. This information includes a description of
this module and wiring/configuration information (Chapter 1), Standard
Commands for Programmable Instruments (SCPI) programming
information with example programs (Chapter 2), and register information
with example programs (Chapter 3). Module specifications are provided in
Appendix A of this manual.
The HP E2261A is intended to be installed and used on an M-Module
Carrier (such as the HP E2251). For specific information about installing
and using the HP E2261A M-Module in an HP carrier, refer to the carrier’s
manual(s).
HP E2261A Description
The HP E2261A provides four full-duplex (asynchronous) RS-232 Data
Terminal Equipment (DTE) ports on one M-Module. Each port provides:
•Independently programmable baud rate: (13 fixed rates from 75 baud
to 38400 baud)
•Independently programmable handshake mode: RTS/CTS and/or
DTR/DSR hardware handshake, XON/XOFF software handshake, or
NONE
•Independently programmable data format: 5 to 8 data bits plus parity;
odd, even, or no parity; 1, 1.5, or 2 stop bits.
•Independent 2kByte Input and Output buffer for each port.
When installed in an HP carrier, such as the HP E2251 M-Module Carrier,
the M-Module can be addressed and used like a standard VXIbus module.
The carrier provides a logical address for the M-Module and VXI register
configuration. When installed in an HP M-Module carrier the M-Module
can be programmed by using Standard Commands for Programmable
Instruments (SCPI) commands (see Chapter 2) or by the VXIplug&play
driver (refer to the CD ROM supplied with your M-module). Alternately,
you can program the M-Module at the register level (refer to Chapter 3 in
this manual).

14 Getting Started
Installing the
Module If you are installing the HP E2261A in an HP M-Module carrier, such as the
HP E2251, refer to the carrier’s user manual for complete installation
instructions.
Note The HP E2261A may not fit properly in either of the two interior slots (M4
or M5) of an HP E2251 Carrier if you use the optional HP E2261-61601
cable.
Note The procedures in this section assume the M-Module(s) have already been
installed into an M-Module Carrier. Since installation is dependent on the
carrier used, instructions for installing the M-Modules into the carrier are
not included here. Refer to your M-Module Carrier documentation for
installation instructions.
Wiring and Configuration
An optional cable (HP p.n. E2261-61601) splits the M-Module connector
into four standard 9-pin (male) connectors. These 9-pin connectors have the
same pin-out as a standard PC serial interface. If you need to make your own
cable, Figure 1-1, Figure 1-2, and Table 1-1 shows the pin-out and wiring of
the M-Module Connector and the 9-pin connectors1. Figure 1-3 shows how
to assemble the 44-pin user connector hood if you are making your own
cable.
1. Signal names are from the perspective of the HP E2261A as the DTE device
WARNING SHOCK HAZARD. Only qualified service-trained personnel who
are aware of the hazards involved should install, remove, or
configure modules. Before installing or removing any module
or carrier, disconnect power from the mainframe and user
wiring.
Caution STATIC ELECTRICITY. Static electricity is a major cause of
component failure. To prevent damage to the electrical
components on an M-Module or the carrier, observe anti-static
techniques whenever installing, removing, or working on a
carrier or M-Module.

Getting Started 15
Figure 1-1. Ports on the HP E2261A Quad RS-232 Port M-Module
Table 1-1. HP E2261A Quad RS-232 Port M-Module Connector Pin Definitions
a. If you use a shielded cable, connect the shield to a chassis connector pin on the 44-pin
connector. Do not connect the other end of the shield.
HP E2261A Quad RS-232 M-Module
Pin Name and Function Port 1
Pin #s Port 2
Pin #s Port 3
Pin #s Port 4
Pin #s 9-Pin (Male)
Connector Pin #
DTR Data Terminal Ready 1 5 9 13 4
TD Transmitted Data 2 6 10 14 3
RD Received Data 3 7 11 15 2
RTS Request to Send 16 20 24 28 7
CTS Clear to Send 17 21 25 29 8
DSR Data Set Ready 18 22 26 30 6
SG Signal Ground 4, 8, 12, 19, 23, 27 5
Chassis Connectiona31, 32, 33, . . . 43, 44 -
Port 1
Port 2
Port 3
Port 4
{
{
{
{

16 Getting Started
Figure 1-2. Optional Cable Wiring for HP E2261A
Port 1
Port 2
Port 3
Port 4
Note: If you are using shielded cable,
connect the shield to pins 31 - 44
on the 44-pin M-Module connector
only. this connects the shield to the
VXI chassis (earth ground).

Getting Started 17
Figure 1-3. Assembling the 44-Pin User Connector Hood
1. If necessary, disassemble
the connector hood. Discard
2. Release the latch on the
side of the hood.
4. Wire cable to connector. 6. Assemble connector, cable
strain relief, and hood.
the three self-tapping screws
supplied with the hood.
3. Assemble bezel and
cable clamp before wiring
cable to connector.
5. Place connector and
connector screws on bottom shell.
(24 AWG or smaller) Use the supplied M3X5
screws.

18 Getting Started

SCPI Programming 19
Chapter 2
SCPI Programming
General Information
This chapter describes how to use and program the HP E2261A Quad
RS-232 Port M-Module with the Standard Commands for Programmable
Instruments (SCPI). This chapter includes example programs and a
complete SCPI Command Reference.
Note Do not do register writes if you are controlling the module by the high level
driver. This is because the driver will not know the module state and an
interrupt may occur causing the driver and/or command module to fail.
The following example programs were developed with the ANSI C
language using the HP VISA extensions. The program was written and
tested in Microsoft®Visual C++ but should compile under any standard
ANSI C compiler.
To run the programs you must have the HP SICL Library, the HP VISA
extensions, and an HP 82340 or 82341 HP-IB module installed and properly
configured in your PC. An HP E1406 Command Module is required.
Example 1: Reset,
Self Test,
Module ID
The following example reads the module ID string, performs module
self-test, displays the results, closes channel 02 and queries the channel
closure state. The result is returned to the computer and displayed
(“1” = channel closed, “0” = channel open).
#include <visa.h>
#include <stdio.h>
#include <stdlib.h>
/* Interface address is 112, Module secondary address is 9*/
#define INSTR_ADDR “GPIB0::9::9::INSTR”
int main()
{ViStatus errStatus; /*Status from each VISA call*/
ViSession viRM; /*Resource mgr. session */
ViSession E2261A; /* Module session */
char id_string[256]; /*ID string*/
char selftst_string[256]; /*self-test string*/
/* Open the default resource manager */
errStatus = viOpenDefaultRM ( &viRM);
if(VI_SUCCESS > errStatus){
printf(“ERROR: viOpenDefaultRM() returned 0x%x\n”,errStatus);

20 SCPI Programming
return errStatus;}
/* Open the Module instrument session */
errStatus = viOpen(viRM,INSTR_ADDR, VI_NULL,VI_NULL,&E2261A);
if(VI_SUCCESS > errStatus){
printf(“ERROR: viOpen() returned 0x%x\n”,errStatus);
return errStatus;}
/* Set Timeout Value for *RST and Self Test */
viSetAttribute (E2261A,VI_ATTR_TMO_VALUE,10000);
/* Reset the Module */
errStatus = viPrintf(E2261A, “*RST\n”);
if(VI_SUCCESS > errStatus){
printf(“ERROR: viPrintf() returned 0x%x\n”,errStatus);
return errStatus;}
/* Perform Module Self-Test */
errStatus = viQueryf(E2261A,”*TST?\n”,”%t”,selftst_string);
if (VI_SUCCESS > errStatus) {
printf(“ERROR: viQueryf () returned 0x%x\n”,errStatus);
return errStatus;}
printf(“Self Test Result is %s\n”,selftst_string);
/* Query the Module ID string */
errStatus = viQueryf(E2261A,”*IDN?\n”,”%t”,id_string);
if (VI_SUCCESS > errStatus) {
printf(“ERROR: viQueryf () returned 0x%x\n”,errStatus);
return errStatus;}
printf(“ID is %s\n”,id_string);
/* Close the Module Instrument Session */
errStatus = viClose (E2261A);
if (VI_SUCCESS > errStatus) {
printf(“ERROR: viClose() returned 0x%x\n”,errStatus);
return 0;}
/* Close the Resource Manager Session */
errStatus = viClose (viRM);
if (VI_SUCCESS > errStatus) {
printf(“ERROR: viClose() returned 0x%x\n”,errStatus);
return 0;}
return VI_SUCCESS;
}

SCPI Programming 21
Example 2:
Reading and
Writing Data
The following program demonstrates how to write data to a standard (dumb)
RS-232 terminal and how to read data from the terminal. The program sets
the HP E2261A Port 1 to the following (default) parameters:
•9600 Baud (both transmit and receive)
•8 data bits
•No parity check
•1 Stop Bit
•XON/XOFF pacing
Of course the external RS-232 terminal must be set to the same parameters.
#include <visa.h>
#include <stdio.h>
#include <stdlib.h>
/* Interface address is 112, Module secondary address is 9*/
#define INSTR_ADDR “GPIB0::9::9::INSTR”
int main()
{
ViStatus errStatus; /*Status from each VISA call*/
ViSession viRM; /*Resource mgr. session */
ViSession E2261A; /* Module session */
char Return_String[256]; /*String read from terminal*/
/* Open the default resource manager */
errStatus = viOpenDefaultRM ( &viRM);
if(VI_SUCCESS > errStatus){
printf(“ERROR: viOpenDefaultRM() returned 0x%x\n”,errStatus);
return errStatus;}
/* Open the Module instrument session */
errStatus = viOpen(viRM,INSTR_ADDR, VI_NULL,VI_NULL,&E2261A);
if(VI_SUCCESS > errStatus){
printf(“ERROR: viOpen() returned 0x%x\n”,errStatus);
return errStatus;}
/* Set Timeout for 10 seconds */
viSetAttribute (E2261A,VI_ATTR_TMO_VALUE,10000);
/* Reset the Module */
errStatus = viPrintf(E2261A, “*RST\n”);
if(VI_SUCCESS > errStatus){
printf(“ERROR: viviPrintf() returned 0x%x\n”,errStatus);
return errStatus;}
/* Clear TX & RX Buffers */
errStatus = viPrintf(E2261A,”DIAG:SER1:CLEAR TXRX\n”);
if (VI_SUCCESS > errStatus) {
printf(“ERROR: viPrintf() returned 0x%x\n”,errStatus);
return errStatus;}

22 SCPI Programming
/* Send Text String, can be up to 256 characters */
errStatus = viPrintf(E2261A,”SOUR:SER1:TEXT \”%s\”\n”,”This is a text
string.”);
if (VI_SUCCESS > errStatus) {
printf(“ERROR: viPrintf() returned 0x%x\n”,errStatus);
return errStatus;}
/* Receive Text from Terminal */
errStatus =
viQueryf(E2261A,”SENS:SER1:TEXT?\n”,”%t”,Return_String);
if (VI_SUCCESS > errStatus) {
printf(“ERROR: viPrintf() returned 0x%x\n”,errStatus);
return errStatus;}
printf(“Text Returned is %s\n”,Return_String);
/* Close the Module Instrument Session */
errStatus = viClose (E2261A);
if (VI_SUCCESS > errStatus) {
printf(“ERROR: viClose() returned 0x%x\n”,errStatus);
return 0;}
/* Close the Resource Manager Session */
errStatus = viClose (viRM);
if (VI_SUCCESS > errStatus) {
printf(“ERROR: viClose() returned 0x%x\n”,errStatus);
return 0;}
return VI_SUCCESS;
}
Table of contents
Other HP Control Unit manuals

HP
HP HPE FlexNetwork 7500 User manual

HP
HP HPE FM 2072 User manual

HP
HP HP 81531A User manual

HP
HP HP 70909A User manual

HP
HP 900896-121 Guide

HP
HP 6600-A FIP-600 FlexIntfPltfrm Rtr Mod Assembly instructions

HP
HP 98624A Quick start guide

HP
HP E1328A User manual

HP
HP 81533B User manual

HP
HP HP 81551MM User manual

HP
HP A12500 Assembly instructions

HP
HP 70427A User manual

HP
HP E3456A User manual

HP
HP Synergy 480 Gen10 User manual

HP
HP ProCurve MSM765zl Assembly instructions

HP
HP 638526-B21 User manual

HP
HP E1407A User manual

HP
HP LC Series Operating and safety instructions

HP
HP JC075A Assembly instructions

HP
HP 75000 B Series User manual