Text preview for : 98613-90022_Basic_5.0_Interfacing_Techniques_Vol_1_Jan87.pdf part of HP 98613-90022 Basic 5.0 Interfacing Techniques Vol 1 Jan87 HP 9000_basic 5.0 98613-90022_Basic_5.0_Interfacing_Techniques_Vol_1_Jan87.pdf
Back to : 98613-90022_Basic_5.0_Int | Home
BASIC 5.0
Interfacing Techniques
Vol. 1: General Topics
UP 9000 Series 200/300 Computet:s
HP Part Number 98613-90022
FliU- HEWLETT
~~ PACKARD
Hewlett-Packard Company
3404 East Harmony Road, Fort Collins, Colorado 80525
NOTICE
The information contained In this document IS subject to change without notice
HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD TO THIS MANUAL. INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Hewlett-Packard shall not be liable
for errors contained herein or direct. Indirect. special Incidental or consequential damages In connection With the furnishing, performance.
or use of this material
WARRANTY
A copy of the specific warranty terms applicable to your Hewlett-Packard product and replacement parts can be obtained from your local
Sales and Service Office
Copyright 1987 Hewlett-Packard Company
ThiS document contains propnetary 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 The Information
contained In thiS document IS subject to change Without notice
Restricted Rights Legend
Use. duplication or disclosure by the Government IS subject to restnctions as set forth In paragraph (b)(3)(B) of the Rights In Technical Data and
Software clause In DAR 7-1049(a)
Use of thiS manual and flexible disc(s) or tape cartndge(s) supplied for thiS pack IS restricted to thiS product only Additional copies of the programs
can be made for security and back-up purposes only Resale of the programs In their present form or With alterations. IS expressly prohibited
Copyright 1980. 1984 AT&T. Inc
Copyright 1979 1980 1983. The Regents of the University of California
ThiS software and documentation IS based In part on the Fourth Berkeley Software Dlstnbutlon under license from the Regents of the UniverSity
of California
ii
Printing History
New editions of this manual will incorporate all material updated since the previous
edition. Update packages may be issued between editions and contain replacement and
additional pages to be merged into the manual by the user. Each updated page will be
indicated by a revision date at the bottom of the page. A vertical bar in the margin
indicates the changes on each page. Note that pages which are rearranged due to changes
on a previous page are not considered revised.
The manual printing date and part number indicate its current edition. The printing
date changes when a new edition is printed. (Minor corrections and updates which are
incorporated at reprint do not cause the date to change.) The manual part number
changes when extensive technical changes are incorporated.
January 1987 ... Edition 1
iii
iv
Table of Contents
Chapter 1: Manual Overview
Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 1-1
Manual Organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 1-1
Where to Begin. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 1-1
Chapter Previews. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 1-2
Chapter 2: Interfacing Concepts
Terminology. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 2-1
Why Do You Need an Interface? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 2-4
Electrical and Mechanical Compatibility . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 2-5
Data Compatibility ............................................... 2-6
Timing Compatibility ............................................. 2-6
Additional Interface Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 2-6
Interface Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 2-7
The HP-IB Interface .............................................. 2-7
The RS-232C Serial Interface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 2-8
The Datacomm Interface ................ : . . . . . . . . . . . . . . . . . . . . . . . . .. 2-9
The GPIO Interface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 2-10
The BCD Interface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 2-11
Data Representations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 2-12
Bits and Bytes .................................................. 2-12
Representing Numbers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 2-13
Representing Characters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 2-14
Representing Signed Integers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 2-14
Representing Real Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 2-17
The I/O Process. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 2-19
I/O Statements and Parameters ................................... 2-19
Data Handshake ................................................. 2-20
I/O Examples. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 2-21
Example Output Statement ....................................... 2-21
Example Enter Statement ......................................... 2-23
Chapter 3: Directing Data Flow
Specifying a Resource ................................................. 3-2
String-Variable Names ............................................. 3-2
Device Selectors .................................................. 3-4
Table of Contents v
HP-IB Device SPlector~ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . :)-f)
I/O Path :'\alllP" ., ................................................ :)-7
Assigning I/O Path :\alll('s ........................................... " 3-9
Rt'-Assigning I/O Path Namt's ..................................... 3-11
Closing I/O Path ~ ;UlH'S . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 3-11
I/O Path ~am('s in Subprograms ................................. , ~3-12
Assigning I/O Path\" CllIWS Locally \Vit hill Subprograms. . . . . . . . . . . . .. :3-12
Passing I/O Path ~allles as Parameters ............................ , 3-14
Declaring I/0 Path ~allJ('S ill Comlllon ............................. :3-14
B('IlC'fi t s of 11 sing I/O Path l\' aIlles ..................................... :3-15
Execution Spef'd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. .~-l.-)
Rc-Dirt'cting Data ............................................... 3-lG
Attribute Control ................................................ 3-17
Chapter 4: Outputting Data
Introduction ........................................................ " 4-1
Free-Fidd Outputs .................................................... 4-2
The Free-Field Convention. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 4-2
Item Sq)arators and Terminators ................................... 4-:3
Changing tIl(' EOL Sequence (Requires 10) ......................... " 4-G
l~sing END in Freefield OUTPUT ..................................... " 4-8
Addit ional Defillit ion ........ .
Outputs that l Tse Images ............................................. 4-1U
Tht' OCTPUT USING Statement .................................. 4-10
Illiages ............................................................. 4-11
Example of 1Tsing an Image ...................................... , 4-12
Image Ddinitions During Outputs ..................................... 4-13
:\ llmeric Illla!u'S ................................................. 4-14
String lInages ................................................... 4-17
Binary Imagf's .................................................. , 4-18
Special-Character Imagt's ......................................... 4-20
Terminat ion Images ............................................. , 4-21
Additional Illlag(' F('atnrf's ........................................... , 4-22
Repeat F'actors ................................................. , 4-22
Image Re- C se .................................................... 4- 23
:\psted lmag('s ................................................... 4-24
T
END with OUTP1 Ts that Cse Images ................................. 4-25
Additional E~D Definition. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 4-26
vi Table of Contellts
Chapter 5: Entering Data
Free-Field Enters ..................................................... 5-1
Item Separators. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 5-2
Item Terminators. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 5-2
Entering Numeric Data with the Number Builder ..................... 5-3
Entering String Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 5-8
Terminating Free-Field ENTER Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 5-10
EOI Termination ................................................ 5-11
Enters that Use Images. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 5-13
The ENTER USING Statement .................................... 5-13
Images ............................................................. 5-14
Example of an Enter Using an Image ............................... 5-14
Image Definitions During Enter. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 5-16
Numeric Images ................................................. 5-16
String Images ................................................... 5-18
Ignoring Characters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 5-19
Binary Images. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 5-20
Terminating Enters that Use Images. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 5-21
Default Termination Conditions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 5-21
EOI Re-Definition ............................................... 5-22
Statement-Termination Modifiers .................................. 5-23
Additional Image Features ...... i-. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 5-25
Repeat Factors .................................................. 5-25
Image Re-Use ................................................... 5-25
Nested Images. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 5-25
Chapter 6: Registers
Interface Registers .................................................... 6-2
The STATUS Statement. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 6-2
The CONTROL Statement ......................................... 6-3
I/O Path Registers .................................................... 6-5
Summary of I/O Path Registers ........................................ 6-9
For All I/O Path Names ........................................... 6-9
I/O Path Names Assigned to a Device ............................... 6-9
I/O Path Names Assigned to an ASCII File .......................... 6-9
I/O Path Names Assigned to a BDAT File .......................... 6-10
I/O Path Names Assigned to an HP-UX File ........................ 6-10
I/O Path Names Assigned to a Buffer .............................. 6-11
Direct Interface Access ............................................... 6-12
Table of Contents vii
Chapter 7: Interrupts and Timeouts
Ovrrview of Event-Initiatf'd Branching ................................... 7-1
Types of EVf'nts .............