Agilent E1429A User Manual

Contents
HP E1429A/B Digitizer User’s Manual
Warranty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
WARNINGS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Safety Symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Declaration of Conformity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Chapter 1. Getting St ar te d . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Chapter Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
HP E1429A/B Features and VXIbus Configuration . . . . . . . . . . . . . . . . . . . 13
Preparation for Use . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
The Digitizer Logical Addr ess . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
The Digitizer Bu s R equest Level . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Installing the Digitiz er . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Address ing the Digitizer over HP-IB . . . . . . . . . . . . . . . . . . . . . . . . . 19
Address i ng the Digi ti zer usi ng an Embedded Controller . . . . . . . . . . . . . . . 19
Introductory Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Sending the *ID N? Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Digitizer Self-Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Resetting and Clearing the Digitizer . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Querying the Di gi ti zer Configuration . . . . . . . . . . . . . . . . . . . . . . . . . 25
Instrument and Programming Languages . . . . . . . . . . . . . . . . . . . . . . . . . 28
SCPI Program mi ng . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Coupled Comma nds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
C Language Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Introducti on to Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Using the MEASure an d CONFigure Commands . . . . . . . . . . . . . . . . . . . 34
Programming Sequen ce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Configuring the Channels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
How to Make Measurement s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Querying Comma nd Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Checking for Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Digitizer/Command Module Deadlock . . . . . . . . . . . . . . . . . . . . . . . . 47
Where to go Next . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Chapter 2. Using the Digitize r . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Chapter Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Using the Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Configuring the Digitizer Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
INPUT.C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
Taking a Burst of Readings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
ARMCNT.C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Contents HP E1429A/B Digitizer User’s Manual 1
Level Arming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
ARMLEVEL.C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
Pre- and Post-Arm Readings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
PREPOST.C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Specifying a Sample Rate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
SAMPLE.C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
Dual Rate Sampling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
DUALSAMP.C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Using Mult ip le Digitizers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
MULT_AD.C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
Using the Packed Data Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
VME Bus Data Trans f ers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
VME_REAL.C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
VME Bus Data Transfers Using an Embedded Controller . . . . . . . . . . . . . . . . 72
SEGTST16 .CPP a nd SEGTST32.CPP #i nclude Files . . . . . . . . . . . . . . . . . 77
Local Bus Data Transfers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
LOCAL_AD.C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
LBUS2PST.C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
LBUSAUTO.C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
Using the Digitizer Status Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
STATUS.C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
Chapter 3. Understanding the Di git ize r . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
Chapter Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
HP E1429 Digitizer Block Diagr am . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
The Message and Register Int erfa ce s . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
Digitizer Command Paths . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
The Digitizer In put Secti on . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
SCPI Command Con tr ol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
Setting the Signal Range . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
Arming and Triggering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
The ARM-TRIG State Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
Arming the Digitizer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
Triggering the Digitizer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
The Sample Period . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
The Digitizer Reference Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
The Analog-to-Digital Converter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
Data Flow, Storage, and Con ver sions . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
Digitizer Data Flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
2 HP E1429A/B Digitizer User’s Manual Contents
Digitizer Data Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
Packed Reading Conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
Retrieving Readings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
Retrieving Readings Using READ? . . . . . . . . . . . . . . . . . . . . . . . . . . 139
Retrieving Readings Using FETCh? . . . . . . . . . . . . . . . . . . . . . . . . . . 139
Using DIAGnost ic: UP Load :SADDress? . . . . . . . . . . . . . . . . . . . . . . . . 141
Memory Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
The DIAGnostic Subsystem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
VME Bus Data Trans f ers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
Locating the Da ta Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
The VINStrument Subsystem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
Local Bus Data Transfers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
Local Bus Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
How Data is Transferred . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
Local Bus Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
Digitizer Lo cal Bus Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
Local Bus Transfer Configurations . . . . . . . . . . . . . . . . . . . . . . . . . . 159
Digitizer Configuration Restr ictions . . . . . . . . . . . . . . . . . . . . . . . . . . 161
Setting the Local Bus Tr an sfer Mode . . . . . . . . . . . . . . . . . . . . . . . . . 162
Setting the Lo cal Bus Data Source . . . . . . . . . . . . . . . . . . . . . . . . . . 163
Multiple Local Bus Data Tr an sfers . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
The Digiti zer Status Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
The Status Subsystem Comman d s . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
Status System Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
The Questionable Signal Status Group . . . . . . . . . . . . . . . . . . . . . . . . . 167
The Operation Status Group . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
The Standard Event St a tus Gr oup . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
The Status Byte Status Group . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
Saving Digi ti z er Configurations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
How to Save and Recall a C onfigurati on . . . . . . . . . . . . . . . . . . . . . . . 175
Chapter 4. Com mand Refe r enc e . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
Chapter Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
Command Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
Common Command Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
SCPI Command F orma t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
Ke yword Separa t or . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
Abbreviated Comm ands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
Implied (Opt ional) Keywords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
Variable Command Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
SCPI Command Pa ra m et er s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
Parameter Types, Explanations, and Examples . . . . . . . . . . . . . . . . . . . . 180
Optional Par am eters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
Querying Parameter Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
SCPI Command Execution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
Command Coupling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
Executabl e When Initiated C omm a nd s . . . . . . . . . . . . . . . . . . . . . . . . 183
Linking Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
SCPI Command Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
ABORt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
ARM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
[:STARt]:CO UNt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
[:STARt]:DELay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
Contents HP E1429A/B Digitizer User’s Manual 3
[:STARt][:IMMediate] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
[:STARt]:LEVel[<chan>]:NEGa ti ve <vo lt age> . . . . . . . . . . . . . . . . . . . . 192
[:STARt]:LEVel[<chan>]:POSiti ve <voltage> . . . . . . . . . . . . . . . . . . . . 193
[:STARt]:SLOPe[<n >] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
[:STARt]:SOURce[<n>] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
CALibration[<chan>] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
:COUNt? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
:DATA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
:DELay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
:GAIN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
:SECure:CODE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
:SECure:STATe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
:STORe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
:STORe:AUTO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
:VALue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
:ZERO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
CONFigure[<chan>] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
:ARRay:[VOLTage][:DC] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
DIAGnostic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
:CALibration[< ch an >]:CONVerge? . . . . . . . . . . . . . . . . . . . . . . . . . . 216
:CALibration[< ch an >]:GAIN:SENSitivit y? . . . . . . . . . . . . . . . . . . . . . 217
:CALibration[< ch an >]:ZERO:SENSitivity? . . . . . . . . . . . . . . . . . . . . . 217
:CHANnel[<chan >]:LABel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
:FETCh? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
:MEMory[< chan>]:FILL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
:MEMory[<chan>]:ADDResses? . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
:PEEK? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
:POKE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
:SGET? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
:SPUT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
:TEST? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
FETCh[<chan>] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
FETCh? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
:COUNt? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
:RECover? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
FORMat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
[:DATA] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
INITiate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
[:IMMediate] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
INPut[<port>] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
:FILTer[:LPASs][:STATe] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
:IMPedance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
[:STATe] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234
MEASure[<chan>] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
:ARRay[:VOLTage][:DC]? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
MEMory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
:BATTery[:ST ATe] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
:BATTery:CHARge? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
OUTPut . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
:ECLTrg<n>:FEED . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
:ECLTrg<n>[:STATe] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
:EXTernal[1]:FEED . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
:EXTernal[ 1][:STATe] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
4 HP E1429A/B Digitizer User’s Manual Contents
:TTLTrg<n>:FEED . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
:TTLTrg<n> [:STATe] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
READ[<chan>] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249
READ? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249
SENSe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
[SENSe[<chan>]]:FUNCtion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252
[SENSe[<chan>]]:FUNCtion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252
[SENSe[<chan>]]:ROSCillator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
:EXTernal: FREQuency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
:SOURce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255
[SENSe[<chan >]]:SWEep . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257
:OFFSet:POINts <count> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258
:POINts <count> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260
[SENSe[<chan>]]:VOLTage[:DC] . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262
:RANGe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262
:RESolution? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
STATus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265
:OPC:INITiat e . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266
:OPERati on|:QUEStionable:CONDi tion? . . . . . . . . . . . . . . . . . . . . . . . 267
:OPERati on|: QUEStionable: ENABle . . . . . . . . . . . . . . . . . . . . . . . . . 267
:OPERati on|:QUEStionable[:EVENt]? . . . . . . . . . . . . . . . . . . . . . . . . 268
:OPERati on|: QUEStionable: NTRansition . . . . . . . . . . . . . . . . . . . . . . . 269
:OPERati on|: QUEStionable: PTRansition . . . . . . . . . . . . . . . . . . . . . . . 269
:PRESet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270
SYSTem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271
ERRor? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271
:VERSion? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271
TRIGger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272
[:STARt]:CO UNt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
[:STARt][:IMMediate] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276
[:STARt]:SOURce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276
[:STARt]:TIMer [1] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278
PERIOD VALUE TABLE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280
[:STARt]:TIMer 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280
PERIOD VALUE TABLE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282
VINStrument . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283
Local Bus transfers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283
VME (VXI data transfer) Bus transfers . . . . . . . . . . . . . . . . . . . . . . . . 284
[:CONFigure]:LBUS:FEED . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
[:CONFigure]:LBUS:MEMory:INI Tia t e . . . . . . . . . . . . . . . . . . . . . . . 286
[:CONFigure]:LBUS[:MODE] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
[:CONFigure]:LBUS:RESet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
[:CONFigure]:LBUS:SEND:POINts . . . . . . . . . . . . . . . . . . . . . . . . . 289
[:CONFigure]:LBUS:SEND:POINts:AUTO . . . . . . . . . . . . . . . . . . . . . 290
[:CONFigure]:TEST :DATA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291
[:CONFigure]:VME: FEED . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
[:CONFigure]:VME:MEMory:INITi at e . . . . . . . . . . . . . . . . . . . . . . . . 294
[:CONFigure]:VME[ :MODE] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
[:CONFigure]:VME:SE ND:ADDRess:DATA? . . . . . . . . . . . . . . . . . . . . 296
:IDENtity? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
IEEE-488. 2 Common Command s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298
*CLS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
*DMC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
Contents HP E1429A/B Digitizer User’s Manual 5
*EMC and *EMC? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300
*ESE and *ESE? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300
*ESR? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301
*GMC? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301
*IDN? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302
*LMC? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302
*LRN? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303
*OPC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303
*OPC? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304
*PMC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304
*PUD and *PUD? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304
*RCL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305
*RMC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306
*RST . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306
*SAV . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307
*SRE and *SRE? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307
*STB? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308
*TRG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308
*TST? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
*WAI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
SCPI Conforma nce Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314
Appendix A. Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317
Appendix Conten t s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317
Memory Character i sti cs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317
Amplitude C ha ra ct eristics and Sig nal Conditionin g . . . . . . . . . . . . . . . . . . 319
Frequency and Sample Rate Cha ra cteristics . . . . . . . . . . . . . . . . . . . . . . 325
Internal Timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325
Trigger (Sample Clock) Subsystem . . . . . . . . . . . . . . . . . . . . . . . . . . 325
Bus Access and Connectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327
General Cha ra cteristic s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 328
Appendix B. Useful Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331
Appendix Conten t s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331
Appendix C. Register Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341
Appendix Conten t s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341
System Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341
Reading and Writing to the Registers . . . . . . . . . . . . . . . . . . . . . . . . . 342
Address ing the Reg isters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343
Determining the A24 Ba se Ad dre s s . . . . . . . . . . . . . . . . . . . . . . . . . . 344
Register Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347
A24 Register Ta ble
The Input C onfiguration Registers . . . . . . . . . . . . . . . . . . . . . . . . . . 350
The A/D Status Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350
The A/D S eria l Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350
The A/D Par al lel Strobe Register . . . . . . . . . . . . . . . . . . . . . . . . . . . 351
The A/D Shift Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351
The Arm a nd Trigger C on figuration Registers . . . . . . . . . . . . . . . . . . . . . . 353
The Abort and Arm Immediat e Register . . . . . . . . . . . . . . . . . . . . . . . . 353
The Arm St at us Re gister . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353
The Timebase Initiation Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . 354
6 HP E1429A/B Digitizer User’s Manual Contents
The Arm Interna l Bus Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355
The Arm Source Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355
The Arm Con trol Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 356
The Trigger Source Regi ster . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357
The Reference Oscil la tor Regist er . . . . . . . . . . . . . . . . . . . . . . . . . . . 359
The Arm delay Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360
The Arm Coun t Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360
The Arm Coun t Latch Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360
The Trigger Immediate Reg ister . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361
The Decade Division Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361
The Binary Division Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361
The Pre- Ar m Reading Count R eg isters . . . . . . . . . . . . . . . . . . . . . . . . 362
The Post-Arm Rea di ng Count Registers . . . . . . . . . . . . . . . . . . . . . . . . 362
The Memory Control Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363
The Traffic Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363
The Pulse Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364
The Channel ID Re gister . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364
The Data Regi ster . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364
The Memory Control Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365
The Memory Address Regist er s . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366
The Terminal Address Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367
The Base Address Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367
Configuring the Digitizer Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368
Using the A/D Shift Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368
Enabling the Inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369
Setting the Input Impeda nce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 370
Enabling the 10 MHz Filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 370
Setting the Measurem en t Ran g e . . . . . . . . . . . . . . . . . . . . . . . . . . . . 370
Arming and Triggering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 372
Checking the Idle State . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 372
Setting the Digi tizer Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . 373
Setting the Arm Sour c e s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373
Setting the Arm Count . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 374
Setting the Arm Delay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 374
Setting the Re ference Source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375
Setting the Trigger Source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 376
Sending an Arm Immediate Signal . . . . . . . . . . . . . . . . . . . . . . . . . . . 376
Sending a Tr i gger Immed ia te Signal . . . . . . . . . . . . . . . . . . . . . . . . . 377
Aborting Measuremen t s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377
Re-initiating the Digiti z er . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 378
Initializing Digitizer Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 378
Initializing and Initiating the Timebase Processor . . . . . . . . . . . . . . . . . . . 380
Retrieving Da ta from Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385
Initializing Di gitiz er Memory to Retrieve Data . . . . . . . . . . . . . . . . . . . . 385
Example Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 388
Contents HP E1429A/B Digitizer User’s Manual 7
Appendix D. Local Bus Interleaved Transfers . . . . . . . . . . . . . . . . . . . . . . . . 405
Appendix Conten t s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 405
Interleaved Transfers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 405
Setting the Interlea ved Tr an sfer Mode . . . . . . . . . . . . . . . . . . . . . . . . . 406
Programming Pr ocedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 407
Example Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 408
Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 413
8 HP E1429A/B Digitizer User’s Manual Contents
Certification
Hewlett-Packard Company certifies that this product met its published s peci fica t ions at the time of ship me nt from th e fact ory. Hewlet t­Packard further certifi es that its calibrat ion mea sureme nt s are tracea ble to the Unit ed Sta tes Na tion al Institut e of Standards and Technol­ogy (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 Hewlet t-Pa ck ar d product is warr ante d agai nst de fect s in mate rials and w orkmansh ip for a period of three years from date of ship­ment. Duration and conditi ons of warranty f or this pr oduct ma y be super seded when the p r oduct is integrate d in to ( becomes a part of) other HP product s. Du ring the warrant y period, Hewlett-Packard Company will, at its opt ion, either repair or re pl ace pr oducts which prove to be defective.
For warranty se r vice or repair, this product mu st be r et ur ned to a service facil ity de si gnated by Hewlett-Packard (HP). Buyer shall pre­pay shipping cha rges to HP and HP shall pay shipping charges to retu rn t he product to Bu yer. Howe ver, Buyer shall pa y all ship ping charges, duties, and taxe s for products returned to HP from anot her count r y.
HP warrants that its softwar e and firmwar e designa ted b y HP for use with a product will execute its programmin g instru cti ons wh en properly installe d on that product. HP does not warrant that the operat ion of the product, or software , or firmware will be uninterrupted or er ro r f r ee.
Limitation Of Warrant y
The foreg oin g warra nt y sh al l not apply t o defects resulting from improper or inadequa t e mai nt enance by Buyer, Buyer-supplied prod­ucts or interfacing, unauthori ze d m odificati on or misus e, operation outside of the environmenta l specificat i ons for the product, or im­proper site prep arat i on or maint ena nce.
The design and imp le mentation of any circuit on this product is the sole responsibility of the Buyer. HP does not warrant the Buyer’s circuitr y or malfunctions of HP products that result from the Bu yer’s circuitry. In addition, HP d oes not warrant a n y damage that oc­curs as a result of the B uyer’s circuit or any defects th at re sult from Buyer-supplied product s.
NO OTHER WARRANTY IS EXPRESSED OR IMPLIED. HP SPECIFICALLY DISCLAIMS THE IMPLIED WARR ANT IES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
Exclusive Remedie s
THE REMED IES 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 CON­TRACT, TORT, OR ANY OTHER LEGAL THEORY.
Notice
The information contained in this document is subject to change without notice. HEWLETT-PACKARD (HP) MAKES NO WAR­RANTY OF ANY KIND W ITH REGARD TO THIS MATERIAL, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WAR­RANTIES 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 docu­ment c ontains proprietary information which is protect ed by copyright. A ll ri ghts are reserved. No part of this document may be photo­copied, reproduced, or translate d to another lan guage wit h out the prior written consent of Hewlett -Packar d C ompany. HP assumes no responsibility for the use or reliability of its software on equipment that is not furnished by HP.
Restricted Rights Legen d
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 (Ma y 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 ha ve o n ly th o s e ri gh t s pr o vi d e d f or such Software and D ocum ent at ion by the applicable FAR or D FARS clause or the H P st andard software agreement for the product involved.
HP E1429A/B 20 MSa/ s 2-Channel Digi tizer User’s Manua l
Copyright © 1993 He wle tt-Pa cka rd Company. All Right s Reser ve d.
Edition 2
HP E1429A/B 20 MSa/s 2-Channel Digitiz er User’s Manual 9
Documentatio n 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 Edi­tion number increment s by 1 whenever the manua l is revised . Updates , which are issued betw een Edi ti ons, c ontain repla ce ment pa ges to correct or add additional information to the current Edition of the manual. Whenever a new Edition is created, it wil l contain all of the Update inf ormat ion for the pre viou s Editi on. Each new Ed iti on or Update also incl ude s a revis ed c op y of this documentation his­tory page.
Edition 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . March 1993
Edition 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . June 1993
Safety Symbols
Instruction manual symbol affixed to prod­uct. Indicat es that the us er must refer to the manual for specific WARNING or CAU­TION information to avoid personal injury or damage to the product.
Indicates the field wiring terminal that must be connected to earth ground before operat­ing the equipment—protects against electri­cal shock in case of fault.
Frame or chassis ground termi nal — t ypi-
or
cally connects to the equipment’s metal frame.
WARNING
CAUTION
Alternating current (AC).
Direct curren t (DC).
Indicate s ha za rdous voltages.
Calls at te nt i on t o a pr ocedure, practi ce, or condition that could cause bodily injury or death.
Calls at te nt i on t o a pr ocedure, practi ce, or con­dition that could possibly cause damage to equipme nt or perma nen t los s of data.
WARNINGS
The following ge ner al safet y prec aut ions mus t be observed du ring al l phas es of oper ation , ser vice , and repai r of this pr oduct. Failure to comply with these precautions or with specific warnings elsewhere in this manual violates safety standards of design, manufacture, and inten ded use of the product. Hewlett-Packar d Company assumes no liability for the custo mer’s failu re to comply with these requirements.
Ground the equipment: For Safety Cl as s 1 equipmen t (equ ipment ha vin g a protective ea rth ter mi nal) , an unint erru ptib le sa fety earth
ground must be provide d from the ma in s power sour ce to the produ ct input wi rin g termi nals or suppli ed power cable .
DO NOT operate the produc t in an explosive at mospher e or in the presen ce of flammable gases or fume s.
For continued protect ion a gainst fire, repl ace the line fuse (s) only with fuse(s) of the same voltage and current rating and type . DO NOT use repaired fuses or short-circui ted fuse holders.
Keep away from live circuits: Operatin g personnel must not remove equipment covers or shields. Procedures involving the removal of covers or shields are for use by service-trained personnel onl y. Unde r ce rta in c onditi ons , dangerous voltages may exist even with the equipment switched off. To avoid dangerous ele ctrical shock , DO NOT perf orm procedures involving cover or shield removal unless you are qualified to do so.
DO NOT operate damaged equipment: Whene ver it i s p ossibl e tha t the sa fe ty protection features buil t int o t hi s product have been im­paired, eithe r t hr ough physical dam a ge, excessive moisture, or an y 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-P ackar d Sales and Se rvice O f­fice for service and repair to ensure that safety features are maintaine d.
DO NOT service or adjust alon e: 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 introducin g additional hazards , do not install substitute parts or perform any unauthorized modifica tion to the product. Retur n the product to a Hewlet t-P ackar d Sales and Ser vice O ffice for service and repair to ensure that sa fe ty features are mai ntained.
10 HP E1429A/B 20 MSa/s 2-Cha nnel Digitiz er User’s Manual
Declaration of Conformity
according to ISO/IEC Guide 22 and EN 45014
Manufacturer’s Name: Hewlett-Pa ckar d C ompany
Loveland Manufacturing Center
Manufact urer’s Addre s s: 815 14th Street S.W.
Loveland, Colorado 80537
declares, that the product:
Product Name: 20MS a/s Digitizer
Model Number : HP E1 429A
Produc t Opt ion s: All
conforms to the following Pr od uct Spe cifi cati ons :
Safety: IEC 1010-1 (1990) Incl . Amend 1 (1992) /E N610 10-1 (1993)
EMC: CISPR 11:1990/EN55011 (1991): Group1 Class A
IEC 801-2:1991/ E N5008 2-1 (1 992) : 4kVCD, 8k VA D IEC 801-3:1984/ E N5008 2-1 (1 992) : 3 V/m IEC 801-4:1988/ E N5008 2-1 (1 992) : 1kV P ower Lin e
Supplementary Information: The product her ewi th c omplies w ith the requirements of t he Low Voltage Dire ctive 73/23/EEC and the EMC Directive 89/336/EEC.
Tested in a typical configuration in an HP C-Size VXI m ai nframe.
March 1, 1993 Jim White , QA Manager
European conta ct: Your loca l He wlett-Pa cka rd Sales a nd Servi ce O ffic e or Hewlett- Packa rd GmbH, Departm ent ZQ/Standards E urop e, Herren ber g er Straße 130, D-70 30 Böblingen , Germa ny (FAX +49-703 1-14 3143 ).
HP E1429A/B 20 MSa/s 2-Channel Digitizer User’s Manual 11
Notes
12 HP E1429A/B 20 MSa/s 2-Cha nnel Digitiz er User’s Manual
Chapter Contents
Chapter 1
Getting Started
This chapter covers the features, configuration, and programming procedures for the HP E1429A/B 2-Channel, 20 MSa/s Digitizer. The main sections of this chapter include:
HP E1429A/B Features and VXIbus Configuration . . . . . . . 13
Preparation for Use . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Introductory Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Sending the *IDN? Command. . . . . . . . . . . . . . . . . . . . . . 20
Digit izer S elf -Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Reset ting and Clearing the Digitizer . . . . . . . . . . . . . . . . . 23
Queryin g the Digitizer Conf iguration . . . . . . . . . . . . . . . . 25
Instrument and Programming Languages . . . . . . . . . . . . . . . 28
Introduction to Programming. . . . . . . . . . . . . . . . . . . . . . . . . 33
Where to go Next . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
HP E1429A/B Features and VXIbus Configuration
The HP E1429A/B is a 2-Channel, 20 MSample/second digitizer. The HP E1429A/B digitiz ers are VXI messa g e-bas ed instru ments, but ca n also be programmed at the register level (register programming is covered in Appendix C). The features of the HP E1429 A and HP E1429B are the same, except that the HP E1429B also has VX I Local bus data trans f er capab ility. This manual c overs t he u s e of bot h di gitizers.
Front Panel Description
Figure 1-1 describes the front panels of the HP E1429A/B digitizers.
Chapter 1 Getting Started 13
Figure 1-1. The HP E1429A/B Digitizer
14 Getting Started Chapter 1
HP E1429A/B
VXIbus
Configuration
Table 1-1 lists the digitiz er’s VXIbus d evic e infor mation and fact ory settings. Appendix A has the complete list of HP E1429A/B operating specifications.
Table 1-1. HP E1429A/B VXIbus Configuration
VXIbus Device Info rmation
Device type: messag e-based s ervant C-size (1 slot) Connectors: P1 and P2 Addressing modes: A16/A24 Data transf er mo des: D08/D16/D3 2 sla v e A24 size: 4096 bytes Dynamical ly Conf igur able Non-interrupter/non-interrupt handler VXIbus R evision Compli anc e: 1.4 SCPI Revision: 1992.0 See side of module for po wer/cooling requirements
HP E1429A/B Factory Settin gs
Parameter Setting
Logical Address 40
Servant Area 0 (not used)
Bus Requ est Level 3
Input signals (DC and AC) which may be connected to this module are likely to include occasional overvo ltag e transi ent s. These overvoltages may be caused by moto r inductan ces, switchin g circuits, lightning, etc.
If the input signal is likely to exhibit transien ts great er than 800 Vpk, add external transient suppression circuitry to reduce transients to 800 Vpk or less.
Chapter 1 Getting Started 15
Caution The 800 Vpk level is a product safety test specification and
does not assure correct product operation if 800 Vpk transients have been applied. To maintain product functionality and performance, do not exceed ±42 Vpk on the single-ended inputs, or ±102.4 Vpk on the differential inputs.
Preparation for Use
This section contains configuration information specific to the HP E1429A/B digitizer.
Note For more (VXIbus) system configuration information, refer to the C-Size
VXIbus Systems “Installation and Getting Started Guide".
The Digitizer
Logical Address
Assigning the Digitizer
to a Commander
The HP E1429A/B d igitizer logical address is u sed:
to place the digitizer in the servant area of a commander
(e.g. HP E1406 Command Module, embedded controller, or another instru ment).
to address the digitizer (see “Addressing the Digitizer” or “ Using
an Embedd ed Contr oller” later in this chapt er.)
In a VXIbus system, every device must be in the servant area of a commander ( with the exception of the t op-level comander).
Note the following when assigning the digitizer to a commander:
A commander’s servant area is defined as:
Servant area = (logical address + 1) through (logi cal address + servant area switch setting)
The HP E1429A/B digitizer is a message-based device. If an
embedd ed controller a n d an HP E1406 Com mand Module are part of your VXIbus system, put the digitizer in the servant area of the controller. This enab les you to program the digitiz er at higher speeds across the VXIbus backplane, rath er than o ver the Hewlett-Pac kard Interface Bus (HP-IB*) via the Command Module.
* HP-IB is Hewlett-Pack ard’s implementation of IEEE St d. 488.1-1978
16 Getting Started Chapter 1
If your system uses an external controller and the HP E1406
Comman d Modu le, put t he digitizer in the servant area of the Command Module. This enables the module to function as the HP-IB interfac e to the digitizer.
The HP E1406 Command Modu le has a factory set l ogical addre ss of 0 and a servant area switch setting of 255. Using the factory settings, it is not necessary to change the logical address of the digitizer (40) to place it in the servant area of the Command Module.
If the digitizer is used with the HP E1485 Digital Signal Processing
(DSP) module, the digitizer must be in t he serva nt area of the DSP module.
The digitizer’s logical a d dres s switch is shown in Figu r e 1-2.
Figure 1-2. HP E1429A/B Logical Address Switch Location
Chapter 1 Getting Started 17
Note The digitizer’s servant area switches are not used and should be left in their
factory-set (0) position.
The Digitizer Bus
Req uest Level
Bus Request Level
Guidelin es
Inst al l ing the
Digitize r
The bus request level is a priority at which the HP E1429A/B d igitizer can request the us e of the VME (VXI Data Transfer) Bus.
There are four bus requ est lines (BG0 - BG3) from which one is
selected (Figure 1-2). Bus request li ne 3 has the highest priority, bus request line 0 has the lowest priority. It is not necessary to change the bus request level setting (BG3) on the digitizer.
More information on th e Data Transfer Bus can be found in the
C-Size VXIbus Systems “Installation and Getting Started Guide”.
The HP E1429A/B digitizer can be installed in any mainframe slot except slot 0. However, in applications where the HP E1429B is generating data over the Local bus, insta l l the digitizer in the left slot adjacent to the module(s) rec eivin g the data. Fi gure 1-3 shows the installation of a sample Local bus configuration.
Figure 1-3. Installing the HP E1429B Digitizer in a Local Bus Config urat ion
18 Getting Started Chapter 1
Note For compliance with European EMC sta nda r ds EN 55011 and
EN 50082-1, backplane connector shields are included with each HP E1429A/B digitiz er ordered. The shields need only be installed in the VXI mainframe if it is necessary to comply with these standards.
Addr e ssing the
Digitizer over HP-IB
Devices in the Series C mainframe and in the servant area of the HP E1406 Command Module are located by an HP-IB address. The HP-IB address is a combination of the controller’s interface select code, the Command Module’s primary HP-IB address, and the device’s secondary HP-IB address. An address in this form appears as:
70905
Interface Select Code (7): Determined by the address of the HP-IB interface card in the contr olle r . In most H ewlett-Packard controllers, this card has a factory s et addre ss of 7, including the HP 82335 HP- IB Interface Card (t his ca r d w as used with an HP V e ctra AT comp atible personal computer to create the C programs on the example programs disk).
Primary HP-IB Address (09): Th is is the address of the HP-IB port on the Command Module. Valid addresses are 0 to 30. The Command Module has a factory set address of 9.
Secondary HP-IB Address (05): This address is d erived from the logical address of the digi tizer by dividing the logical address b y 8. Thus, for the HP E1429A/B digitiz er factory set logical address of 40, t he sec ondary address is 05.
Addr e ssing the
Digitizer using an
Embedded
Controller
As a message-based device, the HP E1429A/B digitizer can easily be programmed across the VXIbus backplane from a HP E1499A V/382 embedd ed controller . Th e select code of the VXI interfa ce board in embedded controllers is typically 16. Since no secondary HP-IB address is required when progr amming over the bac kplane, the logical address of the HP E1429A/B digitizer is combined wit h the VXI i nt erface select code:
1640 (for device logical address 40; rang e = 01 to 99)
If the digitizer’s logical address is changed to a value greater than 99, the address becomes:
160xxx
Chapter 1 Getting Started 19
Introductory Programs
The introductory programs in this section include:
Sending the *IDN? Command
Digitizer Self-Test
Resetting the digitizer and clearing the status registers
Queryin g the digitizer c onfigurat ion
HP BASIC and C language versions of the introductory programs follow. C language versions of these and all programs in t he manual are contain ed on the following disk which s hips with the manua l:
HP E1429A/B Example Programs: C Language
3.5" 720 KByte disk (HP E1429-10302)
Other than the introductory programs and selected programs throughout the manual, t h e program l istings show only the digitizer commands.
Sending the *IDN?
Command
HP BASIC
10 !Send the *IDN? command, enter and display the re sult. 20 DIM Message$[80] 30 OUTPUT 70905;"*IDN?" 40 ENTER 70905;Message$ 50 PRINT Message$ 60 END
IDN.C
/* IDN.C - This program sends the *IDN? command to the digitizer as a */ /* way to determi ne if the compu t er is com muni c ating with the di gi tizer */
/* Include the following header files */
The following programs are a fast metho d for det ermining if the digitizer is set to the int ended addre ss a nd is communicating with the computer. The programs send the *IDN? command which returns:
HEWLETT-PACK ARD,E1429A,0,A.02.00
#include <stdio.h> #include <cfunc.h> /* This file is from the HP-IB Command Library Disk */
#define ADDR 70905 /* I/O path from the PC to the digitizer */
Continued on Next Page
20 Getting Started Chapter 1
/****************************************************************************/ void main(void) /* Run the program */ {
char message[80]; intlength = 80;
IOOUTPUTS(ADDR, "*IDN?", 5); /* send *IDN? comm and */ IOENTERS(ADDR, me s sage, &length); /* enter *IDN? response */
printf("%s\n", message); /* print*IDN? response */
}
Digitizer Self-Test The digitizer self-test is executed with the co mmand:
*TST?
The digitizer parameters tested include:
internal interrupt lines
measurement range integrity
measurement RAM integrity
battery charge
timebase integrity
The self-test takes approxima t ely 30 seconds to comple t e. Upon co mpletion, one of the self-test codes listed in Table 1-2 is returned.
Table 1-2. HP E1429A/B Self-Test Codes.
Self-Test Code Description
0 T est passed 1 Test failed. An error message describes the failure.
Chapter 1 Getting Started 21
HP BASIC
Caution Executing the self-test erases the readings in the digitizer’s
non-volatile memory.
If the self-test fails, the command:
DIAGnostic:TEST?
can be executed to obtain additional information on the failure. Note that DIAGnost ic:TEST can return a str ing up to 40 c har a ct ers.
10 !Send the self-test command, enter and display the r e sult. 20 DIM Message$[256],Diagnostic$[40] 30 OUTPUT 70905;"*TST?" 40 ENTER 70905;Rslt 50 IF Rslt <>0 THEN 60 REPEAT 70 OUTPUT 70905;"SYST:ERR?" 80 ENTER 70905;Code,Message$ 90 PRINT Code,Message$ 100 UNTIL Code =0 110 OUTPUT 70905;"DIAG :TES T?" 120 ENTER 70905;Diagnostic$ 130 PRINT Diagnostic$ 140 END IF 150 PRINT Rslt 160 END
SLFTST .C
/* SLFTST.C - Thi s program perform s a self-t est on the digitizer and prints */ /* out the resulting self-te st code */
/* Include the following header files */ #include <stdio.h> #include <cfunc.h> /* This file is from the HP-IB Command Library Disk */
#define ADDR 70905L /* I/O path from the PC to the digitizer, via the E1406 */
Continued on Next Page
22 Getting Started Chapter 1
/****************************************************************************/ void main(void) /* Run the program */ {
char message[256], diagnostic[80];
intlength = 256;
float tst;
IOOUTPUTS(ADDR, "*TST?", 5); /* send the self-test command */
IOENTER(ADDR, &tst); /* enter the code */
printf("%d\n\n" , (int) tst); /* display the code */
if (tst != 0)
{
IOOUTPUTS (ADDR, "SYST:ERR?", 9); /* query error register */ IOENTERS(ADDR, me s sage, &length); /* enter error message */
printf("Error: %s\n\ n", me s sage); /* print error message */
IOOUTPUTS (ADDR, "DIAG:T ES T?" , 10); /* get diagnostic information */ IOENTERS(ADDR, diagnostic, &length); /* on self-test error */ printf("Diagnosti c infor mat i on: % s\n", diagnostic);
} }
Resetting and
Clearing the
Digitizer
The commands used to reset and clear the digitizer are:
*RST *CLS
*OPC? (OPeration Complete) is often executed after *RST and *CLS to allow the reset and clear to c omplete before progra m e xecution cont inues .
Resetting the digitizer sets it to its power-on c onfiguration, and clearing the digitizer clears its status registers. Additional info r mation o n the status registers is lo cat ed in Chap t er 3.
Chapter 1 Getting Started 23
HP BASIC
RSTCLS.C
10 !Assign an I/O path between the computer and digitizer. 20 ASSIGN @A_d TO 70905 30 COM @A_d 40 !Call the subprogram 50 Rst_cls 60 END 70 ! 80 SUB Rst_cls 90 Rst_cls: !subprogram which resets and clears the digitizer. 100 COM @A_d 110 OUTPUT @A_d;"*RST;*CLS; *OP C?" !reset and clear 120 ENTER @A_d;Complete 130 SUBEND
/* RSTCLS.C - This program re sets the digi tizer and clears its status register */
/* Include the following header files */ #include <stdio.h> #include <cfunc.h> /* This file is from the HP-IB Command Library Disk */
#define ADDR 70905L /* I/O path from PC to the digitizer, via the E1406 */
/* Function Prot oty p e s */
void rst_cl r(v oi d);
/****************************************************************************/ void main(void) /* Run the program */ { rst_clr(); /* Reset and clear the digitizer */ } /****************************************************************************/ void rst_clr(void) {
IOOUTPUTS(ADDR, "*RST;*CLS", 9); /* reset and clear the digitizer */ }
24 Getting Started Chapter 1
Configurat ion
HP BASIC
Querying the
Digitize r
After resetting the digitizer or cycling power, the digitizer parameters are set to their power-on values. These values are listed in Appendix B, Table B-2. You can determine the digitizer’s reset settings or its current configuration using the command:
*LRN?
The data returned b y *LRN? is a semicolon (;) separated list of each paramet er setting.
10 !Assign an I/O path between the computer and the A/D. 20 ASSIGN @A_d TO 70905 30 !Call the subprogram 40 Lrn_conf(@A_d) 50 END 60 ! 70 SUB Lrn_conf(@A_d) 80 Lrn_conf: !subprogram which queries the digitizer configurat i on 90 DIM Lrn$[2000] 100 INTEGER I 110 OUTPUT @A_d;"*LRN?" 120 ENTER @A_d;Lrn$ 130 Lrn$=Lrn$&";" 140 REPEAT 150 I=POS(Lrn$,";") 160 PRINT Lrn$[1;I-1] 170 Lrn$=Lrn$[I+1] 180 UNTIL Lrn$="" 190 SUBEND
Chapter 1 Getting Started 25
LRN.C
This program uses a 2,000 element character array. To prevent stack overflow errors when compiling and running this program using Microsoft® Q uic kC©, change the stack size using the /F option of the “qcl” command. An example of how this program might be compiled is:
qcl /AL /F 8192 b:\lrn. c c:\ qc2\ l ib\clhpib.lib
/* LRN.C - This program queries the digitizer’s reset condition s */
/* Include the following header files */ #include <stdio.h> #include <string.h> #include <cfunc.h> /* This file is from the HP-IB Command Library Disk */
#define ADDR 70905L /* I/O path from PC to the digitizer, via the E1406 */
/****************************************************************************/ void main(void) /* Run the program */ { char static *codes[] = {"*RST","*LRN?;*OPC?"} ; char lrndata[2000], *prt, ch; int loop,
length = 2000;
/* Execute each command group using a loop */
for (loop = 0; loop < (sizeof(codes) / sizeof(char*)); loop+ + )
IOOUTPUTS( ADDR, codes[loop], strlen(codes[loop]));
/* Enter data returned by *LRN into string */
IOENTERS(ADDR, lrndata, &length);
/* Start line counter */ loop = 1;
/* Separate *LRN? data into tokens delimited by ";". Read and */
/* print the first *LRN? data point */
Continued on Next Page
26 Getting Started Chapter 1
prt = strtok(lrndata,";"); printf("\n\t%s",prt);
/* Print out each (*LRN? data) token */ while (prt != NULL) {
prt = strtok(NULL,";");
/* Exit when data returned by *OPC? (1) is reached */
if (atoi(prt) == 1)
break;
/* Print one user screen’s worth of *LRN? data, have user */
/* press ’Enter’ to see the next screen of data */
if (loop >= 23)
{
printf("\n\nPr e ss \’Enter\ ’ to c onti nue"); scanf("%c" , &ch); fflush(stdin);
loop = 0; } printf("\n\t%s",prt);
loop ++;/* increm ent counter */ } }
Chapter 1 Getting Started 27
Instrument and Programming Languages
The purpose of this manual is to teach you how to use the HP E1429A/B digitizer. To do this, the manual us es block diagra m s, flowcharts, and example programs. In most cases, the manual’s example programs list only the digitizer’s SCPI c ommand s. The I/O (input/output) constructs depend on the programming language you use.
SCPI Programming SC PI (Standar d C omma nds f or Programma ble Instruments) is an
ASCII-based instrument command language des igned for test and measurement instruments. The message-based digitizer has an on-board microprocessor wh ich interprets the ASCII command stri ngs and returns ASCII formatted results.
Command Listings The typical format of commands listed in the command reference and
throughout t his manual is:
TRIGger[:STARt]:TIMer1 <period>
To aid in lear ning the digitizer c o mmand set, al l headers are inc lude d in the example programs; however, the headers are abbreviated. In an
example program, the previous statement with a period parameter o f
µs would appear as:
10
TRIG:STAR:TIM1 10E-6
Note Chapter 4 contains more information on the structure and execution of SCPI
commands.
Coupled Commands Some of the digitizer SCPI commands are functional or value coupled.
Functionally coupled commands are those that for one command to have affect, another command must be set to a particular value. Value coupled commands are t hose where changing the value of one command, changes the value of the others.
28 Getting Started Chapter 1
Coupled commands can cause “Settings conflict” errors when the program executes. When a coupled command is executed, the command setting is evaluated by t he digitizer processor. If the setting causes an illegal digitizer configuration, a "Settings conflict" error occurs. The error messa ge lists the conflicting settings, and then reports the values set by the digitizer processor.
The "Comments" section of each command reference entry (Chapter 4) indicates if a command is coupled, and if it is, what the coupling constraints are.
How to Execute
Coupled Commands
To prevent possible "Settings conflict" errors, coupled commands must be contiguous and executed in the same program statement. This is done by placing the commands in the same program line, or for HP BASIC programs, by suppr e ssing the EOL terminator until the last (coupled) command has been sent.
To send multiple commands in a single line or in a single statement, the commands ar e linked with a s emi colon (;) and a colon (:). This is illustrated in the foll owing l ines :
OUTP:EXT1:STAT ON;:TRI G:SO UR EXT1;:O UTP :EXT1: STAT OFF
or
OUTP:EXT1:STAT ON; :TRIG:SOUR EXT1; :OUTP:E XT1:STA T OFF
Notice that the semicolon (;) and colon (:) link commands with in different subsystems. Only a semicolon (;) is requir ed to link commands at the sa me level with in the sa me subsystem.
Sending the commands as shown prevents "Settings conflict" errors. The command settings are not evaluated until the EOL terminator is received after the last command. If these commands were sent individually (an EOL terminator after each co mmand), a "Settings conflict" error would occur because of the coupling betw een OUTP:EXT1 :STA T ON a n d T R IG:SOUR EXT1.
Terminating
Commands
Suppressing the
End-Of -L i n e
Terminator
A SCPI command string is terminated with a line feed (LF ) a nd/or with an End Or Identify (EOI) message. The carriage return (CR) is ignored.
Suppressing the end-of-line (EOL) terminator on a command line allows coupled commands to be sent on separate lines, yet as a single program statement. I n HP B ASIC programs, the EOL terminator is suppr e ssed by
Chapter 1 Getting Started 29
pla cing a semicol on ( ; ) foll owing the quotation ma rk ( " ) which c loses the command string:
OUTPUT 70905;"OUTP:E XT1:STAT ON;"; OUTPUT 70905;":TRIG:SOUR EXT1;"; OUTPUT 70905;":OUT P:EXT 1:ST AT OFF "
Since the last command is the end of the command string, the EOL terminator is not suppressed.
Note In the C language programs contain e d in this manual, there is no end -of-line
terminator to suppre ss a s the c ommands ar e ex ecuted as elements of an array.
C La nguage
Programs
The C languag e versio ns of the example programs (disk P/N E1429-10 301) were written for the HP 82335 HP-IB Interface Card using the HP-IB Command Library for C. Unless otherwise noted, the library functions used in the programs are compatible with the ANSI C standard.
The following section identifies the system on which the programs were written, shows how to compile and link the programs, and describes the structure of an e xa mple program.
System Configuration The C programs were d ev eloped on the following system:
Controller: HP Vectra 386/25 personal computer
(386 processor operated at 25 MHz)
HP-IB Interface Card: HP 82335 HP-IB Interface with
Command Library
Mainframe: HP 75000 Series C
Slot0/Resource Manager: HP E1406 Command Module
HP E1429A/B Logical Address: 40
Instrument Language: SCPI
30 Getting Started Chapter 1
C Compilers Used The C Language programs were compiled (and tested) using the following
compilers:
Microsoft® QuickC© Version 2.0
Borland Turbo C++© Version 1.0
Compiling and Linking
the Programs
To run a C pr og r a m, y ou must comp ile a n d link the progr am to mak e an execut able file. T o compil e and link a progr am:
Be sure the necessary paths have been added to the
AUTOEXEC.BAT file for the co mpilers to find the library and header files (s ee the app ropr ia t e C Language manual to set the proper pat hs).
Link the appropriate HP-IB C libr ary (located on the HP-IB
Command Library disk that came with the HP-IB Interface Card). Use the following libraries :
Microsoft® QuickC©: clhpib.libTurbo C++©: tchhpib.lib
If NOT compiling in the Large/Huge memory mode l, inc lude the
“cfunc.h” header file (located on the HP-IB Command Library disk) in the program.
Command Line Compiling
To compile and link the programs from the DOS command line using the Large memory model, execute the following from the directory containing “qcl” or “tcc”.
Microsoft® QuickC©:
qcl /AL <path \program name > <path \clhpib.lib >
qcl /AL b:\input.c c:\qc2\lib\clhpib.lib
e.g.
Turbo C++©:
tcc -ml <path \program name > <path \tchhpib.lib >
tcc -ml b:\input.c c:\tc\lib\tchhpib.lib
e.g.
Change the “/AL” and “ -ml” parameters to the appropriate types when compiling in the smaller mem or y models (s ee your C la ngua ge manual for the parameter type). For some programs ex ecuted under the Microsoft® QuickC© environment, if may be necessary to change the stack size using the /F option of the ’qcl’ command.
Chapter 1 Getting Started 31
Once compiled and linked, an executable file (.EXE) and object file (.OBJ) are created in th e current direct ory. You execut e t he program by typing and entering the file name (with th e .EXE extension).
Compiling in the Integrated Environment
You can compile, link, and run your C programs from the Microsoft® QuickC© or Turbo C
++© integrated environments. To do so, add:
program_name.C CLHPIB.LIB
to the program list (under the "Make" menu) in the Microsoft® QuickC© environment. Under ’Environment’ in the "Options" menu, i nc lude pat hs to the header files and external CLHPIB.LIB library. For example:
Include Files Directory: [c:\qc2\include]
Library Files Directory: [c:\qc2\lib]
In the Turbo C
++© environment, add the items:
program_name.C TCHHPIB.LIB
to the project (under the "Project" menu). Under ’Directories ...’ in the "Options" menu, include paths to the header files and external TCHHPIB.LIB library. For example:
Include Directories C:\TC\INCLUDE
Library Directories C:\TC\LIB
C Program Format The general f ormat of the C language programs on the example pro grams
disk is shown in the program listings at the end of this chapter. Generally, the program flow is:
reset and clear the digitizer
configure the d i gitizer
check for configuration e rrors
trigger the digitiz er and retrieve the reading s
32 Getting Started Chapter 1
Introduction to Programming
The SCPI commands used to program the digit izer are separated into two groups: common commands and subsystem commands. Common commands begin with an asterisk, and include commands such as *RST, *CLS, *OPC?. Chapter 4 contains a complete listing of the digitizer’s common c ommands.
Subsystem comma n d s are those commands which conf ig u re the digitizer. Each subsystem is a set of commands that roughly corresponds to a functional bloc k inside the digitizer. Figure 1-4 ide nt i fies the SCPI subsystems used with the digitizer.
* Arm s ource * Arm c ount * Arm delay
* Trigger source * Trigger count * Sampl e ra t e
* Enable input * Input impedanc e * Input filter
other subsystems CONFigure MEASure CALibration DIAGnostic OUTPut STATus SYSTem
* Initiate m eas urements
* Digitizer reading format
* Reference oscillator source * Pre- and post -ar m read ing coun t * Measurement rang e
* Abort m easurements
* Retrieve readings
* Non-volatile memory enable
* VME bus data transfers * Local bus da ta transf er s
Figure 1-4. HP E1429A/B Digitizer Command Subsystems
Chapter 1 Getting Started 33
Using the MEASure
and C O NFigure
Commands
Each time the digitizer takes a reading, it does so from a configuration based on parameters set by the digitizer subsystems (Figure 1-4). The easiest way to set these parameters is with the MEASure or CONFigure command.
MEASure[<
expected value
[,<
CONFigure[<
expected value
[,<
chan
>]:ARRay[:VOLTage][:DC]? (<
>[,<
resolution
chan
>]:ARRay[:VOLTage][:DC] (< >[,<
resolution
>]] [, (@<
>]] [, (@<
size
input port
size
input port
>)
>)]
>)
>)]
< chan > is the digitizer channel (1 or 2) configured. This parameter is optional. If a channel is not specified, channel 1 is assumed.
(< size >) is the total number of pr e-arm and post-arm re adings (samples) taken each time an arm signal occurs. Note the space between the command header and the <size > parameter.
<expected value > is the amplitude (range) of the signal to be measured. This optional parameter is used to set the digitizer measurement range. If an expected value is not specified, th e digitizer de faults to the 1V range.
<resolution > is the reading resolution and is determined from the expected value. There is a fixed resolution for each measurement range (Table 3-2). If a specified resolution is greater that what is available for that range (expected value), an error occurs.
(@<input por t>) is the channel input port (single ended or differential) to
which the input signal is applied. Readings can be taken on only one input port per channel at a time.
Table 1-3 lists some of the commands and t h eir settings that are equivalent to the values set by MEASure and CONFigure.
When MEASur e ? or CONFigure is ex ecuted, many of the digitizer parameters are set to their reset values (see Appendix B, Table B-2 for a complete listing of reset values). The parameters specified within the MEASure or CONFigure command are then set accordingly. This prevents "Settings conflict" errors from occurring due to previous digitizer configurations.
34 Getting Started Chapter 1
Table 1-3. Digitizer Conf igu ration using M E ASure? and CONFigur e
Parameter Command Setting
Reference
Oscillator Sourc e
Input Port SENSe<
Measurement
range
Input Impedance INPut<
10 MHz Input
Filter
Input State INPut<
Arm Source ARM:STARt:SOURce<
Arm Count ARM:STARt:COUNt 1 Arm Delay ARM:STARt:DELay 0
Trigger Source TRIGger:STARt:SOURce <
Pre-arm Readings SENSe<
Trigger Count TRIGger:STARt: CO UNt <
SENSe<
SENSe<
INPut<
SENSe<
chan
>:ROSCillator:SOURce
<
source
>
chan
>:FUNCtion "<
<
port
>"
chan
>:VOLTage:DC:RANGe
<
range
>
port
>:IMPedance <
port
>:FILTer:LPASs:STAT e <
port
>:STATe <
n
chan
>:SWEep:OFFSet:POINts
<
count
>
chan
>:SWEep:POINts <
function
impedance
mode
> ON (for all ports)
> <
source
source
number
number
INTernal (the digitizer’s internal 20 MHz oscillator)
>
"VOLT <port>" (where < (@<
input port
set according t o the < MEASure? or CONFigure
>
50
(when <
mode
>ON
> IM Mediate (for n = 1)
HOLD (for
>TIMer1
0
<
>
number
CONFigu r e
>
>) parameter of MEASure? or CONFigur e)
port
n
= 2)
> is set to the (<
port
expected valu e
> is 1 or 2)
size
> is set by the
> parameter of
>) parameter of MEASure? or
Sample Rat e
(single)
Sample Rat e
(dual)
Output State OUTPut:ECLTr g<
Output Feed OUTPut:ECLTr g<
VME Bus Mode VINStrument :CO NFi gur e: VME:MO D E
VME Bus Feed VINStrument:CONFigur e: V ME:FEED
Local Bus Mode
(HP E1429B only)
Local Bus Feed
(HP E1429B only)
Reading Format FORMat[:DATA] <
Data label DIAGnostic:CHANnel[<chan >]:LA B el
TRIGger:STARt :TI Mer1 <
TRIGger:STARt :TI Mer2 <
n
OUTPut:TTLTrg<
OUTPut:EXTernal1:STATe <
OUTPut:TTLTrg<
OUTPut:EXT ern al1:FEED <
VINStrument:CO NFigu r e:LBUS:MOD E
VINStrument :CO NFi gur e: LBUS: FEED
>:STATe <
n
>:STATe <
n
>:FEED <
n
>:FEED <
<
mode
<source >
<
mode
<
source
type
<
label
period
period
mode
mode
mode
source
source
source
>
>
>
>[,<
length
>
> 50 ns
> 100 ns
OFF
>
OFF
>
OFF
>
>
"TRIGger:STARt" (ECL Trg 0) "EXTernal1" (ECLTrg1)
>
"ARM:STARt"
>
"TRIGger:STARt" OFF
"MEMory:BOTH32"
OFF
"MEMory:BOTH"
>] ASCii, 9
0 (channel 1) 0 (channel 2)
Chapter 1 Getting Started 35
Programmin g
Sequence
The recommended sequen ce f or programmi ng the digitiz er is shown in Figure 1-5. Note that CONFigure sets many digitizer parameter values that usually do not have to be changed with "l ower- level" subsystem commands. The lower-lev el commands are used when you want to set a value different from the value set by CONFigure.
MEASure command
CONFigure
command
INPut subsystem commands
SENSe
subsystem commands
ARM and TRIGger
subsystem commands
OUTPut subsystem commands
VINStrum e nt
subsystem commands
FORMat
subsystem
commands
INITiate a nd
FETCh or READ
subsystems
Figure 1-5. HP E1429A Programming Sequence
36 Getting Started Chapter 1
Configuring the
Chann e ls
Digitizer channels 1 and 2 share the digitizer’s arming and triggering circuitry and memory. Thus, the arming and triggering configuration and the number of readings set for one channel applies to the other channel as well. When the digitizer is armed and triggered, both channels sample and store their readings in memory simultaneously.
How to Make
Measurements
This section explains when to use MEASure or CONFigure to configure the digitizer. It also shows you how to make measurements when the configurat i on has been modified with lower-level commands.
Using MEASure MEASure is used in applications where the digitizer parameters set by the
command are acceptable, and the data is to be retrieved immediately after the readings are taken. MEASure is equivalent to executing the command sequence:
ABORt;:CONFigure;:INITiate:IMMediate;:FETCh?
The following programs execute the MEASure command as shown below:
MEAS1:ARR:V OLT ? (10), 5,(@ 3)
MEASure configures the digitizer as follows:
channel: 1 number of read ings:10 expect ed value: 5V input p ort : 3
The remainder of the digitizer parameters are set as indicated in Table 1-3. Becaus e the readings are taken immedia tely, variatio ns to the digitizer configuration are limited to the parameters within the MEASure command (number of readings, expected value, resolution, input port).
HP BASIC
10 DIM Readings(1:10) 20 OUTPUT 70905;"*RST;*CLS;*OP C?" 30 ENTER 70905;Ready
40 OUTPUT 70905;"ME AS1:ARR:VO LT? (10), 5,(@ 3)"
50 ENTER 70905;Readings(*) 60 PRINT Reading s(*) 70 END
Chapter 1 Getting Started 37
MEAS.C
/* MEAS.C - This program demonstrate s ho w to take readings using the */ /* digitizer’s MEASure command. In this program, MEASur e conf igures the */ /* digitizer to take 10 readings on the 5V range, using the differential */ /* input port. */
/* Include the following header files */
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <malloc.h> #include <cfunc.h> /* This file is from the HP-IB Command Library Disk */
#define ADDR 70905L /* I/O path from PC to the digitizer, via the E1406 */
/* Function Prot oty p e s */
void rst_cl r(v oi d); void ad_mea s(voi d); void check_error(char *f unc_t ion);
/****************************************************************************/ void main(voi d) /* run the program */ {
rst_clr() ; /* reset the digiti zer */ ad_mea s(); /* function which conf i gures the digitizer and make s */
/* the measurement */
}
/****************************************************************************/ void ad_mea s(voi d) {
int i = 0, readings = 10; float *rdgs;
/* dynamical ly alloc ate mem ory for readi n g s */
rdgs = malloc(10 * sizeof(float));
Continued on Next Page
38 Getting Started Chapter 1
/* Use the MEASure command to conf i gure the digi tizer and to take */ /* the readings */
IOOUTPUTS(ADDR, "MEAS1:ARR:VOLT? (10),5,(@3)", 27);
/* Send (27) characters */
IOENTERA(ADDR, rdgs, &readings);
/* Read readings from MEASure command */
for (i = 0; i < reading s; i++)
{
printf("\nReading %d = %f", i, *rdgs++);
}
free (rdgs - readings);
}
/****************************************************************************/ void rst_clr(void) {
/* Reset and clear the A/D */
IOOUTPUTS(ADDR, "*RST;*CLS", 9); /* Send (9) characters */
}
Using CON Figur e When an application requires a configuration different from that available
with MEASur e, CONF igur e is used. CONFigure does not take readings after setting the configuration. Thus, any of the low-level commands (Table 1-3) can be used to change selected parameters before a measurement is made.
Assume an application requires the following configuration:
10 pre-arm and 10 post arm readings
1V range
single ended input
MEASure cannot be used since it sets the pre-arm reading count to 0. By using CONFigure, the low-level command:
SENSe[<
can be used to set the desired number of pre-arm readings:
chan
>]:SWEep:OFFSet:POINts <
count
>
Chapter 1 Getting Started 39
CONF1:ARR: VOLT (20), 1,( @1)
SENS1:SWE:OFFS: POIN -10
Taking Readings After
Using CONFigure
To take r eadings, the dig i tizer must b e triggered. Th e MEASure comm a n d automatically triggers the digitizer after setting the configuration.
When CONFigu re is used, the digitizer mus t be triggered using the READ? command or INIT ia te[:IMMedia te] and FETCh[<chan >]? commands as shown.
CONF1:ARR: VOLT (20), 1,( @1)
SENS1:SWE:OFFS: POIN -10
READ? (readings are sent to the digitizer output buffer from memory)
or
CONF1:ARR: VOLT (20), 1,( @1)
SENS1:SWE:OFFS: POIN -10
INIT:IM M (readings are stored in memory) FETC?(readings are retriev ed from memory)
READ? is equivalent to executing ABORt +INITiate:IMMediate +FETCh?. ABORt stops any measurement or VME or Local bus transfer b efor e proceeding with INITiate. With READ?, the readings pass directly through digitizer memory to the devic e’s output buffer.
HP BASIC
INITiate places the digitizer in the wait-for-arm state. FETC? waits f or the readings to complete and then retrieves (fetches) the readings from memory and plac es them into the output bu ffer.
10 DIM Readings(1:20) 20 OUTPUT 70905;"*RST;*CLS;*OP C?" 30 ENTER 70905;Ready
40 OUTPUT 70905;"CONF1 : ARR:VOLT (20),1, (@ 1)" 50 OUTPUT 70905;" SENS1:SWE:OFFS:POIN -10" 60 OUTPUT 70905;"READ?"
70 ENTER 70905;Readings(*) 80 PRINT Reading s(*) 90 END
40 Getting Started Chapter 1
CONF.C
/* CONF.C - This program demo n strates how to use the CONFigure command and */ /* low-level digitizer commands to configure the digitizer. INITial ize and */ /* FETCh? are used to trigger the digitizer and retrieve the readings from */ /* digitizer me mory. */
/* Include the following header files */
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <malloc.h> #include <cfunc.h> /* This file is from the HP-IB Command Library Disk */
#define ADDR 70905L /* I/O path from the PC to the digitizer */
/* Function Prot oty p e s */
void rst_cl r(v oi d); void ad_conf(voi d); void ad_fet ch(void); void check_error(char *f unc_t ion);
/****************************************************************************/ void main(voi d) /* run the program */ {
rst_clr() ; /* reset the digiti zer */ ad_conf(); /* send commands which configure the digi tizer */ ad_fetch(); /* send command which retrieves the digitizer reading s */
}
/****************************************************************************/ void ad_conf(void ) {
int length = 0, loop = 0;
/* use the "set_commands" array to configure digitizer channel 1 */
char static *set_commands[] = {"CONF1:ARR: VOLT (20) ,1, (@1)", /* set 20 readin g s, 1V range, */
/* S/E input port 1 */
"SENS1:SWE:OFFS:POIN -10", /* set 10 pre-arm readings */
"INIT"}; /* place digitizer in */
/* wait-for-arm state */
Continued on Next Page
Chapter 1 Getting Started 41
length = (sizeof(set_commands) / sizeof(char*));
/* Execute each command using a loop */
for (loop = 0; loop < length; loop++)
{ IOOUTPUTS (ADDR, set_commands[loop], strlen(set_commands[loop])); }
/* function call to check for di gitizer configuration errors */
check_error("ad_conf");
}
/****************************************************************************/ void ad_fet ch(void) {
char go; int i = 0, readings = 20; float *rdgs;
/* dynamical ly alloc ate mem ory for readi n g s */
rdgs = malloc(20 * sizeof(float));
/* fetch (retrieve) and print readings */
IOOUTPUTS(ADDR, "FETC1?", 6);
IOENTERA(ADDR, rdgs, &readings);
for (i = 0; i < reading s; i++) {
printf("\nReading %d = %f", i, *rdgs++);
}
free(rdgs - readings);
}
/****************************************************************************/ void rst_clr(void) {
/* Reset and clear the digitizer */
Continued on Next Page
42 Getting Started Chapter 1
IOOUTPUTS(ADDR, "*RST;*CLS", 9);
}
/****************************************************************************/ void check_error(char *f unc_t ion) {
char into[161]; intlength = 160;
IOOUTPUTS (ADDR, "SYST:ERR?", 9); /* Query error register */ IOENTERS(ADDR, into, &length); /* Enter error message */
if (atoi(into) != 0) /* Determine if error is pre sent */
/* If errors present, print and exit */
{
while (atoi(into) != 0) {
printf("Error %s in function %s\n\n", into, func _ti on); IOOUTPUTS(ADDR, "SYST:ERR?", 9); IOENTERS(ADDR, into, &length);
}
exit(1);
}
}
Querying
Command Set tings
As you configure the digitizer it is often useful to determine command settings programmatically. This can be done by adding a question mark (?) at the end of any SCPI command header (except the MEASure command), and then send ing t he command without parameters. The following progra ms query the parameters of the CONFigure command. Assuming the CONFigur e c omma nd w a s ex ecut ed as indicated in progra m C ONF.C, the following query response is returned:
"ARR (20),1.000000,0.000500,(@ 1)"
where:
(20) = reading count (size parameter)
1.000000 = expected value
0.000500 = reading resolution (@1) = input port
Chapter 1 Getting Started 43
HP BASIC
QUERY.C
10 DIM Setting$[1000]
20 OUTPUT 70905;"CONF? " !query CONFigure co mmand
30 ENTER 70905;Setting$ 40 PRINT Settin g $ 50 END
/* This program queri es HP E1429 settings */
/* Include the necessary header files */
#include <stdio.h> #include <string.h> #include <cfunc.h> /* from HP-IB command library */
/* Define E1429 HP-IB address macro */
#define ADDR 70905L /* I/O path between the PC and the digitizer */
/* Function prototypes */
void query(void);
void main(voi d) {
query(); /* function call to query HP E1429 paramete r s */
}
/****************************************************************************/ void query(void) {
char *gets(); char qry_cmd[80] ; /* query command array */ char qry_resp[80]; /* query response array */ int length = 80;
/* Query user for digitizer query command */
printf("\nEnter query c om mand: ");
gets(qry_cmd); /* get input string (query command) */
Continued on Next Page
44 Getting Started Chapter 1
IOOUTPUTS(ADDR, qry_cmd, strlen(qry_cmd));
IOENTERS(ADDR, qry_resp, &length);
printf("\n % s = %s", qry_cm d, qry_resp);
}
Checking for Errors The followi ng HP BASIC program show s the lines an d subp r ogram which
can be added to HP BASIC programs to check for errors. Line 140 clears the digitiz er standa r d event status register. Lines 150 and 160 unmask the appropr iate bits in the digitizer’s status byte register and standard event status register.
When an error occurs, th e subpr ogr a m "Errmsg" reads the digitizer error queue and displays the code and message. Note that line 310 is used as an "end of statement" should a syntax error occur among coupled commands. Otherwise, line 320 would serve as the end of statement and the ABORT command would be ignored by the digitizer parser.
HP BASIC
Note An alternative HP BASIC erro r checking progra m can be found in t he
"C-Size VXIbus Systems Installation and Getting Started Guide".
1 !This program represents one method that can be used to 2 !check for program ming errors in HP BASIC programs. 3! 10 !Assign I/O path between the computer and HP E1429A/B. 20 ASSIGN @A_d TO 70905 30 COM @A_d 40 !Define branc h to be taken when an HP E1429A/B error occurs. 50 !Enable HP-IB interf ace to generate an int errupt when an error 60 !occurs. 70 ON INTR 7 CALL Errmsg 80 ENABLE INTR 7;2 90 !Clear all bits in the standard event status register, unmask the 100 !standard event st atus group summary bit in the HP E1429A/B status byte 110 !register (decimal weight 32), unma sk the query error, device 120 !dependent error, execution error, and command error bits 130 !(decimal sum 60) in the HP E1429A/B standard event status register.
Continued on Next Page
Chapter 1 Getting Started 45
140 OUTPUT @A_d;"*CLS" 150 OUTPUT @A_d;"*SRE 32" 160 OUTPUT @A_d;"*ESE 60" 170 ! 180 !Subprogram calls would be here 190 ! 200 WAIT .1 !allo w error branch to occur bef ore turni ng intr off 210 OFF INTR 7 220 END 230 ! 240 SUB Errmsg 250 Errmsg: ! Subprogr am whi ch display s HP E1429 programming erro r s 260 COM @A_d 270 DIM Message$[256] 280 !Read digitizer status byte register and clear service request bit 290 B =SPOLL(@A_d) 300 !End of statement if error occurs among coupl ed com mands 310 OUTPUT @A _d;"" 320 OUTPUT @A_d;"A BORT" !abort digitizer act ivity 330 REPEAT 340 OUTPUT @A_d;"S YST:E RR?" !read digitizer error queue 350 E NTER @A_d;Code,Message$ 360 PRINT Code,Message$ 370 UNTIL Code=0 380 STOP 390 SUBEND
ERRORCHK.C
/* ERRORCHK.C - This program cont ains the C function used by the example */ /* programs to check for digiti zer conf igur ation errors. When an error */ /* occurs, the function reads the digitizer ’ s error buffer and prints the */ /* error messages until all of the errors have been read. */
/* Include the following header files */
#include <stdio.h> #include <cfunc.h> /* This file is from the HP-IB Command Librar y Disk */
#define ADDR 70905L /* I/O path from PC to the digitizer, via the HP E1406 */
/* Function Prot oty pe */
void check_error(void);
Continued on Next Page
46 Getting Started Chapter 1
/****************************************************************************/ void main(voi d) { check_error(); /* call error check func tion */ }
/****************************************************************************/ void check_error(void) { char into[161]; int length = 160;
IOOUTPUT S(ADDR, "SYST : ERR?", 9); /* Query error register */ IOENTERS(ADDR, into, &length) ; /* Enter error message */
if (atoi(into) != 0) /* Determine if error is pre sent */
/* If errors present, print and exit */
{
while (atoi(into) != 0) {
printf("%s\n\n", i nto) ; IOOUTPUTS(ADDR, "SYST:ERR?", 9); IOENTERS(ADDR, into, &length);
}
exit(1); } }
Digitizer/
Command Module
Deadlock
If the digitizer’s access light remains on while programming the digitizer over HP-IB, it may be due to a deadlock between the digitizer and the HP E1406 Command Module. If such a deadlock occurs and you cannot access th e Command Module, send the f ollowing command sequen ce:
ABORT 7 ABORT 7 CLEAR 70905
(selected device clear)
Chapter 1 Getting Started 47
Where to go Next
For additional prog amming examples:
Chapter 2: Using the Digitizer
For the digitizer description of operation:
Chapter 3: Understanding the Digitizer
For information on the digitizer command set:
Chapter 4: Command Reference
For the digitizer operating specifications:
Ap pendix A: Speci fications
For a listing of the digitizer error messa ge s :
Appendix B: Useful Tables
For register programming information:
Appendix C: Register Programming
48 Getting Started Chapter 1
Chapter Contents
Chapter 2
Using the Digitizer
This chapter contains example programs that show you how to use the digitizer. The programs, which d emonstrate th e various features of the digitizer, are presented in the same sequence as the features are covered in Chapter 3 - "Understanding the Digitizer". The examples in this chapter include:
Configuring the Digitizer Input . . . . . . . . . . . . . . . . . . . . . . . 50
Taki ng a B urst of Rea dings. . . . . . . . . . . . . . . . . . . . . . . . . . 5 1
L evel A rming. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
Pre- and Post-Arm Readings . . . . . . . . . . . . . . . . . . . . . . . . . 53
Specif ying a Sample Rate . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
Dual Rate Sampling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Using Multiple Digitizers . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
Using the Pa cked Data Format . . . . . . . . . . . . . . . . . . . . . . . 59
VME Bus Data Transfers. . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
VME_REAL.C. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
VME_•SEG1.C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
VME Bus Data Transfers Using an Embedded
Controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
SEGTST16.CPP. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
SEGTST32.CPP. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
Local Bus Data Transfers. . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
LOCAL_AD.C. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
LBUS2PST.C. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
LBUSAUTO.C. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
Using the Digitizer Status Registers . . . . . . . . . . . . . . . . . . . 101
Using the Programs Each examp le progra m lis ted in this chapter (and on the example pr o gra ms
disk) begins with the CONFigure command, and then uses lower-level digitizer commands (Chapt er 1, Table 1-3) to customize the configuration. Us ing this format, the progr ams can easily be mo dified t o match your application.
The Programming
Language
Chapter 2 Using the Digitizer 49
Each example in this chap ter lists only the digitizer’s SCPI commands, wit h the exception of the VME and Local bus data transfer programs. The I/O (input/output ) constructs of the programm ing la ngu age you use need to b e added to the programs. Note that the example programs disk (HP P/N E1429-10302) c ontains copies of the programs compiled and tested using Borland Turbo C++ © Version 1.0 and Microsoft® QuickC© Version 2.0. The program name is shown prior to the program listing in the chapter.
Configuring the Digitizer Input
This progra m demonstr a tes the commands used to c on fi gure the d igitizer’s input section. The program sets up the digitizer to take 10 readings on the 1V range of the digitizer’s single ended input port. This includes:
enabling/disabling the input ports
setting the input impedance
switching the 10 MHz filter into the signal path.
setting the signal range
INPUT.C
*RST;*CLS /* reset and clear the digitizer */ CONF1:ARR:VO LT (10),(@ 1) /* set 10 readings on channel 1, input port 1 */
INP3:STAT OFF /* disable dif fer enti al port 3 */ INP1:IMP 50 /* set input impedance to 50 ohms */ INP1:FILT ON /* switch 10 MHz filter into signal path */
SENS1:VOLT:RANG 1 /* set 1V range */ READ? /* initialize digitiz er, fet ch readi ng s */ /* retrieve the readi n gs from the digi ti zer */
Comments 1. Digitizer INPut Commands. The CONFigure command sets most of the
(INPut) subs ystem param eters to the sa me values as set by the INP commands listed in the program. The INPut commands were executed to show the context in which they are used.
2. Disabling an Input Port. When taking readings, it is not necessary to disable the channel’s input port that is not being used (INP3:STAT OFF). It was done in this program to show the versatility of the digitiz er.
3. Digitizer Measurement Range. In this program, the measurement range is specified w ith the SENSe:VOLTage:R ANGe command, rather than with the expected value paramet er of th e CONFigure command. For m ost applications, however, it is easier to specify an expected value. SENSe:VOLT a ge :RANGe can be used to change the signal range without changing the entire digitizer configuration with CONFigure.
50 Using the Digitizer Chapter 2
Taking a Burst of Readings
This program demonstrates:
how to set t he arm count for multiple b ursts of (p ost -a r m) readings
how to set the arm sour ce to VXI bac kp la n e trigger line ECLTRG0
and use the HP E1406 Command Module to apply arming pulses to the trigger line.
ARMCNT.C
/* digitizer commands */ *RST;*CLS /* reset and clear the digitizer */ CONF1:ARR:VO LT (10), 1,(@1) /* set 10 readin gs, 1V range, S/E input */
ARM:SOUR1 ECLT0 /* arm source is ECLTRG0 trigger line */
ARM:COUN 3 /* set arm count for 3 bursts */ OUTP:ECLT0: ST AT ON /* enable line ECLTRG0 - Command Module */ INIT /* place digitizer i n wait -for-arm state */ /* send arming pulse - Command Mo dule comman ds */ OUTP:ECLT0: IM M /* apply a pulse to ECLTRG0 */ /* ask for next pulse */ OUTP:ECLT0: IM M /* apply a 2nd pulse to ECLTRG0 */ /* ask for next pulse */ OUTP:ECLT0: IM M /* apply a 3rd pulse to ECLTRG0 */ /* digitizer command */ FETC1? /* retri eve digi ti zer readi ng s */
/* port 1*/
Comments 1. Arm and Trigger Counts. The arm count is the number of reading
bursts or arm s i gnals the digitizer is to accept before the digitizer returns to the idle sta te. When the digitizer receives an arm, it takes a reading each time a trigger is received, and continu es to tak e readings until the trigger count is reached. Notice the CONFigure command specifie s (10) readings (trigger count = 10). Therefore, with an arm count of three, 30 read ings are taken bef ore the digitizer returns to the idle state.
2. Additional Information. Digitizer armin g an d triggering is covered in Chapter 3 - "Understanding the Digitizer".
Chapter 2 Using the Digitizer 51
Level Arming
ARMLEVEL.C
This program demonstrates:
how to set the arm source such that the digitizer is armed when the
input signal enters a specified voltage range (window) from a level outside the range.
how to set the arm slope such that an arm occurs when the input
signal enters the arm window from either a positive-going or negativ e-going dir ection.
how to set the voltage levels which define the arm window.
For this examp le, the arm signal should be applied to the HI input of port 3, with the LO input of port 3 grounded.
*RST;*CLS /* reset and clear the digitizer */ CONF1:ARR:VO LT (10),10,( @3) /* set 10 readings on Diff port 3 */
ARM:SOUR1 INT 1 /* set arm source 1 to level arming */
ARM:SOUR2 HOLD /* disable arm source 2 */
ARM:SLOP1 EITH /* arm when signal enters window from */
/* either direction */ ARM:LEV1:PO S 4 /* set arm window lower boundary */ ARM:LEV1:NEG 6 /* set arm window upper boundary */ ARM:COUN 2 /* set two measurement bursts */
INIT /* put digitizer in wait-for-arm state */ FETCH? /* retrieve readin gs after arms occur */
Comments 1. The Arm Window. The arming window set by this program is +4V to
+6V on the digitizer’s 10V range. The upper boundary of the window (6V) is set with the ARM:LEVel1:NEGative command. This means when a NEGative- goi ng inp ut s ignal reaches 6V, the digitizer is armed. Simila r ly, the lower boundary (4V) of the window is set with the ARM:LEVel1:POSitive command. Thus, when a POSitive-going input signal reaches 4V, the digitizer is armed. Because the NEGative-going level is greater than the POSitive-going level, the digitizer is armed each time (up to the arm count) the signal enters the window.
2. Additional Information. Level arm ing is c overed in detail in Chapter 3, in the section "Arming and Triggering".
52 Using the Digitizer Chapter 2
Pre- and Post-Arm Readings
This program demonstrates:
how to program the digitizer to take a minimum of 100 pre -ar m
readings and 100 post-arm readings.
how to set the arm sourc e to an external signal applied to the "Ext 1"
BNC.
PREPOST.C
*RST;*CLS /* reset and clear the digitizer */ CONF1:ARR: VOLT (200), 2,( @3) /* set 200 readin gs total, 2V range, */
ARM:SOUR1 EXT /* arm source is front panel "Ext 1" BNC */ SENS1:SWE:OFFS: POIN -100 /* set 100 pre-arm readings */
INIT /* put digitizer in wait-for-arm state */ FETCH? /* retrieve pre- and po st-arm readings */
/* Diff input port 3*/
Comments 1. Pre-arm and Post-arm Reading Count. When measurements consist of
pre- and post-ar m readings, there must be at least three pre-arm rea dings and s eve n post-arm readings specified . Note that pre-arm readings are preceded by a minus (-) sign.
2. Total Reading Count. The size parameter of the CONFigure command specif ies t he tota l nu mber of r eadings (pre- and p ost-arm). SENS1:SWE :OFFS :POIN s pec ifies the number of pre-arm readings. The number of post-arm readings in this program is the n (2 00) - 10 0 = 100. The total reading cou nt can b e changed without re-s ending the CONFigure command by using the TRIGger:STARt:COUNt command o r SENSe:SWEep:POINts command.
3. Pre-arm Readings. Pre-arm readings start when the digitizer receives the INITiate[:IMMediate] command. Pre-arm readings continue until an arm is received. Arms are ignored until the pre-arm reading count is reached. If the pre-arm count is exceeded bef ore the arm occurs, t he last SENSe:SWEep:OFFSet:POINts number of rea d ings taken are stored in memory.
Chapter 2 Using the Digitizer 53
Specifying a Sample Rate
This program demonstrates:
how to set the digitizer trigger (sa mple) s ource
how to set the sample rate
In t hi s examp le, a 1 k H z square wa v e i s sampled a t a r ate which includes the 11t h h armonic. All samp les are post-arm.
SAMPLE.C
*RST;*CLS /* reset and clear the digitizer */ CONF1:ARR:VO LT (50),10,( @3) /* set 50 readings, 10V range */
ARM:SOUR1 IMM /* arm when put in wait-for-arm state */ TRIG:SOUR TIM /* set trigger source to timer 1 */ TRIG:TIM1 20E- 6 /* set sample period to 20 us */
READ? /* put digitizer in wait-for-arm state */
/* and retrieve the readings */
Comments 1. Samp le Per io d and Sample Co unt. The period at which to sample a 1
kHz signal and include t he 11t h harmonic is determined by:
period = 1 / 4(f
where f
is the frequency of the 11th harmonic (11 kHz). B ecaus e of the
c
trigg er sour ce used in this program (T I Mer), the sample p eriods available are 1, 2, 4, through 1E8, 2E8, 4E8 multiples of the reference clock (the internal 20 MHz oscillator set by the CONFigure command). Therefore, given the 22.7
µs.
20
The number of samples t o take is compu ted by:
sample cou nt = signal period (fundame ntal)/actual sample period
) = 1 / 4(11 kHz) = 22.7 µs
c
µs sample period calculated, the actual sample period used is
= .001/.000020 = 50
54 Using the Digitizer Chapter 2
2. Specifying the Sample Count. The sample count (i.e. trigger count) is specified by the size parameter (50) of the CONFigure command. This is the most convenient way to specify the sample count since siz e is a required paramet er of CONFigur e. TRIGger:STARt:COUNt can be used to set/change the sample count without also changing the entire configuration with CONFigure.
3. Additional Information. Additional information on trigger sources and sample rates is found in Chapter 3 - "Understanding the Digitizer", and in Chapter 4 - "Command Referenc e".
Dual Rate Sampling
This program demonstrates:
The digitizer pre-arm samples at 50 ns until the level of the input signal on chann e l 1 reaches 5V. At 5V, the digitizer is a rmed and post-arm sample s at 10 ms.
how to set up the digitizer’s dual rate sampling function whereby
pre-arm and post-arm readin gs are taken at dif f erent sample rates.
how level arming can be used with dual rate sampling
DUALSAMP.C
*RST;*CLS /* clear and reset the digitizer */ CONF1:ARR:VO LT (20),10,( @3) /* set 20 readings, 10V range */
ARM:SOUR1 INT 1 /* set arm source 1 for level arming */ ARM:SOUR2 HOLD /* disable arm source 2 */ ARM:SLOP1 PO S /* arm on increasing input signal */ ARM:LEV1:POS 5 /* arm at 5V (10V range) */ SENS:SWE:OFFS: POIN -10 /* set 10 pre-arm readings */ TRIG:SOUR DTIM /* set dual rate sampling */ TRIG:TIM1 50E-9 /* set sample rate for pre-arm readin g s */ TRIG:TIM2 10E-3 /* set sample rate for p ost-arm readi n gs */
INIT /* put digitizer in wait-for-arm state */ FETCH? /* retrieve readin gs */
Comments 1. Dual Rate Sampling Periods. Th e dual rate sampling trigger source
DTIMer uses the internal timer sources. Thus, on e sample period must equal the reference period. In this program, the digitizer’s internal 20 MHz oscillator is the reference source. Therefore, on e sample rate must be 50 ns (1 / 20 MHz).
Chapter 2 Using the Digitizer 55
2. Pre- and Post-Arm Sample Rates. With dual rate sampling, pre-arm and pos t-ar m readings occur at dif f er ent sa mp le rat es . It is re commended that pre-arm readings use the faster of the two sample rates. The reason is once the arm is received, one addtional sample at the pre-arm rate must occur before the post-arm ra te is used.
3. Dual Rate Sampling Reference Sources. The reference sources available with trigger source DTIMer are:
INTernal - the digitiz er’s in t ernal 20 MHz oscillator (defa u lt source) CLK10 - the VXIbus system’s 10 MHz clock ECLTrg0 - the VX I ba c kpla ne ECLT r g0 tr igger line ECLTrg1 - the VX I ba c kpla ne ECLT r g1 tr igger line EXTernal2 - the digitizer’s front panel "Ext 2" BNC port
When using any of these references, one of the two sample rates must be set to the reference period. Also, the reference used must be specifi ed wit h the SENSe:ROSCillator:SO URce command, and i f t he source is ECLTrg0/1 or EXTernal2, the frequency of the reference must be specified with the SENSe:ROS C i llat or:EXTernal:FREQuency comma nd .
4. Ot her Dual Rate Sampling Sources. When the dual rate sampling sourc e is DECLtrg, ECLT rg0 pa ces t h e pre-arm readings a nd ECLTr g1 paces the post-arm readings. The sa mple rates are det ermined e ntirely by the source(s) driving the trigger lines. When the dual rate sampling source is DEXTernal, front panel port "Ext 1" paces th e pre-arm readings an d port "Ext 2" pac es the post -arm re a dings . The samp le rat es are det ermined entirely by the source(s) driving the ports.
5. Additional Information. More information on dual rate sampling is found in Chapter 3 - "Understanding th e Digitizer".
Using Multiple Digitizers
This program demonstrates:
how to route the int ernal reference clock from one d igitizer to a
second digitizer, and how to configure the digitizers such that they are armed simultaneou s ly.
56 Using the Digitizer Chapter 2
MULT_AD.C
/* digitizer 1 */ CONF1:ARR:VO LT (10),1,( @1) /* set 10 readin g s, 1V range, on */
/* channel 1, S/E input port 1 */
SENS:ROSC:SOUR INT /* reference source is internal */
/* 20 MHz oscillator */
OUTP:ECLT0:FEE D ’SENS:ROSC’ /* route reference oscillator */
/* clock signal to ECLT0 */ OUTP:ECLT0:STA T ON /* enable routing of the signal */ ARM:SOUR1 TTLT0 /* arm source is TTLT0 trigger line */ TRIG:SOUR TIM /* trigger source is period derived */
/* from the T RI G: T IM com m and */ TRIG:TIM1 20E- 6 /* set sample period to 20 us */ SENS2:FUNC ’VOLT4 ’ /* set up input port 4 on channel 2 */ SENS2:VOLT:RANG 5 /* set voltage range on channel 2 */
/* the arm and trigger sources are */
/* the same as for channel 1 */
/* digitizer 2 */
CONF1:ARR:VO LT (10),1,( @1) /* set 10 readin g s, 1V range, on */
SENS:ROSC:SOUR ECLT 0 /* reference oscillator source is */
SENS:ROSC:EXT:FREQ 20E6 /* specify frequency of clock signal */ ARM:SOUR1 TTLT0 /* arm source is TTLT0 trigger line */ TRIG:SOUR TIM /* trigger source is period derived */
TRIG:TIM1 20E- 6 /* set sample period to 20 us */ SENS2:FUNC ’VOLT4 ’ /* set up input port 4 on channel 2 */ SENS2:VOLT:RANG 5 /* set voltage range on channel 2 */
Continued on Next Page
/* channel 1, S/E input port 1 */
/* ECLT0 trigger line */
/* from the T RI G: T IM com m and */
/* the arm and trigger sources are */
/* the same as for channel 1 */
Chapter 2 Using the Digitizer 57
/* digitizer commands */ INIT /* put digitizer 1 in wait-fo r -arm state */ INIT /* put digitizer2 in wait-for-arm state */
/* Command Module comm ands */ OUTP:TTLT0: STAT ON /* enable line TTLT 0 */ "Press Enter (return) to arm the digitiz e rs"
OUTP:TTLT0: IM M /* apply a pulse to TTLT0 */
/* digitizer commands */ FETC1? /* retrieve readings from digitizer1, channel 1 */ FETC2? /* retrieve readings from digitizer1, channel 2 */ FETC1? /* retrieve readings from digitizer2, channel 1 */ FETC2? /* retrieve readings from digitizer2, channel 2 */
Comments 1. Synchronizing Digitizers. By routing (OUTPut) the reference clock
from one digitizer to all digitizers in the system, the sample rate is derived from the same reference. Digitizer samples can then be taken at precise intervals of each other.
2. Input Channels. In this program, sample s are ta ke n on the single ended and differential inpu ts of two dig itizers, for a total of four chann els. Wh en sampling, either the channel’s s ingle ended input or the differenti al inputs can be used. You cannot use both sets of inputs simultaneously on a single channel.
3. CONFiguring Channels Independently. In this program, the digitizers’ single ended input ports (channel 1) and differential input ports (channel 2) are set to two different signal ranges. This was done using SENSe:FUNC t ion to select the port a nd SENSe:VOLTage [:DC]:RANGe to set the range. CONFigure was not used since executing CONF2:ARR: VOLT (10),5,(@3) would not only set the range on channel 2, but would a lso change the settings made following the first CONFigure (CONF1) command.
4. Routing/Sourcing Signals. If a digitizer trigger port (e.g. "Ext 1", "Ext 2") or a VXI bac kplane tr igger line (ECLTrg<n >, TTLTrg<n >) is the source of a reference signal, arm si gnal or trigger s ignal, t hen that port or line cannot be used to route (OUTPut) a sync hronizat ion sig nal.
5. Retrieving Readings. When readings are retrieved from digitizer memory using the FETCh? command, each channel’s readings mus t be retrieved separately. That is, channel 1’s readings must be fetch ed and then channel 2’s mu st be fetched, or vice versa. However, VME bus data transfers (retrievals) allow both channels’ readings to be retrieved simultaneously. The "VME Bus Data Transfers" examples in this chapter show how this is done.
58 Using the Digitizer Chapter 2
6. Additional Information. Additional information on using arming, triggering, and ref erence signals to sync hronize other digitizers can be found in Chapter 3 - " Understa nding the Digitizer". Addit iona l information on the CONFigure command can be found in Chapter 1 - "Getting Started".
Using the Packed Data Format
This program demonstrates:
how to spec ify the digitize r’s p acked data format
how to remove the ANSI/IEEE Standard 488.2-1987 Definite L ength
Arbitrary Block header which preceeds the data
how to assign a label to identify a set of readings
how to convert the readings to volta ges
The program takes 20 post-ar m samples which are returned in the digitizer’s packed data format. For completeness, the entire C language version of the program is list ed. (The pr o gram is also contained on the example programs disk - HP E1429-10302).
PACKED.C
/* PACKED.C - This program takes 20 post-arm samples and returns the readings */ /* in the digitizer’s packed data format . A label identifying the reading s */ /* is assigned to the four least significant bits. The arbitrary block header */ /* preceding the reading s is removed and the packed data is coverted to the */ /* measured voltages. The program features the FORMat and READ? commands. */
/* Include the following header files */
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <malloc.h> #include <cfunc.h> /* This file is from the HP-IB Command Library Disk */
#define ADDR 70905L /* I/O path from PC to the digitizer, via the HP E1406 */
Continued on Next Page
Chapter 2 Using the Digitizer 59
/* Function Prot oty p e s */
void rst_cl r(v oi d); void ad_confr ead(void); void check_error(char *f unc_t ion);
/****************************************************************************/ void main(voi d) /* run the program */ { rst_clr( ); /* reset the digitizer */ ad_confread(); /* function which confi gures the digitizer */
/* and takes the reading s */
}
/****************************************************************************/ void ad_confr ead(void) { int length = 0, loop = 0, i = 0, swap = 0, bytes = 0, label = 0; int *rdgs; char lf_remove[1];
/* use the "set_comm ands" array to configure single ended input port */ /* 1 on digitizer channel 1 */
char static *set_com m ands[] = {"CONF1:A RR:VO LT (20),1,(@ 1)", /* set 20 readin g s, 1V range */
"FORM PACK", /* set packed reading form at * / "DIAG:CHAN:LAB 1"}; /* add label to each reading */
length = (sizeof(set_c om mands) / sizeof(char*));
/* Execute each command using a loop */
for (loop = 0; loop < length; loop++) { IOOUTPUTS(ADDR, set_com mands[l oop] , strlen(set_commands[loop])); }
/* function call to check for digitizer configuration errors */
check_error("ad_conf read");
/* dynamically allocate memory for readings */
rdgs = malloc(20 * sizeof(int) );
Continued on Next Page
60 Using the Digitizer Chapter 2
/* set number of byte s placed in memory , and number of byt es read */
swap = sizeof(i nt ); /* place 2 bytes/reading in memory */ bytes = 20 * swap; /* read 40 bytes */
IOOUTPUTS(ADDR, "READ?", 5); /* retrieve the readings */
IOENTERAB(ADDR, rd gs, &byte s, swap); /* enter the readings and */
/* remove the block header */
/* Remove line feed which trails the last data byte */
length = 1; IOENTERS(ADDR, lf_remove, &length);
/* print label */
label = (rdgs[0] & 0x000F); printf("\nLabel #: %d", label );
/* conv e r t and print each reading as a voltage */
for (i = 0; i < 20; i++) {
rdgs[i] /= 16; /* remove label from each reading */ if (rdgs[i] >= 2047 || rdgs[i] <= -2046)
printf("\nReading overrange");
else
printf("\nReading %d = %.6E", i, (rdgs[i]
}
free(rdgs); }
/****************************************************************************/ void rst_clr(void) {
/* Reset and clear the digitizer */
IOOUTPUT S(ADDR, "*RST ;*CLS" , 9); /* Send (9) characters */ }
0.0005));
*
Continued on Next Page
Chapter 2 Using the Digitizer 61
/****************************************************************************/ void check_error(char *f unc_t ion) { char into[161]; intlength = 160;
IOOUTPUT S(ADDR, "SYST: ERR?", 9); /* Query error register */ IOENTERS(ADDR, into, &length) ; /* Enter error message */
if (atoi(into) != 0) /* Determine if error is present */
/* If errors present, print and exit */
{
while (atoi(into) != 0) {
printf("Error %s in function %s\n\n", into, func _ti on); IOOUTPUTS(ADDR, "SYST:ERR?", 9); IOENTERS(ADDR, into, &length);
}
exit(1); } }
Comments 1. Packed Reading Format. Packed dig itiz er readings are s igned, 16-bit
numbers preceded by the ANSI/IEEE Standar d 488.2-1987 D efi nite L ength Arbitrary Block h eader. Pack ed readings are al ways a number b etween
-1.0230 (-2046) an d + 1. 0235 (2047), and must be converted to voltages b y the user.
2. Line Feed Following Packed Readings. Packed readings preceded by the arbitrary block header are also followed by a line feed (LF) charact er. When readings are retrieved from the digitizer, the LF remains in the output buffer. If the line feed is not removed with an additional "IOENTERS" statement, error -410 "Query INTERRUPTED" occurs the next time data is read from the digitizer.
3. Channel L a bels. A numeric lab el id entif yin g a set of readings can b e specified using the four least significant bits of each reading. The label, which is any number from 0 to 15, is assigned using the DIAGnostic:CHANnel<chan >:LABel command. The label is included with the reading bits when data is returned in the PACKed,16 format. The assigned label is ignored when the data forma t is ASCi i,9 or RE AL,64. If no label is assigned, the four least significant bits of the reading are ’0’s. See "How Readings are Stored" in Chapter 3 for more information.
62 Using the Digitizer Chapter 2
4. Packed Reading Conversion Formula. The equation for converting packed readings to voltages is:
reading
voltage
The reading resolutions, which are a function of the signal range, are listed in Chapter 3 in the section "Converting Packed Readings".
VME Bus Data Transfers
The following programs demonstrate:
how post-arm readin g s ar e tr ansferred from the digitizer’s A/D
converter directly to the VME bus (VME_REAL.C)
how segmented r ead ings (pre- and post-arm) are transferred from the
digitizer’s A/D c onverter directly to the VME bus (VME_SEG1.C )
how segmented, 32-bit readings (channel 2 and channel 1 combined)
are transferred from the A/D converter to the VME bus
The system configuration on which programs VME_REAL.C and VME_SEG1.C were developed is listed on page 1-10.
= (rea d ing
/ 16) * reading resolution
packed
VME_REAL.C
/* VME_REAL.C - This program reads data directly from the di gitizer ’ s A/D */
/* converter and place s it on the VME (VXI data transfer) bus. Each time the */ /* digitizer’s data register is accessed, a measurement is triggered and the */ /* reading is transferred to the VME bus during the same reading cyc le. */
/* Include the following header files */
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <malloc.h> #include <cfunc.h> /* This file is from the HP-IB Command Library */
#define ADDR 70905L /* I/O path between the digitizer and PC */ #define CMD_MOD 70900L /* I/O path between the digitizer and the Command Module */
Continued on Next Page
Chapter 2 Using the Digitizer 63
/* Function prototypes */
long get_base_addr(void); void rst_cl r(v oi d); void ad_conf(voi d); void mem_read(long ba se_addr); void check_error(char *f unct ion); /****************************************************************************/ void main(voi d) { long base_addr; /* variable for digitizer A24 base address */
rst_clr(); /* reset and clear the digitizer */ base_addr = get_base_addr(); /* function call to calculate and */
/* return digitizer A24 base address */ ad_conf(); /* function call to configure the di gi tizer */ mem_read(base_addr); /* function call which reads the data register */ }
/****************************************************************************/ void ad_conf(void ) { int length = 0, loop = 0;
/* use the "set_comm ands" array to configure digitizer channel 1 */
char static *set_com m ands[] = {"CONF1:A RR:VO LT (100),1,(@ 1)", /* set 100 readings, on S/E port 1 */ "TRIG:STAR:SOUR VM E", /* trigger source is reads of data register */ "VINS:CONF:VME:MODE GEN", /* enable data transfe r over the VME bus */ "VINS:CONF: VME :FEED ’CO NV:CHA N1’", /* set real time data transfer */ "INIT"}; /* place the digitizer in the wait-for-arm state */
length = (sizeof(set_c om mands) / sizeof(char*));
/* Execute each command using a loop */
for (loop = 0; loop < length; loop++) { IOOUTPUTS(ADDR, set_commands[loop], strlen(set_commands[loop])); }
/* function call to check for digitizer configuration errors */
check_error("ad_conf "); }
Continued on Next Page
64 Using the Digitizer Chapter 2
/****************************************************************************/ void mem_read(long ba se_addr) { int readings = 100, i = 0; float *rdgs;
char rd_mem[ 80]; /* command string variabl e */
/* dynamically allocate memory for readings */
rdgs = malloc(100 * sizeof(float));
/* Create the (HP E1406 Command Module) command string which reads the data register */
sprintf(rd_m em, "DIAG:PEEK? %l d, %d", b a se_addr+0x0C, 16);
/* Send DIAG:PEEK? command which accesses the data register */ /* and triggers measurements, and then retrieve measurements */
for (i = 0;i < readings; i++) {
IOOUTPUTS (CMD_M OD, rd_m em, strlen(rd_m em) );
IOENTER(CMD_MOD, &rdgs[i]);
}
/* Print a subset of the readings */ for (i = 0;i < 20;i + +) {
rdgs[i] /= 16; /* remove label from reading */
if (rdgs[i] >= 2047 ||rdgs[i] <= -2046)
printf("\nReading overrange");
else
printf("\nReading %d = %.6E", i, (rdgs[i]
}
free(rdgs); }
/****************************************************************************/ long get_base_addr(void) { /* digitizer logical address */ long logical_addr = (ADDR - 70900L) * 8;
0.0005));
*
Continued on Next Page
Chapter 2 Using the Digitizer 65
/* base address of (A24) offset register in A16 address space */ long base_addr = (0x1FC000 + (logical_addr * 64)) + 6;
float a24offst; /* A24 offset from A16 offset register */ char rd_addr[80]; /* command string variable */
/* Create the command string which reads the A24 base address */ sprintf(rd_addr, "DIAG:PEEK? %l d, %d", base_addr,16);
/* Send DIAG:PEEK? command */ IOOUTPUTS(CM D_MO D, rd_addr, strlen( rd_addr)) ;
/* Read value fr om off set regi st er */ IOENTER(CMD_MOD, &a24offst);
/* Multiply offset value by 256 for 24-bit address val ue */ a24offst *= 256.;
return (long)a24offst; }
/****************************************************************************/ void rst_clr(void) /****************************************************************************/ void check_error(char *f unc_t ion)
Comments 1. VME Data Transfer Modes. There are two modes of VME data
transfers: real time and post measurement. In a real time data transfer (shown in this program) accessing the digitizer’s data register triggers a measurement and returns the A/D reading directly to the VME bus in the same measurement cycle. The reading(s) is also stored in digitizer memory. In a post measurement transfer, each data register access transfers a A/D reading from digitizer memory to the VME bus.
2. Locating the Data Register. Access to the data register is through its address which is mapp ed by t he HP E1406 Comma nd Module into A24 address space. The data register has an offset of 12 (0C the A24 base address to form the complete register address. In the program, the C function long get_base_addr(void) determines the A24 base address by reading the digitizer’s offset regis ter in A16 address space. Detailed information on locating the data regist er can b e f ound i n Chapter 3 under the section "VME Bus Data Transfers".
3. VME B us Data For mat. Data is tra nsferred over the VME bus in the digitizer’s packed data format. Readings are 16-bits or 32-bits depending on the source specified by the VINStrument[:CONFigure]:VME:FEED <source > command. The source parameters are listed in Chapter 3 under the section "Setting the VME bus Transfer Mode".
) which is a dded to
16
66 Using the Digitizer Chapter 2
VME_SEG1.C
4. Syste m Co nfiguration. The system configuration on which the program VME_REAL.C was developed is listed on page 1-10.
/* VME_SEG1.C - This program demonstrat es how to transfer segmented readings */ /* over the VME bus. The program sets up 2 bursts (segments) of 10 pre-arm */ /* and 10 post-arm readings. A readi ng is taken each time the digitizer’s */ /* data register is accessed, and is transferr ed real tim e, over the VM E bus. */ /* Before the next burst is taken, bit 1 of (offset) register 43h is */ /* monitored to determin e when the next segment of readin g s can be taken. */
/* Include the following header files */
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <malloc.h> #include <cfunc.h> /* This file is from the HP-IB Command Library Disk */
#define ADDR 70905L /* I/O path from the PC to the digitizer */ #define CMD_MOD 70900L /* Path from the PC to the Command Module */
/* Function Prot oty p e s */
long get_base_addr(void); void rst_cl r(v oi d); void ad_conf(voi d); void ad_read(long base_addr); void check_error(char *f unc_t ion);
/****************************************************************************/ void main(voi d) /* run the program */ {
long base_addr; /* variable for digitizer A24 base address */
clrscr();
rst_clr() ; /* reset the digiti zer */
base_addr = get_base_addr(); /* function call to get digitizer */
/* A24 base address */ ad_conf(); /* function call which configures the digitizer */ ad_read(base_addr); /* function call which reads the digitizer */
/* data register */
}
Chapter 2 Using the Digitizer 67
/****************************************************************************/ void ad_conf(void ) {
int length = 0, loop = 0;
/* use the "set_commands" array to configure digitizer channel 1 */
char static *set_commands[] = {"CONF1:ARR:VO LT (20),5,(@ 3)", /* set 20 readings per burst, 5V range */
"ARM:STAR:SO UR IMM ", /* set arm source immedi ate */ "ARM:STAR:CO UN 2", /* set 2 bursts (arms) */ "TRIG:STA R:SO UR VME ", /* Data register acce ss triggers readings */ "SENS:SWE:OFFS: POIN -10", /* set 10 pre-arm readings */ "VINS:CONF:V ME:MO DE GEN", /* enable VME bus data transfers */ "VINS:CONF:VME: FEED ’CONV :CHAN1’" , /* real time data transfer */
"INIT"}; /* put digitizer in wait-for-ar m stat e */
length = (sizeof(set_commands) / sizeof(char*));
/* Execute each command using a loop */
for (loop = 0; loop < length; loop++)
{ IOOUTPUTS (ADDR, set_commands[loop], strlen(set_commands[loop])); }
/* function call to check for di gitizer configuration errors */
check_error("ad_conf");
}
/****************************************************************************/ void ad_read(long base_addr) {
int i, readings = 20, index = 0, loop = 0; float *rdgs, bit; char read_str[80], bit_str[80]; /* command string vari abl es */
/* dynamical ly alloc ate memory for readings */
rdgs = malloc(40 * sizeof(float));
/* Create the command string which reads the data register */
sprintf(read_str, "DIAG:PEEK? %ld, %d", base_addr+0x0C,16);
Continued on Next Page
68 Using the Digitizer Chapter 2
/* Create the command string which reads bit 1 */
sprintf(bit_ str, "DIAG:PEEK? %l d, %d", ba se_addr+0x43, 8);
/* Send DIAG:PEEK? to access the data register 20 times. */
while (loop < 2) /* two bursts (segments) */ {
for (i = index;i < readings; i++) {
IOOUTPUTS(CMD_MOD, read_str, strlen(read_str)); IOENTER(CMD_MOD, &rdgs[i]);
}
/* Check bit 1 of offset register 43h before proceeding with */
/* the next segment. */
do /* decimal value of bit 1 */ {
IOOUTPUTS (CMD_MO D, bi t_ str, strlen(bit _ str)); IOENTER(CMD_MOD, &bit);
} while ((int)bit & 2 == 0);
index +=20; /* i ncrement index for next segment */ readings +=20; /* increment reading s for next segm ent */ loop++; /* increment loop */
}
/* Convert to voltages and print the readings */ for (i = 0;i < 20; i++) {
rdgs[i] /= 16; /* remove label from reading */
if (rdgs[i] >= 2047 || rdgs[i] <= -2046)
printf("Reading overrange");
else
printf ("%.6E", (rdgs[i]
rdgs[i+20] /= 16;
if (rdgs[i+20] >= 2047 || rdgs[i+20] <= -2046)
printf("\t\tReading overrange\n") ;
else
printf("\ t\t%. 6E\ n", (rdgs[i + 20]
}
Continued on Next Page
0.0025));
*
0.0025));
*
Chapter 2 Using the Digitizer 69
free(rdgs);
}
/****************************************************************************/ long get_base_addr(void) {
/* digitizer logical address */ long logical_addr = (ADDR - 70900L) * 8;
/* base address of (A24) offset register in A16 address space */
long base_addr = (0x1FC000 + (logical_addr * 64)) + 6;
float a24offst; /* A24 of fset from A16 offset register */
char rd_addr[80]; /* command string vari abl e */
/* Create the command string which reads the A24 base address */ sprintf(rd_addr, "DIAG:PE EK? %ld, %d", ba se_addr,16);
/* Send DIAG:PEEK? command */ IOOUTPUTS(CMD_M OD, rd_addr, strlen(rd_addr));
/* Read value fr om off set regi st er */ IOENTER(CMD_MOD, &a24offst);
/* Multiply offset value by 256 for 24-bit address val ue */ a24offst *= 256.;
return (long)a24offst;
}
/****************************************************************************/ void rst_clr(void) {
/* Reset and clear the digitizer */
IOOUTPUTS(ADDR, "*RST;*CLS", 9);
}
/****************************************************************************/ void check_error(char *f unc_t ion) {
char into[161]; intlength = 160;
Continued on Next Page
70 Using the Digitizer Chapter 2
IOOUTPUTS (ADDR, "SYST:E RR?", 9); /* Query error register */ IOENTERS(ADDR, into, &length); /* Enter error mes sage */
if (atoi(into) != 0) /* Determine if error is pre sent */
/* If errors present, print and exit */
{
while (atoi(into) != 0)
{
printf("Error %s in function %s\n\n", into, func _ti on); IOOUTPUTS(ADDR, "SYST:ERR?", 9);
IOENTERS(ADDR, into, &length); } exit(1);
}
}
Comments 1. Segmented Readings. Multi ple bursts of p re-a rm and post-arm re adin g s
segment memory (see Figure 3-13). When transferring segmented readings over the VME bus real time or post measurement, a partition window must be accounted for. A partition window is the period during which the digitizer confi gures each segment for data transfer. The partit ion window is monitored by bit 1 of digitizer offset register 43 condition regist er in the Operation Status Group (Figure 3-13). A low-to-high transition of the bit indicates the next segment can be transferred.
, and by bit 9 of the
16
2. Monitoring the Partition Window. It is only necessary to monitor the partition wind ow bits when the digitizer readings are segment ed and t he data register is accessed at speeds available through an embedded controller. Monitoring bit 1 of offset register 43
is faster than using SCPI commands
16
to monitor bit 9 of the condition regist er.
3. Locating the Registers. Access to the data register and offset register
is through their addresses which are mapped by the HP E1406
43
16
Command Module or the system resource manager into A24 address space. The data register offset (12
or 0C16) and Offset register 4316 (6710) is
10
added to the A24 base address to form the complete register addresses. In the program, the C function long get_base_addr(void) determines the A24 base address by reading the digitizer’s offset register in A16 address space. Detailed information on locating the data and offset 43
registers can be
16
found in Chapter 3 under the section "VME Bus Data Transfers".
Chapter 2 Using the Digitizer 71
VME Bus Data Transfers Using an Embedded Controller
The following programs transfer data over the VME bus using the following system configuration:
Controller: RadiSys® EPC®-7 Embedded Controller
Runtime library: Standard Instrument Control Library (SICL) for
DOS
Compiler: Borland© C++ (.CPP)
These programs are also contained on the C language example programs disk (HP E1429-10302 ).
SEGTST16.CPP This program transfers 16-bit readings (real time) from the channel 1 A/D
converter to the VME bu s.
The includ e files and structur e def init ions used in this this program are listed following t he SEGTST16.CPP and SEGT ST 32.CPP pro gram listings.
// Options|Compiler|CodeGeneration|Model: Set to Large // Options|Directories|Include Directories: Add C:\EPCO NNEC\INCLUDE // Options|Directories|Library Directories: Add C:\EPCO NNEC\LIB // Project Items: INST.CPP, E1429.CPP, SEGTST16.CPP, BSICL.LIB, EPCMSC.LIB
#include <stdlib.h> #include <stdio.h> #include "e1429.h"
#define BUFLEN 200
extern int ierrno;
int Measure(E1429 *Dig); int ReadData(E1429 *Dig);
/* *********************** Main *********************** */
void main(void) { int Errors; E1429 *Dig;
Errors = 0; ierrno = 0;
Continued on Next Page
72 Using the Digitizer Chapter 2
Dig = new E1429; if (!Di g-> I sVali d()) { printf("Digi tizer could not be opened (% s).\n", igeterrstr(igeterrno())); if (Dig != NULL) delete Dig; Dig = NULL; exit(1); }
Errors += Measure(Dig); if ( !Errors) Errors += ReadData(Dig);
delete Dig; exit(0); }
/* ********************** Measure ********************* */
int Measure(E1429 *Dig) { int Errors; char Buf[BUFLEN+1], **Com; static char *Commands[] = { "*RST", "CONF1:ARR: VO LT (20), 5, (@3)", "ARM:STAR:SO UR IM M", "ARM:STAR:COUN 2", "TRIG: STAR:S OUR VME", "SENS:SWE:OFFS:POIN -10", "VINS:CONF:VME:MODE GEN", "VINS:CONF: VME :FEED ’CO NV:CHA N1’", "INIT", NULL };
for (Com = Commands; *Com != NULL; Com++) Dig->SendMessage(*Com); Errors = 0; while (Dig->GetErrorMessage(Buf,BUFLEN) != NULL) { printf("%s\n",Buf); Errors++; } return Errors; }
Continued on Next Page
Chapter 2 Using the Digitizer 73
/* ********************* ReadData ********************* */
int ReadData(E1429 *Dig) { int SegCnt, ReadCnt; WORD *Readings, *Reading, *Reading2; const static NReadings = 20, NSegments = 2; const static float Scale = 0.0025 / 16.0;
Reading = Readings = (WORD *) malloc(NSegments * NReadings * sizeof(WORD)); for (SegCnt = 0; SegCnt < NSegments; SegCnt++) { while ((Dig->bG et(67) & 2) == 0); Dig->MGetDataReg(( UWORD *) Reading, NReadin g s); Reading += NReadings; }
printf(" **** Channel 1 ****\n"); printf(" Seg 1 Seg 2\n"); printf(" ---------- ----------\n"); Reading = Readings; Reading2 = Readings + NReadings; for (ReadCnt = 1; ReadCnt <= NReadings; ReadCnt++) printf("%2d%+10.4f%+10.4f\n",ReadCnt,Scale printf("\n");
*Reading++,Scal e * *Reading2++);
*
free(Readings); return 0; }
SEGTST32.CPP This program transfers 32-bit readings (real time) from the channel 2 and
channel 1 A/D converters to the VME bus. In a 32-bit transfer, the upper 16-bits are the reading from channel 2 and the lower 16-bits are the reading from channel 1 (Figure 3-11).
The includ e files and structur e def init ions used in this this program are listed following the program listing.
74 Using the Digitizer Chapter 2
// Options|Compiler|CodeGeneration|Model: Set to Large // Options|Directories|Include Directories: Add C:\EPCO NNEC\INCLUDE // Options|Directories|Library Directories: Add C:\EPCO NNEC\LIB // Project Items: INST.CPP, E1429.CPP, SEGTST32.CPP, BSICL.LIB, EPCMSC.LIB
#include <stdlib.h> #include <stdio.h> #include "e1429.h"
#define BUFLEN 200
extern int ierrno;
int Measure(E1429 *Dig); int ReadData(E1429 *Dig);
/* *********************** Main *********************** */
void main(void) { int Errors; E1429 *Dig;
Errors = 0; ierrno = 0;
Dig = new E1429; if (!Di g-> I sVali d()) { printf("Digi tizer could not be opened (% s).\n", igeterrstr(igeterrno())); if (Dig != NULL) delete Dig; Dig = NULL; exit(1); }
Errors += Measure(Dig); if ( !Errors) Errors += ReadData(Dig);
delete Dig; exit(0); }
Continued on Next Page
Chapter 2 Using the Digitizer 75
/* ********************** Measure ********************* */
int Measure(E1429 *Dig) { int Errors; char Buf[BUFLEN+1], **Com; static char *Commands[] = { "*RST", "CONF1:ARR: VO LT (20), 5, (@3)", "CONF2:ARR: VO LT (20), 5, (@4)", "ARM:STAR:SO UR IM M", "ARM:STAR:COUN 2", "TRIG: STAR:S OUR VME", "SENS:SWE:OFFS:POIN -10", "VINS:CONF:VME:MODE GEN", "VINS:CONF: VME :FEED ’CO NV:B OTH32’", "INIT", NULL };
for (Com = Commands; *Com != NULL; Com++) Dig->SendMessage(*Com); Errors = 0; while (Dig->GetErrorMessage(Buf,BUFLEN) != NULL) { printf("%s\n",Buf); Errors++; } return Errors; }
/* ********************* ReadData ********************* */
int ReadData(E1429 *Dig) { int SegCnt, ReadCnt; LONG *Readings, *Reading, *Reading2; const static NReadings = 20, NSegments = 2; const static float Scale = 0.0025 / 16.0;
Reading = Readings = (LONG *) malloc(NSegments * NReadings * sizeof(LONG)); for (SegCnt = 0; SegCnt < NSegments; SegCnt++) { while ((Dig->bG et(67) & 2) == 0); Dig->MGetLongDataReg((ULONG *) Reading,NReadings); Reading += NReadings; }
Continued on Next Page
76 Using the Digitizer Chapter 2
printf(" **** Channel 1 **** **** Channel 2 ****\n"); printf(" Seg 1 Seg 2 Seg 1 Seg 2\n"); printf(" ---------- ---------- ---------- ----------\n"); Reading = Readings; Reading2 = Readings + NReadings; for (ReadCnt = 1; ReadCnt <= NReadings; ReadCnt++) { printf("%2d%+10.4f%+10.4f %+10.4f%+10.4f\n",ReadCnt, Scale Scale ); Reading++; Reading2++; } printf("\n");
free(Readings); return 0; }
LOWORD(*Reading), Scale*LOWORD(*Reading2),
*
HIWORD(*Reading), Scale*HI WORD(*Reading2)
*
SEGTST16.CPP
SEGTST32.CPP
INST. H
The following files are us ed with progr ams S EGT ST16 .C PP a nd
and
SEGTST32.CPP:
#include Fi les
#ifndef INST_DEFD
#define INST_DE FD
#include <sicl.h>
#define BYT E ch ar #define WORD short int #define LO NG long #define UBYTE un signed char #define UWORD un signed short int #define ULONG un signed long
INST.H
INST.CPP
E1429.H
E1429.CPP
Continued on Next Page
Chapter 2 Using the Digitizer 77
#define LOWORD(l Word) ((WORD)(l Word)) #define HIWORD(l W ord) ((WO RD)(( LONG )( lWor d) >> 16))
class RegInst { static RegInst *MappedInst; int Valid; int Mapped; int MapSpace; unsigned int PageStart, PageCount; UBYTE *SuggestedAddr; protected: INST Inst; UBYTE *BaseAddr; void Unmap(void); public: RegInst(UWORD lAddr = 0); ~ RegInst(void);
int IsVali d(v oi d) { return (thi s != NULL && Vali d); } INST GetI nstID( void) { return Inst; } void SetMapping(int mapSpace, un signed int pageStart, unsigned int pageCount,
UBYTE *suggestedAddr); void Map(v oi d );
UBYTE bGet(UWORD offset) { if (!M apped) Map() ; return ibpeek((UBYTE *) (BaseAddr+offset)); }
void bSet(UW ORD offset , UBYTE value = 0) { if (!Mapped) Map(); ibpoke((UBYTE *) (BaseAddr+offset),value); }
UW ORD wG et(UWORD offset) { if (!Mapped) Map(); return iwpeek((UW ORD *) (BaseAddr+offset)); }
void wSet(UWO RD offset, UWORD value = 0) { if (!Mapped) Map(); iwpoke((UWORD *) (BaseAddr+offset),value); }
void wMGet(UWORD of fset , UW ORD *dest, ULONG count) { if (! Mapped) Map( ); iwpopf ifo(I n st,(UWORD *) (BaseAddr+off set ),dest,count, 1); } void wMSet(UWO RD offset, UWORD *src, ULONG count) { if (! Mapped) Map( ); iwpushfifo(In st,(UWORD *) (BaseAddr+offset),src,count,1); } void lMGet(UWORD offset, ULONG *dest, ULONG count) { if (!Mapped) Map(); ilpopfifo(I n st,(ULONG *) (BaseAddr+off set),dest, count, 1); } void lMSet( UWORD off set, ULONG *src, ULONG count) { if (!Mapped) Map(); ilpushfifo(I n st,(ULONG *) (Ba seAddr+of fset),src, count ,1); } };
Continued on Next Page
78 Using the Digitizer Chapter 2
INST.CPP
class MessInst : public RegInst { public: MessInst(WORD lAddr) : RegInst(lAddr) { } void Clear(voi d) { iclear(I n st); } void SendMessage(const char *message); char *ReceiveMessage(char *message, int maxLen = 80); char *GetErrorMessage(char *m e ssage, int maxLen = 80); };
#endif
#include <stdlib.h>
#include <stdio.h> #include <string.h> #include "inst.h"
#define BUFLEN 20 0
/* ************************** RegInst ************************** */
RegInst *RegInst::MappedInst = NULL;
RegInst::RegIn st(UWORD lAddr) { char Buf[32];
BaseAddr = NULL; MapSpace = 0; PageStart = 0; PageCount = 0; sprintf(Buf,"vxi,%u",lAddr); Valid = ((Inst = iopen(Buf)) ! = NULL) ? 1 : 0; Mapped = 0; }
RegInst::~ = RegInst(void) { if (Inst != NULL) { Unmap(); iclose(Inst); } }
Continued on Next Page
Chapter 2 Using the Digitizer 79
void RegInst::SetMapping(int mapSpace, unsigned int pageStart, unsigned int pageCount, UBYTE *suggestedAddr) {
int WasMapped;
if (this != NULL) { WasMapped = Mapped; if (Mapped) Unmap(); MapSpace = mapSpace; PageStart = pageStart; PageCount = pageCount; SuggestedAddr = suggestedAddr; if (WasMapped) Map(); } }
void RegInst::Map(void) { if (this != NULL) { Valid = 0; if (Inst != NULL) { MappedInst->Unmap(); BaseAddr = imap(Inst, MapSpace,PageS tart ,PageCount, SuggestedAddr); if (BaseAddr != NULL) { MappedInst = this; Valid = 1; Mapped = 1; } } } }
void RegInst::Unmap(void) { if (this != NULL) { Valid = 0; if (Inst != NULL) { if (this == MappedInst) { iunmap(Inst,BaseAddr,MapSpace,PageStart,PageCount); MappedInst = NULL; } Valid = 1; } BaseAddr = NULL; Mapped = 0; } }
Continued on Next Page
80 Using the Digitizer Chapter 2
/* ************************* MessInst ************************** */
void MessInst::SendMessage(const char *message) { unsigned long ActualLen; char Buf[BUFLEN+1];
strcpy(Buf,message); strcat(Buf,"\n"); iwrite(Inst,Buf,strlen(Buf),0,&ActualLen); }
char *MessInst::ReceiveMessage(char *mes sage, int maxLen) { int Reason; unsigned long ActualLen; char *SPtr, Buf[BUFLEN+1];
iread(Inst,message,maxLen,&Reason,&ActualLen); message[ActualLen] = ’\0’; SPtr = message + strlen(mes sage) - 1; while (SPtr >= message && *SPtr == ’\n’) *SPtr-- = ’\0’; while (Reason == I_TERM_MAXCNT) iread(Inst,Buf,BUFLEN,&Reason,&ActualLen); return message; }
char *MessInst::GetErrorMe ssage(char *me ssage, int maxLen) { char *MPtr;
SendMessage("SYST:ERR?"); ReceiveMessage(message,maxLen); MPtr = (atoi(me ssage)) ? message : NULL; return MPtr; }
Chapter 2 Using the Digitizer 81
E1429.H
#ifndef E1429_DEFD
#define E1429_DEFD
#include "inst.h"
class E1429 : public MessInst { int MemoryMode; public: E1429(WORD lAddr = 40); void SetDataReg(UWORD value) { wSet(0x0c,value); } UW ORD GetDat aReg(void) { return wGet(0x 0c); } void MGetDataReg(UWORD *dest, ULONG count) { wMGet(0x0c,dest,count); } ULONG GetLongDataReg(voi d); // Cannot use lGet here because of ilpeek problem void MGetLongDataReg(ULONG *dest, ULONG count) { lMGet(0x0c, d est,count); } };
#endif
E1429.CPP
#include <stdlib.h>
#include "e1429.h"
E1429::E1429(WORD lAddr) : MessInst(lAddr) { SetMapping(I_MAP_EXTEND,0,1,NULL); Map(); }
ULONG E1429::GetLongDat aReg(void) { ULONG Result;
lMGet(0x0c,&Result,1 ); return Result; }
82 Using the Digitizer Chapter 2
Local Bus Data Transfers
The following programs demonstrate:
how readings are tra nsferred ov er the L oca l bus from a single
digitizer to the HP E1488 memory card (LOCAL_AD.C)
how readings in digitizer memory are transferred over the Local bus
from two digitizers to the HP E1488 memory card ( LBUS2PST.C )
how readings fr om two digitiz er A/Ds ar e tra nsferred over the Local
bus to the HP E1488 memory card (LBUSAUTO.C)
For comp leteness, the ent ire C la nguage versions of these programs ar e listed. The programs are also contained on the example programs disk (HP p/n E1429-10302).
LOCAL_ AD.C This program transfers readings from both digitizer channels to the
HP E1488 memory card. The readings are tranferred directly from the digitiz er A/Ds.
/* LOCAL_AD.C - This program demonstrates a Local bus data transfer */ /* directly (real time) from the HP E1429B digitizer A/ Ds to the E1488A memory */ /* card. */
/* Include the following header files */
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <malloc.h> #include <cfunc.h> /* This file is from the HP-IB Command Library Disk */
#define ADDR 70905L /* I/O path from the PC to the digitizer */ #define ADDR_MEM 70903L /* I/O path from the PC to the memory card */
/* Function Prot oty p e s */
void rst_clr(long address); void configur e(void); void initiate(void); void check_error(char *array, long address);
Continued on Next Page
Chapter 2 Using the Digitizer 83
/****************************************************************************/ void main(voi d) /* run the program */ {
rst_clr(A DDR); /* reset the digitizer */ rst_clr(ADDR_MEM); /* reset the memory card */ configure(); /* configure the digitizer and the memory card */ initiate(); /* initiate the digit izer and m em ory card; */
/* retrieve the readings from the memory card */
}
/****************************************************************************/ void configur e(void) {
int length = 0, loop = 0;
/* use the "digitize r " array to conf igur e the digiti zer for readin g s on */ /* each channel’s (HI) differential input */
char static *digitizer[] = {"CONF1:ARR: VOLT (10) ,5, (@3)", /* set 10 readin g s, 5V range, */
/* channel 1 input port 3 */ "CONF2:ARR:VOLT (10),5,(@4)", /* configur e channel 2, port 4 */ "VINS:LBUS:RES", /* reset the Local bus chip */ "VINS:LBUS:MO DE GEN" , /* set Local bus mode to GENerate */ "VINS:LBUS:F EE D ’CONV: BOTH’"}; /* set Local bus feed (direct from A/D)
/* use the "memory" array to confi gure the mem ory card */
char static *memory[ ] = {"FORM:DATA PACK", /* set packed data format */ "TRAC:DEL:ALL", /* delete all readings on memory card */ "TRAC:DEF SET2, 40", /* store readings (40 byte s) in "SET2" */ "VINS:LBUS:RES" , /* r e set the Local b u s chip */ "VINS:LBUS:MODE CO NS", /* set Local bus mode to consume */ "STAT:OPC:INIT OFF "}; /* execute *OPC? aft er INIT is parsed */
/* Execute each command in "digitizer" */
length = (sizeof(digitizer) / sizeof(char*));
for (loop = 0; loop < length; loop++)
{ IOOUTPUTS(ADDR, digitizer[loop], strlen(digitizer[loop])); }
/* Execute each command in "memory" */
Continued on Next Page
84 Using the Digitizer Chapter 2
length = (sizeof(memor y) / sizeof(char*));
for (loop = 0; loop < length; loop++)
{ IOOUTPUTS(ADDR_MEM, memory[loop], strlen(memory[loop])); }
/* check for configurat ion erro rs */
check_error("digitizer ", ADDR);
check_error("memory", ADDR_MEM);
}
/****************************************************************************/ void initiate(void) {
int i = 0, readings = 20, swap = 0, bytes = 0, length = 1, *rdgs; float rdy; char lf_remove[ 1];
/* dynamical ly alloc ate mem ory for readi n g s */
rdgs = malloc(20 * sizeof(float)) ; /* allocate computer mem ory for reading st orage */ swap = sizeof(int) ; /* each reading in memory is two bytes */ bytes = 20 * swap; /* read 40 bytes (2 channels, 10 readings per channel) */
IOOUTPUTS(ADDR_M EM, "INIT", 4); /* initiate the memory card */ IOOUTPUTS(ADDR_M EM, "*OPC?", 5); /* wait for INIT to parse before continuing */ IOENTER(ADDR_MEM, &rdy ); /* enter *OPC? response from memory card */
IOOUTPUTS(ADDR, "INIT", 4); /* initiate the digitizer */ IOOUTPUTS (ADDR, "*OPC?", 5); /* allow readings to complete befor e */
/* retrieving them from the mem ory card */
IOENTER(ADDR, &rdy) ; /* enter *OPC? response from digitizer */
IOOUTPUTS (ADDR_M EM, "TRA C:DAT A? SET2", 15); /* retriev e readin g s from memory card
*/
IOENTERAB(ADDR_MEM, rdg s, &bytes, swap); /* enter readings and remove block header */
/* remove line feed which trails the last data byte */
IOENTERS(ADDR_ME M, lf_rem ov e, &length) ;
Continued on Next Page
Chapter 2 Using the Digitizer 85
/* conv ert and display the reading s; readin gs are in the sequence */ /* channel 2 reading 1, channel 1 reading 1, channel 2 reading 2, */ /* channel 1 reading 2, and so on */
for (i = 0; i < reading s; i++) {
rdgs[i] /= 16; if (rdgs[i] >= 2047 || rdgs[i] <= -2046)
printf("\nReading overrange");
else
printf("\nReading %d = %.6E", i, (rdgs[i] * 0.0025));
}
free(rdgs);
}
/****************************************************************************/ void rst_clr(long address) {
/* Reset and clear the digiti zer and mem or y card */
IOOUTPUTS(address, "*RST;*CLS ", 9);
}
/****************************************************************************/ void check_error(char *array, long address) {
char into[161]; intlength = 160;
IOOUTPUTS(address, "SYST:ERR?", 9); /* Query error regi st er */ IOENTERS(address, into, &length); /* Enter error message */
if (atoi(into) != 0) /* Determine if error is pre sent */
/* If errors present, print and exit */
{
while (atoi(into) != 0) {
printf("Error %s in array %s\n\n", into, array); length = 160; IOOUTPUTS(address, "SYST:ERR?", 9);
IOENTERS(address, into, &length); } exit(1);
}
}
86 Using the Digitizer Chapter 2
Comments 1. Digitizer Configuration. Both channel’s HI differential inputs (ports 3
and 4) are CONFigur e d for 10 readings on t he 5V range. Two readings (channel 1 and channel 2) are taken on each sample trigger. The sample rate, as s et by the CONF igure command, is 50 ns (20 MHz). Thus, data is transferred at a rate of 40 MSamples (80 MBytes)/sec on d.
Before setting the digitizer’s Local bus conf iguration the Local bus chip is reset. N ext, the Local bus m ode is set to GENerate and the feed (data source) is set to CONVerter:BOTH.
2. Post-Arm Readings. When transferring rea dings o ver th e Local bus from the digitizer A/D, all readings must be post-arm.
3. I nitiating the Digitizer. After the memory card is configured, it is INITiated first so that it is ready to receive the digitizer readings. When the digitizer is INITiat ed, *OPC? is u sed to all ow the readin gs to complet e and be transferred before they are retrieved from the memory card.
4. Reading Sequence and Format. When this program executes, the readings are transferred to the memory card and later displayed in the follo wing sequ ence:
channel 2 reading 1 channel 1 reading 1 channel 2 reading 2 channel 1 reading 2 . . .
The memory card was set up to store the readings in the digitizer’s packed data format. The packed readings are signed, 16-bit numbers preceded by the ANSI/IEEE Standard 488.2-198 7 Definite Length Arbitrary Block header. Packed readings are always numbers b etween -1.0 230 (-2046) and +1.0235 (2047). To convert the readings to voltages, each reading is divided by 16 to remove the data label bits (0 - 3), and is multipled by 0.0025 which is the reading resolution for the 5V range.
5. Additional Information. Additional information on Local bus operation and on the Local bus c ommands can be found in Chapter 3 - "Understanding the Digitizer", and in Chapter 4 - "Command Reference."
Chapter 2 Using the Digitizer 87
LBUS2PST.C This program transfers readings in digitizer memory from two digitizers to
the HP E1488 memory card. The program shows how the digitizers are used in the Local bus GENerate and APPend modes.
/* LBUS2PST.C - This program demonstrates how to transfer readings in */ /* digitizer memo r y from mul tiple di gi tizer s to the E1488 memory card. The */ /* leftmost digitizer is set to GENerate mode and the inner digitizer is set */ /* to the APPend mode. */
/* Include the following header files */
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <malloc.h> #include <cfunc.h> /* This file is from the HP-IB Command Library Disk */
#define ADDR_G 70905L /* I/O path from the PC to the generator digitizer */ #define ADDR_A 70906L /* I/O path from the PC to the appender digitizer */ #define ADDR_MEM 70903L /* I/O path from the PC to the memory card */
/* Function Prot oty p e s */
void rst_clr(long address); void configur e(void); void initiate(void); void check_error(char *f unc_t ion, long address);
/****************************************************************************/ void main(voi d) /* run the program */ {
rst_clr(ADDR_G); /* reset generator digitizer */ rst_clr(ADDR_A); /* reset appender digitizer */ rst_clr(ADDR_MEM); /* reset memory card */ configure(); /* configure the digitizers and the memory card */ initiate(); /* initiate the digitizers and the memory card; */
/* retrieve the readings from the memory card */
}
/****************************************************************************/ void configur e(void) {
int length = 0, loop = 0;
/* use the "digitize r 1" array to conf igure the generator digitizer */
Continued on Next Page
88 Using the Digitizer Chapter 2
char static *digitizer1[] = {"CONF1:ARR: VOLT (10) ,5, (@3)", /* set 10 readin g s, 5V range, */
/* channel, 1 input port 3 */ "VINS:LBUS:RES", /* reset the Local bus chip */ "VINS:LBUS:MO DE GEN" , /* set Local bus mode to GENerate */ "VINS:LBUS:FEE D ’MEM: CHAN1’"} ; /* set Local bu s feed */
/* use the "digitize r 2" array to conf igure the appender digitizer */
char static *digitizer2[] = {"CONF1:ARR: VOLT (10) ,5, (@3)", /* set 10 readin g s, 5V range, */
/* channel, 1 input port 3 */ "VINS:LBUS:RES", /* reset the Local bus chip */ "VINS:LBUS:M ODE APP", /* set Local b u s mode to APPend */ "VINS:LBUS:FEE D ’MEM: CHAN1’"} ; /* set Local bus feed */
/* use the "memory" array to confi gure the mem ory card */
char static *memory[ ] = {"FORM:DATA PACK", /* set packed data format */ "TRAC:DEL:ALL", /* delete all readings on memory card */ "TRAC:DEF SET1, 40", /* store readings (40 bytes) in "SET1" */ "VINS:LBUS:RES" , /* reset the Local b u s chip */ "VINS:LBUS:MODE CO NS", /* set Local bus mode to co n sume */ "STAT:OPC:INIT OFF "}; /* execute *OPC? after INIT is parsed */
/* Execute each command in "digitizer1" using a loop */
length = (sizeof( digi tizer 1) / sizeof ( char*)) ;
for (loop = 0; loop < length; loop++)
{ IOOUTPUTS(ADDR_G , digi tizer1[l oop] , strlen(di gi tizer1[ l oop])) ; }
/* Execute each command in "digitizer2" using a loop */
length = (sizeof( digi tizer 2) / sizeof ( char*)) ;
for (loop = 0; loop < length; loop++)
{ IOOUTPUTS(ADDR_A, digitizer2[loop], strlen(digitizer2[loop])); }
Continued on Next Page
Chapter 2 Using the Digitizer 89
/* Execute each command in "memory" */
length = (sizeof(memor y) / sizeof(char*));
for (loop = 0; loop < length; loop++)
{ IOOUTPUTS(ADDR_MEM, memory[loop], strlen(memory[loop])); }
/* check for digitizer and memory card conf i gurati on error s */
check_error("digitizer 1", ADDR_G );
check_error("digitizer 2", ADDR_A) ;
check_error("memory", ADDR_MEM);
}
/****************************************************************************/ void initiate(void) {
int i = 0, readings = 20, swap = 0, bytes = 0, length = 1, *rdgs; float rdy; char lf_remove[ 1];
/* dynamical ly alloc ate mem ory for readi n g s */
rdgs = malloc(20 * sizeof(float)) ; /* allocate computer mem ory for reading st orage */ swap = sizeof(int) ; /* each reading in memory is two bytes */ bytes = 20 * swap; /* read 40 bytes */
IOOUTPUTS(ADDR_M EM, "INIT", 4); /* initiate the memory card */ IOOUTPUTS(ADDR_M EM, "*OPC?", 5); /* wait for INIT to parse before continuing */ IOENTER(ADDR_MEM, &rdy ); /* enter *OPC? response from memory card */
IOOUTPUTS(ADDR_A, "INIT", 4); /* initiate the appender digitizer */
IOOUTPUTS(ADDR_G , "INIT", 4); /* initiate the generator digitizer */ IOOUTPUTS(ADDR_G , "*OPC?", 5); /* allow the readings to complete before */
/* retrieving them from the mem ory card */ IOENTER(ADDR_G, &rdy); /* enter *OPC? response from the digitizer */
IOOUTPUTS(ADDR_M EM, "TRAC:DAT A? SET1", 15); /* retrieve reading s from memory
card */
IOENTERAB(ADDR_MEM, rd gs, &bytes, swap); /* enter readings and remove block header
*/
Continued on Next Page
90 Using the Digitizer Chapter 2
/* remove line feed which trails the last data byte */
IOENTERS(ADDR_ME M, lf_rem ov e, &length) ;
/* conv ert and display the reading s; the generator digitiz er readin g s */ /* occur first, followed by the appender digitizer readings */
for (i = 0; i < reading s; i++) {
rdgs[i] /= 16; if (rdgs[i] >= 2047 || rdgs[i] <= -2046)
printf("\nReading overrange");
else
printf("\nReading %d = %.6E", i, (rdgs[i] * 0.0025));
}
free(rdgs);
}
/****************************************************************************/ void rst_clr(long address) {
/* Reset and clear the instruments */
IOOUTPUTS(address, "*RST;*CLS ", 9);
}
/****************************************************************************/ void check_error(char *array, long address) {
char into[161]; intlength = 160;
IOOUTPUTS(address, "SYST:ERR?", 9); /* Query error regi st er */ IOENTERS(address, into, &length); /* Enter error message */
if (atoi(into) != 0) /* Determine if error is pre sent */
/* If errors present, print and exit */
{
Continued on Next Page
Chapter 2 Using the Digitizer 91
while (atoi(into) != 0) {
printf("Error %s in %s\n\n", into, array); length =160; IOOUTPUTS(address, "SYST:ERR?", 9);
IOENTERS(address, into, &length); } exit(1);
}
}
Comments 1. GEN erator Digitizer Configuration. Channel 1 of the GENerator
digitizer is CONF igur e d for 10 readin gs on the 5V range.
Before setting the digitizer’s Local bus conf igur at ion, the Local bus chip is reset. N ext, the Local bus m ode is set to GENerate and the feed (data source) is set to MEMory:CHANnel1.
2. APPender Digitizer Configuration. Channel 1 of the APPender digitizer is CONF igur e d for 10 readin gs on the 5V range.
For all digitizer’s doing Local bus transfers, the Local bus chip must b e reset first. Next, the Local bus mode is set t o APPend and the feed (data source) is set to MEMory:CHANnel1.
3. Pre- and Post-Arm Readings. When the Local bus data source is MEMory: ..., t he read ings are transf erred over the Local bus fr om digitizer memor y ra ther than d irectly from the A/D. In t his case, pr e- and post-arm readings are allowed prior to the Local bus transfer.
4. Initiating the Digitizers. After the memory card is configured, the card is INITiat ed first s o that it is ready to receive the d igitizer readings. I n a configurati on with multiple digitiz ers in the APPend mode, the APPender digitizer(s) is (are) INITiated next. Because CONFigure sets the arm source to IMMediat e, INITiating the (APPender) digitiz er causes it to take its readings. After the APPender is INITiated the GENerator digitizer is INITiated. *OPC? is used to allow the GENerator rea d ings to complete and be transferred before they are retrieved from the memory card.
Note that the APPender digitizers must have finished taking data before the GENerator is finished. All APPenders must be ready to pip eline the GENerator’s data at t he time t he data is sent.
92 Using the Digitizer Chapter 2
5. Reading Sequence and Format. When this program executes, the readings are transferred to the memory card and later displayed in the follo wing sequ ence:
GENerator di gitizer reading 1 GENerator di gitizer reading n . . APPender digitiz er reading 1 APPender digitiz er reading n
The memory card was set up to store the readings in the digitizer’s packed data format. The packed readings are signed, 16-bit numbers preceded by the ANSI/IEEE Standard 488.2-198 7 Definite Length Arbitrary Block header. Packed readings are always numbers b etween -1.0 230 (-2046) and +1.0235 (2047). To convert the readings to voltages, each reading is divided by 16 to remove the data label bits (0 - 3), and is multipled by 0.0025 (the reading resolution for the 5V range).
6. Additional Information. Additional information on Local bus operation and on the Local bus c ommands can be found in Chapter 3 - "Understanding the Digitizer", and in Chapter 4 - "Command Reference."
LBUSAUTO.C This program transfers readings over the Local bus from two digitizer A/Ds
to the HP E1488 m em o ry card. The progra m shows how the digitizers are used in the Local bus GENerate and INSert modes. The program is similar to the previous program; however, rather than INITiate each digitizer individually, the INSerter digitizer INITiates the GENerator digitizer once the INSerter digitizer readings are complete.
/* LBUSAUTO.C - This program demonstrate s how to transfer readings over the */ /* Local bus from two digitizer A/Ds to the HP E1488 memory card. The leftm o st */ /* digitizer is set to the GENerate mode and the inner digitizer is set to the */ /* INSert mode. The generator digitizer is armed from the TTLT0 trigger line */ /* when the inserter digitizer has completed it s mea surem ents. */
/* Include the following header files */
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <malloc.h> #include <cfunc.h> /* This file is from the HP-IB Command Library Disk */
Continued on Next Page
Chapter 2 Using the Digitizer 93
#define ADDR_G 70905L /* I/O path from the PC to the generator digitizer */ #define ADDR_I 70906L /* I/O path from the PC to the inserter digitizer */ #define ADDR_MEM 70903L /* I/O path from the PC to the memory card */ #define CMD_MOD 70900L /* I/O path from the PC to the Command Modul e */
/* Function Prot oty p e s */
void rst_clr(long address); long get_base_addr(void); void configur e(void); void initiate(long base_addr); void check_error(char *f unc_t ion, long address);
/****************************************************************************/ void main(voi d) /* run the program */ {
long base_addr; /* variable for A24 base address */ clrscr();
rst_clr(ADDR_G); /* reset the generator digitizer */ rst_clr(A DDR_I); /* reset the in serter di gi tiz er */ rst_clr(ADDR_MEM); /* reset memory card */
base_addr = get_base_addr(); /* get digitizer A24 base address */
configure(); /* configure the digitizers and memory card*/
initiate(base_addr); /* initiate the digitizers and memory card; */
/* retrieve the readings from the memory card */
}
/****************************************************************************/ void configur e(void) {
int length = 0, loop = 0;
/* use the "digitize r 1" array to conf igure the generator digitizer */
char static *digitizer1[] = {"CONF1:ARR: VOLT (10) ,5, (@3)", /* set 10 readin g s, 5V range, */
/* channel, 1 input port 3 */
"ARM:STAR:SOUR TT LT 0", /* set arm source */
"ARM:STAR:DEL 50E-6", /* set arm delay */ "VINS:LBUS:RES", /* reset the Local bus chip */ "VINS:LBUS:MO DE GEN" , /* set Local bus mode to GENerate */ "VINS:LBUS:FEE D ’CONV: CHAN1’"}; /* set Local bus feed */
Continued on Next Page
94 Using the Digitizer Chapter 2
/* use the "digitize r 2" array to conf igure the inserter digitizer */
char static *digitizer2[] = {"CONF1:ARR: VOLT (10) ,5, (@3)", /* set 10 readin g s, 5V range, */
/* channel, 1 input port 3 */ "OUTP:TTLT0: F EED ’READY’", /* feed ready signal to next digitizer */ "OUTP:TTLT0: STAT ON", /* enabl e ready signal feed */ "VINS:LBUS:RES", /* reset the Local bus chip */ "VINS:LBUS:M ODE INS", /* set Local bus mode to INSert */ "VINS:LBUS:FEE D ’CONV: CHAN1’"}; /* set Local bus feed */
/* use the "memory" array to confi gure the mem ory card */
char static *memory[ ] = {"FORM:DATA PACK", /* set packed data format */ "TRAC:DEL:ALL", /* delete all readings on memory card */ "TRAC:DEF SET1, 40", /* store readings (40 bytes) in "SET1" */ "VINS:LBUS:RES" , /* reset the Local b u s chip */ "VINS:LBUS:MODE CO NS", /* set Local bus mode to co n sume */ "STAT:OPC:INIT OFF "}; /* execute *OPC? after INIT is parsed */
/* Execute each command in "digitizer1" using a loop */
length = (sizeof( digi tizer 1) / sizeof ( char*)) ;
for (loop = 0; loop < length; loop++)
{ IOOUTPUTS(ADDR_G , digi tizer1[l oop] , strlen(di gi tizer1[ l oop])) ; }
/* Execute each command in digitizer2 using a loop */
length = (sizeof( digi tizer 2) / sizeof ( char*)) ;
for (loop = 0; loop < length; loop++)
{ IOOUTPUTS(ADDR_I , digi tizer2[loop] , strlen(di gi tiz er2[loop] )); }
/* Execute each command in "memory" */
length = (sizeof(memor y) / sizeof(char*));
Continued on Next Page
Chapter 2 Using the Digitizer 95
for (loop = 0; loop < length; loop++)
{ IOOUTPUTS(ADDR_MEM, memory[loop], strlen(memory[loop])); }
/* check for digitizer conf igur ation errors */
check_error("digitizer 1", ADDR_G );
check_error("digitizer 2", ADDR_I );
check_error("memory", ADDR_MEM);
}
/****************************************************************************/ void initiate(long base_addr) {
int i = 0, readings = 20, swap = 0, bytes = 0, length = 1, *rdgs; int bit_reg = 0; float rdy, bit_pat = 0; char lf_remove[ 1], command[ 80];
/* dynamical ly alloc ate memory for readings */
rdgs = malloc(20 * sizeof(float)) ; /* allocate computer mem ory for reading st orage */ swap = sizeof(int) ; /* each reading in memory is two bytes */ bytes = 20 * swap; /* read 40 bytes */
/* create DIAG:PE EK? comm and which reads the generator digitizer’s */ /* arm source register */
sprintf(comm and, "DIA G:PEE K? %ld, %d", ba se_addr+0x49, 8); IOOUTPUTS(CMD_M O D, command, st rlen(command)); IOENTER(CMD_MOD, &bit_pat);
/* retain register sett i n gs, set arm source 1 slope to positi ve */ bit_reg = (int)(bit _pat + ((bi t_pat >= 0) ? .5 : -.5)); bit_reg = (bit_reg & 0xF7); sprintf(comm and, "DIAG: POKE %ld, %d, %d", base_addr+0x49,8, bi t_reg) ; IOOUTPUTS(CMD_M O D, command, st rlen(command));
IOOUTPUTS(ADDR_M EM, "INIT", 4); /* initiate the memory card */ IOOUTPUTS(ADDR_M EM, "*OPC?", 5); /* wait for INIT to parse before continuing */ IOENTER(ADDR_MEM, &rdy ); /* enter *OPC? response from memory card */
IOOUTPUTS(ADDR_G , "INIT", 4); /* initiate the generator digitizer */
Continued on Next Page
96 Using the Digitizer Chapter 2
IOOUTPUTS (ADDR_I , "INIT ", 4); /* initiate the inserter di gitiz er */ IOOUTPUTS(ADDR_G , "*OPC?", 5); /* wait for generator digitizer to finish */ IOENTER(ADDR_G, &rdy);
IOOUTPUTS (ADDR_M EM, "TRA C:DAT A? SET1", 15); /* retriev e readin g s from memory card
*/
IOENTERAB(ADDR_MEM, rdg s, &bytes, swap); /* enter readin gs and remove block header
*/
/* remove line feed which trails the last data byte */
IOENTERS(ADDR_ME M, lf_rem ov e, &length) ;
/* conv ert and display reading s; the inserter digitizer readin g s */ /* occur first, followed by the generator digitizer readings */
for (i = 0; i < reading s; i++) {
rdgs[i] /= 16; if (rdgs[i] >= 2047 || rdgs[i] <= -2046)
printf("\nReading overrange");
else
printf("\nReading %d = %.6E", i, (rdgs[i] * 0.0025));
}
free(rdgs);
}
/****************************************************************************/ long get_base_addr(void) {
/* base address of generator digitizer’s (A24) offset register in A16 */ /* address space */
long base_addr = (0x1FC000 + (40 * 64)) + 6; /* generator digitizer logical address is 48 */
float a24offst; /* A24 of fset from A16 offset register */
char rd_addr[80]; /* command string vari abl e */
/* Create the command string which reads the A24 base address from the offset regist er */ sprintf(rd_addr, "DIAG:PE EK? %ld, %d", ba se_addr,16);
/* Send DIAG:PEEK? command */
IOOUTPUTS(CMD_M OD, rd_addr, strlen(rd_addr));
Continued on Next Page
Chapter 2 Using the Digitizer 97
/* Read value fr om off set regi st er */
IOENTER(CMD_MOD, &a24offst);
/* Multiply offset value by 256 for 24-bit address val ue */
a24offst *= 256.;
return (long)a24offst;
} /****************************************************************************/ void rst_clr(long address) {
/* Reset and clear the instruments */
IOOUTPUTS(address, "*RST;*CLS ", 9);
}
/****************************************************************************/ void check_error(char *array, long address) {
char into[161]; intlength = 160;
IOOUTPUTS(address, "SYST:ERR?", 9); /* Query error regi st er */ IOENTERS(address, into, &length); /* Enter error message */
if (atoi(into) != 0) /* Determine if error is pre sent */
/* If errors present, print and exit */
{
while (atoi(into) != 0) {
printf("Error %s in %s\n\n", into, array); length = 160; IOOUTPUTS(address, "SYST:ERR?", 9);
IOENTERS(address, into, &length); } exit(1);
}
}
98 Using the Digitizer Chapter 2
Comments 1. GENerator Digitizer Configuration. Channel 1 of the GENerator
digitizer is CONF igur e d for 10 readin gs on the 5V range. The arm source is set to TTLT0. This VXI backplane trigger line is controlled by the INSerter digitizer which feeds its READy signal to arm the GENerator di gitizer after its readings are complete. An arm delay of 50 INSerter digitizer to switch to the pipeline mode after its readings are complete (see the "Insert" mode description under "Local Bus Modes" in Chapter 3).
The INSerter digitizer’s READy signal goes high when the readings are complete and the digitizer enters the idle state. In order for the GENerator digitizer to arm on the low-to-high transition, the GENerator digitizer must be set to accept a positive slope. This is done by writing to the digitizer’s Arm Source register and setting the slope bit from negative (1) to positive (0).
The digi tizer’s Loca l bu s confi gur a tion begins by r esetting the Local bus chip. The Local bus mode is set to GENerate and the feed (data source) is set to CONVerter:C HAN ne l 1.
2. INSerter Digitizer Configuration. Like the GENerator digitizer, the INSerter digitizer is CONFigured for 10 readings on the 5V range. The INSerter digitizer’s arm source and trigger source are INTernal. The INSerter digitizer transfers (feeds) its READy signal to the GENerator digitizer over th e VXI backplane TTLT0 trigger line.
µs is specif ied to allow for the
Again, the dig itiz er’s Lo cal bu s configuration begins b y r es etting the Local bus chip. The Local bus mode is set to INSert and the feed (data source) is set to CONVerter:C HAN ne l 1.
3. Digitizer Sample Rates. The maximum Local bus transfer rate is 80 MB ytes/s econd which is eq uiva l ent to 40 MSamples /seco nd . The sample rate for both digitizers as set by the CONFigure command is 50 ns (20 MHz). Thus, data is transferred from the two digitizers at a rate of 40 MSamples (80 MBytes)/second.
4. Initiating the Digitizers. After the memory card is configured, the card is INITiat ed first s o that it is ready to receive the d igitizer readings. I n a configuration with multiple digitizers in the INSert mode, the GENerator digitizer is INITiated next so that it is waiting for an arm signal to begin taking measurements. When the INSerter is INITiated it takes its readings and then arms the GENerator digitizer. *OPC? is used to allow the GENerator read ings to complete and be transferred before they are retrieved from the memory card.
Chapter 2 Using the Digitizer 99
5. Reading Sequence and Format. When this program executes, the readings are transferred to the memory card and later displayed in the follo wing sequ ence:
INSerter digitizer reading 1 INSerter digitizer reading n . . GENerator di gitizer reading 1 GENerator di gitizer reading n
The memory card stores the readings in the digitizer’s packed data format. Packed readings are signed, 16-bit numbers preceded by the ANSI/IEEE Standard 488.2-1987 Definite Length Arbitrary Bl oc k head er. Packed readings are always numb ers bet ween -1.0230 (-2046 ) and +1.0 235 (204 7). To convert the readings to voltages, each reading is divided by 16 to remove the data label bits (0 - 3), and is multipled by 0.0025 whi ch is the reading resolution for the 5V range.
6. Additional Information. Additional information on Local bus operation and on the Local bus c ommands can be found in Chapter 3 - "Understanding the Digitizer", and in Chapter 4 - "Command Reference." Information on the digitizer’s Arm Source register can be found in Appendix C - "Register Programming."
100 Using the Digitizer Chapter 2
Loading...