Tektronix 7001, 7002 User manual

QuickBASIC 4.5 and Microsoft BASIC 7.1
Quick C2.5
Turbo Pascal 6.0
Model 2001 Multimeter and Model 7001 / 7002 Switch System
Contains Programming Information
IEEE-488 Interfaces Supported
Capital Equipment Corporation, v2.14 or later
National Instruments NI-488 rev C.10 or later
National Instruments NI-488.2 for PC/II/IIA or AT-GPIB rev 1.5
IOtech Driver 488, v2.6 or later
© 1993 Keithley Instruments, Inc.
Test Instrumentation Group
All Rights Reserved
Cleveland, Ohio, U.S.A.
2001-906-01 Rev. A
QuickBASIC 4.5 and Microsoft BASIC 7.1
pages 1 through 84
Quick C2.5
pages 85 through 178
Turbo Pascal 6.0
pages 179 through 262
All Keithley product names are trademarks or registered trademarks of Keithley Instruments, Inc. Other brand and product names are trademarks or registered trademarks of their respective holders.
QuickBASIC 4.5 and
Microsoft BASIC 7.1

Table of Contents

Section 1 — Using the Library Routines............................................................................7
1.1 Installation ..................................................................................................................................................... 7
1.1.1 National Instruments GPIB.COM ....................................................................................................... 7
1.1.2 Capital Equipment Corp....................................................................................................................... 7
1.1.3 IOTech Driver 488 .................................................................................................................................. 7
1.1.4 Microsoft BASIC 7.1 .............................................................................................................................. 7
1.1.5 QuickBASIC 4.5...................................................................................................................................... 8
1.2 General Instructions ..................................................................................................................................... 8
1.2.1 Microsoft BASIC 7.1 .............................................................................................................................. 8
1.2.2 QuickBASIC 4.5...................................................................................................................................... 9
1.2.3 Documentation Notes ........................................................................................................................... 9
Section 2 — Model 2001/7001 IEEE-488 Interface Routines...........................................11
2.1 FUNCTION SetupIEEE%(Device%, Address%).....................................................................................11
2.2 SUB SendSDC2001...................................................................................................................................... 12
SUB SendSDC7001
2.3 FUNCTION Q2001$(Cmd$)...................................................................................................................... 12
FUNCTION Q7001$(Cmd$)
2.4 SUB Send2001(Cmd$) ................................................................................................................................ 13
SUB Send7001(Cmd$)
2.5 SUB SendGET2001...................................................................................................................................... 13
SUB SendGET7001
2.6 FUNCTION Wait2001RQS% ..................................................................................................................... 14
FUNCTION Wait7001RQS%
Section 3 — Model 2001 Buffer Routines .......................................................................15
3.1 FUNCTION BufferSize2001%................................................................................................................... 15
3.2 FUNCTION Take2001BufferReadings% (Func%, BurstMode%, NumDataPoints1%,
Compact%)................................................................................................................................................... 15
3.3 FUNCTION Read2001BufferS% (ArrayName!(), DMA%, Fmt%)....................................................... 16
FUNCTION Read2001BufferD% (ArrayName#(), DMA%, Fmt%)
Section 4 — General Routines ........................................................................................19
4.1 FUNCTION ParseQuery$(Quer$, QuerNum%) .................................................................................... 19
4.2 FUNCTION Str1$(DoubleNumber#)....................................................................................................... 20
4.3 FUNCTION IOTECH$(Address%) .......................................................................................................... 20
4.4 SUB XYGraphS(XArray!(), YArray!(), YStart%, YStop%, XTitle$, YTitle$, Title$,
UseCGA2%, MaxMinScale%).................................................................................................................... 20
SUB XYGraphD(XArray#(), YArray#(), YStart%, YStop%, XTitle$, YTitle$, Title$, UseCGA2%, MaxMinScale%)
1
4.5 SUB DataViewS(DataArray!(), NumDataPoints%)................................................................................ 21
SUB DataViewD(DataArray#(), NumDataPoints%)
4.6 FUNCTION AutoGraphicsMode% (NumYPixels%, NumTextRows%, UseCGA2%)...................... 22
Section 5 — General Model 2001/7001 Routines...........................................................23
5.1 SUB Set2001Function(Func%)................................................................................................................... 23
5.2 FUNCTION Get2001Units$(Func%) ....................................................................................................... 23
5.3 FUNCTION Get2001SaveRecallSize% .................................................................................................... 24
5.4 FUNCTION Get2001FuncHeader$(Func%)............................................................................................ 25
5.5 FUNCTION Get2001Func% ...................................................................................................................... 25
5.6 FUNCTION Check2001Val$(CheckVal#, MinVal#, MaxVal#, CheckMinInf%)................................ 26
5.7 SUB Hit2001Key(HitKey%)....................................................................................................................... 26
5.8 SUB Disp2001(line1$, line2$) .................................................................................................................... 27
SUB Disp7001(line1$, line2$)
5.9 SUB NoDisp2001......................................................................................................................................... 27
SUB NoDisp7001
Section 6 — Model 2001 SENSe[1] Subsystem Commands.............................................29
6.1 Model 2001 Function Change Subroutines ............................................................................................. 29
6.1.1 SUB DCV2001....................................................................................................................................... 29
6.1.2 SUB ACV2001....................................................................................................................................... 29
6.1.3 SUB DCA2001 ...................................................................................................................................... 29
6.1.4 SUB ACA2001....................................................................................................................................... 30
6.1.5 SUB RES2.2001 ..................................................................................................................................... 30
6.1.6 SUB RES4.2001 ..................................................................................................................................... 30
6.1.7 SUB FREQ2001..................................................................................................................................... 30
6.1.8 SUB TEMP2001 .................................................................................................................................... 30
6.2 Return Model 2001 Reading Functions ................................................................................................... 30
6.2.1 FUNCTION Get2001Rdg$.................................................................................................................. 30
6.2.2 FUNCTION GetDCV2001$ ................................................................................................................ 31
6.2.3 FUNCTION GetACV2001$ ................................................................................................................ 31
6.2.4 FUNCTION GetDCA2001$............................................................................................................... 31
6.2.5 FUNCTION GetACA2001$................................................................................................................ 32
6.2.6 FUNCTION Get2RES2001$................................................................................................................ 32
6.2.7 FUNCTION Get4RES2001$................................................................................................................ 32
6.2.8 FUNCTION GetFREQ2001$............................................................................................................... 32
6.2.9 FUNCTION GetTEMP2001$.............................................................................................................. 32
6.3 DC Voltage Functions................................................................................................................................ 33
6.3.1 SUB Set2001DCV(Range#, Time#, Digits#).................................................................................... 33
6.3.2 FUNCTION Set2001DCVQ$.............................................................................................................. 33
6.3.3 SUB Auto2001DCV(AutoRange%, AutoTime%, AutoDigits%).................................................... 34
6.3.4 FUNCTION Auto2001DCVQ$........................................................................................................... 34
6.4 AC Voltage Functions................................................................................................................................. 35
6.4.1 SUB Set2001ACV(Range#, Time#, Digits#) ....................................................................................35
6.4.2 FUNCTION Set2001ACVQ$.............................................................................................................. 35
2
6.4.3 SUB Auto2001ACV(AutoRange%, AutoTime%, AutoDigits%).................................................... 36
6.4.4 FUNCTION Auto2001ACVQ$........................................................................................................... 36
6.5 DC Current Functions................................................................................................................................ 37
6.5.1 SUB Set2001DCA(Range#, Time#, Digits#).....................................................................................37
6.5.2 FUNCTION Set2001DCAQ$.............................................................................................................. 37
6.5.3 SUB Auto2001DCA(AutoRange%, AutoTime%, AutoDigits%).................................................... 38
6.5.4 FUNCTION Auto2001DCAQ$ .......................................................................................................... 38
6.6 AC Current Functions......................................................................................................................... 39
6.6.1 SUB Set2001ACA(Range#, Time#, Digits#).....................................................................................39
6.6.2 FUNCTION Set2001ACAQ$.............................................................................................................. 39
6.6.3 SUB Auto2001ACA(AutoRange%, AutoTime%, AutoDigits%) .................................................. 40
6.6.4 FUNCTION Auto2001ACAQ$ .......................................................................................................... 40
6.7 2-Wire Resistance Functions...................................................................................................................... 41
6.7.1 SUB Set2001R2(Range#, Time#, Digits#)......................................................................................... 41
6.7.2 FUNCTION Set2001R2Q$ .................................................................................................................. 41
6.7.3 SUB Auto2001R2(AutoRange%, AutoTime%, AutoDigits%)........................................................ 42
6.7.4 FUNCTION Auto2001R2Q$............................................................................................................... 42
6.8 4-Wire Resistance Functions...................................................................................................................... 43
6.8.1 SUB Set2001R4(Range#, Time#, Digits#)......................................................................................... 43
6.8.2 FUNCTION Set2001R4Q$ .................................................................................................................. 43
6.8.3 SUB Auto2001R4(AutoRange%, AutoTime%, AutoDigits%)........................................................ 44
6.8.4 FUNCTION Auto2001R4Q$............................................................................................................... 44
6.9 Frequency Functions .................................................................................................................................. 45
6.9.1 SUB Set2001F(Digits#, Source%)....................................................................................................... 45
6.9.2 FUNCTION Set2001FQ$..................................................................................................................... 45
6.10 Temperature Functions .............................................................................................................................. 46
6.10.1 SUB Set2001T(Time#, Digits#)........................................................................................................... 46
6.10.2 FUNCTION Set2001TQ$ .................................................................................................................... 46
6.10.3 SUB Auto2001T(AutoTime%, AutoDigits%) ................................................................................... 47
6.10.4 FUNCTION Auto2001TQ$................................................................................................................. 47
6.10.5 SUB Set2001RTD(Mode%, RType%, Alpha#, Beta#, Delta#, RZero#)......................................... 47
6.10.6 FUNCTION Set2001RTDQ$............................................................................................................... 48
6.10.7 SUB Set2001TC(TType$) ..................................................................................................................... 48
6.10.8 FUNCTION Set2001TCQ$.................................................................................................................. 49
Section 7 — Model 2001/7001 Status Commands..........................................................51
7.1 SUB Stat2001(Event2001%, PTF%, NTF%, SEN%)................................................................................. 51
SUB Stat7001(Event7001%, PTF%, NTF%, SEN%)
7.2 FUNCTION Stat2001Q$(Event2001%) ................................................................................................... 52
FUNCTION Stat7001Q$(Event7001%)
7.3 SUB SRE2001(mask%)................................................................................................................................ 52
SUB SRE7001(mask%)
7.4 SUB ESE2001(mask%) ................................................................................................................................ 53
SUB ESE7001(mask%)
7.5 FUNCTION OPC2001$(UnInterruptable%) ........................................................................................... 53
FUNCTION OPC7001$(UnInterruptable%)
3
7.6 SUB Clear2001 ............................................................................................................................................. 54
SUB Clear7001
Section 8 — Model 2001/7001 Scanning Commands .....................................................55
8.1 SUB Close2001(Channel%)........................................................................................................................ 55
8.2 SUB Close7001(ChanList$) ........................................................................................................................ 55
8.3 FUNCTION Close2001Q$.......................................................................................................................... 56
FUNCTION Close7001Q$
8.4 SUB Open2001(Channel%)........................................................................................................................ 56
8.5 SUB Open7001(ChanList$) ........................................................................................................................ 57
8.6 SUB Scan2001(ChanList$).......................................................................................................................... 57
SUB Scan7001(ChanList$)
8.7 SUB Arm2001(Count1#, Source1$, Count2#, Delay2#, Source2$) ...................................................... 57
SUB Arm7001(Count1#, Source1$, Count2#, Delay2#, Source2$)
8.8 FUNCTION Arm2001Q$ ........................................................................................................................... 58
FUNCTION Arm7001Q$
8.9 SUB Trig2001(Count1#, Delay1#, Source1$)........................................................................................... 59
SUB Trig7001(Count1#, Delay1#, Source1$)
8.10 FUNCTION Trig2001Q$ ............................................................................................................................ 59
FUNCTION Trig7001Q$
8.11 SUB Timers2001(ArmTimer2#, TrigTimer1#)......................................................................................... 60
SUB Timers7001(ArmTimer2#, TrigTimer1#)
8.12 FUNCTION Timers2001Q$....................................................................................................................... 60
FUNCTION Timers7001Q$
8.13 SUB ArmTcon2001(Dir1$, ILine1%, Oline1%, Dir2$, ILine2%, Oline2%)........................................... 61
SUB ArmTcon7001(Dir1$, ILine1%, Oline1%, Dir2$, ILine2%, Oline2%)
8.14 FUNCTION ArmTcon2001Q$ ................................................................................................................... 61
FUNCTION ArmTcon7001Q$
8.15 SUB TrigTcon2001(Dir1$, Synch1$, ILine1%, Oline1%) ........................................................................ 62
SUB TrigTcon7001(Dir1$, Synch1$, ILine1%, Oline1%)
8.16 FUNCTION TrigTcon2001Q$.................................................................................................................... 63
FUNCTION TrigTcon7001Q$
Section 9 — Model 2001 Calculate Commands..............................................................65
9.1 SUB Set2001Calc1MXB(MMFactor#, MBFactor#) ................................................................................. 65
9.2 SUB Set2001Calc1PERC(Percent#)........................................................................................................... 65
9.3 SUB Calc1.2001(State%) ............................................................................................................................. 66
9.4 FUNCTION Set2001Calc1Q$ .................................................................................................................... 66
9.5 FUNCTION Calc1.2001Q$......................................................................................................................... 67
9.6 SUB Set2001Calc2(Format$) ..................................................................................................................... 67
9.7 SUB Calc2.2001(State%) ............................................................................................................................. 68
9.8 FUNCTION Set2001Calc2Q$ ................................................................................................................... 68
9.9 FUNCTION Calc2.2001Q$......................................................................................................................... 68
9.10 SUB Set2001Calc3(Upper1#, Lower1#, Upper2#, Lower2#) ............................................................... 69
9.11 FUNCTION Set2001Calc3Q$ ................................................................................................................... 69
4
9.12 SUB Calc3.2001(State%) ............................................................................................................................. 70
9.13 SUB Set2001Calc3Dig(Du1%, Dl1%, Du2%, Dl2%)................................................................................ 70
9.14 FUNCTION Set2001Calc3DigQ$.............................................................................................................. 70
9.15 FUNCTION Calc3.2001Q$......................................................................................................................... 71
Appendix A — Model 2001/7001 Global Variables.........................................................73
Appendix B — Model 2001/7001 Constants...................................................................75
B.1 Function Constants..................................................................................................................................... 75
B.2 Status Model Constants ............................................................................................................................. 75
B.3 Automatic Constants.................................................................................................................................. 77
B.4 Model 2001 Minimum and Maximum Sense Constants ....................................................................... 77
B.5 Model 2001 Minimum and Maximum Calculate Constants ................................................................ 78
B.6 Model 2001/7001 Scanning Minimum and Maximum Constants ...................................................... 78
B.7 Read2001BufferS% and Read2001BufferD% Constants........................................................................ 78
B.8 Examples ...................................................................................................................................................... 78
Appendix C — Model 2001/7001 Support Software File Names and Routines...............79
C.1 Microsoft BASIC 7.1 File Names............................................................................................................... 79
C.1.1 Header Files.......................................................................................................................................... 79
C.1.2 Model 2001/7001 Demo Program Files............................................................................................ 79
C.1.3 Model 2001/7001 IEEE Interface Independent Files ...................................................................... 80
C.1.4 Capital Equipment Corp. (CEC) IEEE-488 Interface Files ............................................................. 80
C.1.5 IOTech Driver 488 Interface Files ...................................................................................................... 81
C.1.6 National Instruments NI-488 rev C.11 Files..................................................................................... 81
C.1.7 National Instruments NI-488 rev C.12 (and newer) and NI-488.2 Files ...................................... 82
C.2 Microsoft QuickBASIC 4.5 File Names.................................................................................................... 82
C.2.1 Model 2001/7001 IEEE Interface Independent Files ...................................................................... 82
C.2.2 Capital Equipment Corp. (CEC) IEEE-488 Interface Files ............................................................. 83
C.2.3 IOTech Driver 488 Interface Files ...................................................................................................... 83
C.2.4 National Instruments NI-488 rev C.11 Files..................................................................................... 83
C.2.5 National Instruments NI-488 rev C.12 (and newer) and NI-488.2 Files ...................................... 84
5
6
Section 1
Using the Library Routines
1.1 Installation
1.1.1 National Instruments GPIB.COM
You must have Rev C.10 or later of the National Instruments NI-488 Software or Rev 1.0 or later of the Na­tional Instruments NI-488.2 Software to use the Model 2001/7001 Support Software. Some older revisions may work, but they are not guaranteed to do so. Use the following settings to set up your National Instru­ments Card (AT-GPIB card listed here; use all that are applicable) when you are conÞguring GPIB.COM with IBCONF.EXE.
Primary GPIB Address............................................. 0
Secondary GPIB Address ........................................ NONE
Timeout setting......................................................... T10s
EOS byte..................................................................... 0AH
Terminate Read on EOS ........................................... no
Set EOI with EOS on Write...................................... yes
Type of compare on EOS ......................................... 7-bit
Set EOI w/last byte of Write ................................... yes
System Controller..................................................... yes
Assert REN when SC ............................................... yes
Enable Auto Serial Polling ...................................... no
Timing ........................................................................ 350nsec
Enable 488.2 Protocols ............................................. yes
CIC Protocol .............................................................. no
Disable Device Unaddressing................................. no
1.1.2 Capital Equipment Corporation
You must have Rev 2.14 or later of the Capitial Equipment Corp. software to use the Model 2001/7001 Support Software. All older revisions will not work without the removal of SETATNMODE() from SetupIEEE%() in CECQBX.BAS for BASIC 7.1 or in CEC.BAS for QuickBASIC 4.5.
1.1.3 IOTech Driver 488
You must have Rev 2.6 or later of the IOTech Driver 488 software to use the Model 2001/7001 Support Soft­ware. Some older revisions may work, but they are not guaranteed to do so.
1.1.4 Microsoft BASIC 7.1
Type A:INSTALL or B:INSTALL to install the Microsoft BASIC 7.1 Model 2001/7001 support software. The installation program will prompt you for certain information to copy Þles and build the make Þles MAKECEC.BAT, MAKEIOT.BAT, MAKENAT1.BAT, and MAKENAT2.BAT. These Þles will build the *.OBJ, *.LIB, *.QLB, and *.EXE Þles needed to use the routines.
7
Installation Notes:
1. BC.EXE, LINK.EXE, and LIB.EXE must be installed in the BASIC 7.1 Compiler Directory.
2. NMAKE.EXE must be installed in the NMAKE Directory.
3. BCL71EFR.LIB, DTFMTER.LIB, QBXQLB.LIB, QBX.LIB and IEEE488.LIB (if installing CEC) must re­side in the Library Files Directory.
4. FORMAT.BI, MOUSE.BI, MENU.BI, and MOUSE.BI must reside in the Include Files Directory.
5. The Model 2001/7001 Support Software Directory must exist, and you will be prompted to make it if it does not.
1.1.5 QuickBASIC 4.5
Type A:INSTALL or B:INSTALL to install the QuickBASIC 4.5 Model 2001/7001 support software. The in­stallation program will prompt you for certain information to copy Þles and build the make Þles MAKECEC.BAT, MAKEIOT.BAT, MAKENAT1.BAT, and MAKENAT2.BAT. These Þles will build the *.OBJ, *.LIB, and *.QLB Þles needed to use the routines.
Installation Notes:
1. BC.EXE, LINK.EXE, and LIB.EXE must be installed in the QuickBASIC 4.5 Compiler Directory.
2. BQLB45.LIB and IEEEQB.LIB (if installing CEC) must reside in the Library Files Directory.
3. The Model 2001/7001 Support Software directory must exist, and you will be prompted to make it if it does not.
1.2 General Instructions
1.2.1 Microsoft BASIC 7.1
To use a Quick Library in BASIC 7.1, start by issuing at the DOS prompt:
QBX /Lcecqbx.qlb to use CEC QBX /Liotqbx.qlb to use IOTech QBX /Lnatqbx1.qlb to use NI-488 QBX /Lnatqbx2.qlb to use NI-488.2
In your program, use Ô$INCLUDE:Õ20017001.BIÕ which contains the Model 2001/7001 library function def­initions and CONSTants OR use Ô$INCLUDE:Õ2001DEMO.BIÕ to use the BASIC 7.1 User Interface routines (WINDOW.BAS, MOUSE.BAS, MENU.BAS, GENERAL.BAS, UIASM.OBJ, and QBX.LIB), which are in­cluded in the libraries and quick-libraries. A sample setup follows:
Ô To use the BASIC 7.1 Windowing and Menu capabilities use:
Ô$INCLUDE:Õ2001DEMO.BIÕ MenuInit Ô Initialize Menu system (also initializes mouse with MouseInit) WindowInit Ô Initializes Windowing system MouseShow Ô Reveal mouse cursor SetupErr%=SetupIEEE%(0,0) Ô Setup IEEE interface SetupErr%=SetupIEEE%(2001,16) Ô Setup Model 2001 at IEEE address 16 SetupErr%=SetupIEEE%(7001,7) Ô Setup Model 7001 at IEEE address 7 Ô
8
Ô User Program Follows Ô Ô OR: (No Windowing or pop-up error messages) Ô (SEE QuickBASIC 4.5 Example) Ô
Note: When using the National Instruments NI-488 rev C.10 or C.11 interface with BASIC 7.1, the following ibxxx commands are unavailable:
ibrdi, ibrdia, ibwrti, ibwrtia, ilrdi, ilrdia, ilwrti, and ilwrtia.
Also, note that the ibÞnd and ibdev subroutines are now functions like ilÞnd% and ildev%. These limita­tions result from the BASIC 7.1 to Quick C link to support far strings in BASIC 7.1 which are not supported by National Instruments in their older NI-488 drivers (rev C.11 or older). To use the entire line of ibxxx com­mands, National Instruments suggests upgrading to the latest NI-488 driver (rev C.14 as of the time of this printing) and using the NI-488.2/NI-488 rev C.12 or newer Model 2001/7001 Support Software.
1.2.2 QuickBASIC 4.5
To use a Quick Library in QuickBASIC 4.5, start by issuing at the DOS prompt:
QB /Lcec.qlb to use CEC QB /Liotech.qlb to use IOTech QB /Lnat488_1.qlb to use NI-488 QB /Lnat488_2.qlb to use NI-488.2
In your program, use Ô$INCLUDE:Õ20017001.BIÕ , which contains the Model 2001/7001 library function def­initions and CONSTants. A sample setup follows:
Ô$INCLUDE:Õ20017001.BIÕ CONST TRUE = -1 CONST FALSE = 0 SetupErr%=SetupIEEE%(0,0) Ô Setup IEEE interface SetupErr%=SetupIEEE%(2001,16) Ô Setup Model 2001 at IEEE address 16 SetupErr%=SetupIEEE%(7001,7) Ô Setup Model 7001 at IEEE address 7 Ô Ô User Program Follows Ô
1.2.3 Documentation Notes
1. All functions in this document use QuickBASIC 4.5 type cast notation (% Ñ integer, $ Ñ String, etc.).
2. Query forms of a function have the format of function-nameQ$ , which returns a query string containing the results of the speciÞed Model 2001/7001 parameters. Automatic values are returned as 0 for OFF and 1 for ON.
3. If a function query returns more than one parameter, the responses will be separated by a semi-colon (;) within the return string. Use the ParseQuery$ routine to return the speciÞed response string (parameter number 1, 2, 3, etc.) from the query return string.
9
4. Any Model 2001/7001 command parameters out of range will not be sent to the instrument, leaving the previously set or default values in tact. Also, the global variable, OutOfRange% , will be set to TRUE (-1).
5. Most Model 2001/7001 parameters that are double precision values will accept the constants MAXI­MUM, MINIMUM, and DEFAULT. INF will be accepted for Trigger Model Count1# and Count2# pa­rameters.
6. All example programs assume that QuickBASIC 4.5 or BASIC 7.1 setup commands listed above were used before issuing any commands.
7. All string parameters that have their valid parameters listed with mixed case, like IMMediate, accept either the short form (IMM) or the long form (IMMEDIATE) in any combination of case. This is compa­rable to the short and long form notation used for SCPI commands.
8. See Appendix A for a description of the Global Variables used in the Model 2001/7001 support soft­ware.
9. See Appendix B for a description the deÞned CONSTants used in the Model 2001/7001 support soft­ware.
10. See Appendix C for a list of all QuickBASIC 4.5 and BASIC 7.1 Þle names used by the Model 2001/7001 support software.
10
Section 2
Model 2001 / 7001 IEEE-488 Interface Routines
These functions and subroutines control the Models 2001/7001 with low-level IEEE-488 bus commands speciÞc to each IEEE-488 interface manufacturer. If any IEEE-488 timeout errors occur, an error message will be displayed. For BASIC 7.1 the WindowInit command must be issued at start up to see the messages. Also, the TimeOutError% global variable (see Global Variables in Appendix A) will be set TRUE.
NOTE
These functions and subroutines also support the Model 7002 Switch System. Just send Model 7001 commands to a Model 7002.
2.1 FUNCTION SetupIEEE%(Device%, Address%)
Description
Sets up the speciÞc IEEE-488 interface to correctly handle data transfers between the Models 2001/7001 and the host PC computer. Also, initializes either the 2001 or 7001 at the speciÞed addresses. CEC controllers will be at IEEE address 21. IOTech controllers are usually at IEEE address 21. National Instruments controllers are usually at IEEE address 0.
Parameters
Device%
0 Initialize Interface Only 2001 Change the IEEE address of the Model 2001 only 7001 Change the IEEE address of the Model 7001 only
Address%
0-30 if Device% is Model 2001 or 7001 ignored if Device% is 0
Returns
TRUE (-1) if a TimeOutError occurred or a parameter is OutOfRange.
Global V ariables Affected (see Global Variables Appendix A) :
KI2001%, KI7001%, TimeOutError%, OutOfRange%, IeeeInterface% brd0%, Nat2001Addr%, Nat7001Addr% (NatÕl. Instruments only) IeeeIn%, IeeeOut% (IOTech Driver 488 only)
Example
Before using any of the Model 2001 routines, the following commands must be issued:
11
Ô$INCLUDE:Õ20017001.BIÕ SetupErr%=SetupIEEE%(0,0) Ô Setup IEEE interface SetupErr%=SetupIEEE%(2001,16) Ô Setup Model 2001 at IEEE address 16 SetupErr%=SetupIEEE%(7001,7) Ô Setup Model 7001 at IEEE address 7
2.2 SUB SendSDC2001
SUB SendSDC7001
Description
Sends the IEEE bus command SDC (Selected Device Clear) to the Model 2001/7001.
Global V ariables Affected (see Global Variables in Appendix A)
TimeOutError%
2.3 FUNCTION Q2001$(Cmd$)
FUNCTION Q7001$(Cmd$)
Description
Gets a query response from the Model 2001/7001. Cmd$ must be a valid Model 2001/7001 query or else the instrument will TimeOut. Multiple queries are allowed, and responses can be separated using the ParseQuery$ function. If Cmd$=ÓÓ, then the function will still try to read data from the instrument. This feature is good for reading large amounts of data from the Model 2001/7001 since the most that can be read at one time is 2048 bytes.
Parameters
Cmd$
Ò Ò try to read the Model 2001/7001 <> Ò Ò send query and try to read Model 2001/7001
Returns
Query response from the Model 2001/7001 if Cmd$ was valid. ÒError!Ó if Cmd$ not valid (i.e., a timeout error occurred).
12
Global V ariables Affected
TimeOutError%, Resp$
Example
Ô BASIC 7.1 or QB45 setup commands called before here A$ = Q2001$(ÒVOLT:DC:RANGE?Ó) Ô return DC Voltage Range
2.4 SUB Send2001(Cmd$)
SUB Send7001(Cmd$)
Description
Sends IEEE-488.2 and SCPI command strings to the Model 2001/7001.
Parameters
Cmd$ Valid Model 2001/7001 488.2 or SCPI command or query.
Returns
Nothing
Must check the Model 2001/7001 EAV bit in the serial poll register to see if a command was accepted, or look at the front panel of the instrument for an error message.
Global V ariables Affected (see Global Variables in Appendix A)
TimeOutError%, OutOfRange%
Example
Ô BASIC 7.1 or QB45 setup commands called before here Send7001 ÒROUTE:CLOSE (@1!1:1!40)Ó ÔClose channels 1-40 on card 1 of Model 7001
2.5 SUB SendGET2001
SUB SendGET7001
Description
Sends the IEEE bus command GET to the Model 2001/7001.
Global V ariables Affected (see Global Variables in Appendix A)
TimeOutError%
Example
Ô BASIC 7.1 or QB45 setup commands called before here SendGET2001 Ô Trigger the Model 2001 to take reading Reading$ = Q2001$(ÒDATA?Ó) Ô Get Model 2001 reading
13
2.6 FUNCTION Wait2001RQS%
FUNCTION Wait7001RQS%
Description
Waits for the Model 2001/7001 to generate a Request for Service. The routine serial polls the Model 2001/ 7001 to verify that the instrument is indeed generating a Request for Service. The wait can be aborted by pressing the Esc key (QuickBASIC 4.5 and BASIC 7.1) or the right mouse button (BASIC 7.1 only).
Returns
FALSE (0) - if aborted. TRUE (-1) - if a Model 2001/7001 Request for Service.
Example
Ô BASIC 7.1 or QB45 setup commands called before here Poll% = Poll2001% Ô Clear and pending SRQÕs SRE2001 MAV Ô Set up to SRQ on MAV Send2001 ÒFETCH?Ó Ô Fetch a Model 2001 reading DO Ô Set up an uninterruptable wait LOOP UNTIL Wait2001RQS% Reading$ = Q2001$(ÒÒ) Ô Get reading
14
Section 3
Model 2001 Buffer Routines
These routines are used to acquire readings in the Model 2001Õs data buffer. Up to 30,092 readings can be stored in the Model 2001 with the MEM2 option and the compact format.
All routines will set the Global Variable TimeOutError% if an IEEE-488 Timeout error occurs. Functions that have bounded parameters (maximum and/or minimum parameters) will set the Global Variable OutOfRange% if a parameter is not within the limits speciÞed (see Global Variables in Appendix A).
3.1 FUNCTION BufferSize2001%
Description
Finds the actual number of data points in the Model 2001 buffer. This function should be used since TRACe:POINts? may not return the correct number of data points if the data buffer acquisition was aborted.
Returns
The actual number of data points in the Model 2001 buffer (anywhere from 2 to 30,092) depending on the memory conÞguration of the Model 2001 being used.
Example
Ô BASIC 7.1 or QB45 setup commands called before here NumPoints% = BufferSize2001% Ô Read Back Readings in double precision DIM BufferData#(1 to NumPoints%) NumPoints% = Read2001BufferD%(BufferData#(), 0, BUFRDGS)
3.2 FUNCTION Take2001BufferReadings% (Func%, BurstMode%,
NumDataPoints1%, Compact%)
Description
Sets up and acquires up to 30,092 readings in the Model 2001Õs data buffer. (Use with Read2001BufferS% or Read2001BufferD% to read data). The data acquisition may be aborted by pressing Esc (QuickBASIC or BA­SIC 7.1) or by pressing the right mouse button (BASIC 7.1 Only).
Parameters
Func%, (also, see Function Constants, Appendix B)
0 Ñ Current Function 1 Ñ DCV 2 Ñ ACV
15
3 Ñ DCA 4 Ñ ACA 5 Ñ 2-wire Resistance 6 Ñ 4-wire Resistance 7 Ñ Frequency 8 Ñ Temperature
BurstMode%
If TRUE (non-zero), uses the fast Burst Mode of Reading acquisition available from the Model 2001. Burst­Mode is only applicable if Func% is 1 to 5.
NumDataPoints1%
2 to TRACE:POINTS? MAX (depends on the setting of Compact% and the memory option installed in the Model 2001).
Compact%
TRUE (non-zero) Ñ use the COMPACT buffer format (readings only). FALSE (zero) Ñ use the FULL buffer format (reading, time stamp, channel number, status, and units).
NOTE
The COMPACT format allows Þve times as many readings as does FULL. If BurstMode% is set, only COMPACT format is valid.
Returns
The actual number of data points read from the Model 2001. If zero, then either a TimeOutError occurred or an OutOfRange error occurred for Func% or NumDataPoints% < 2.
Example
Ô BASIC 7.1 or QB45 setup commands called before here Ô Take 2000 DC Volt Burst Mode Readings: NumPoints% = Take2001BufferReadings%(DCV, TRUE, 2000, TRUE) Ô Read Back data in Single Precision Format: DIM BufferData!(1 to NumPoints%) NumPoints%=Read2001BufferS%(BufferData!(), 0, BUFRDGS)
3.3 FUNCTION Read2001BufferS% (ArrayName!(), DMA%, Fmt%)
FUNCTION Read2001BufferD% (ArrayName#(), DMA%, Fmt%)
16
Description
Retrieves all of the readings (up to 29,908 IEEE754 single or double precision readings) from the Model 2001Õs data buffer and stores them into a single or double precision array.
Parameters
ArrayName!, ArrayName#
Single or double precision array dimensioned large enough to handle the number of data points returned by BufferSize2001% or Take2001BufferReadings%.
DMA%
0 DonÕt use DMA 1 Use DMA (IOTech or National Instruments) 1-7 Use DMA channel conÞgured on CEC IEEE-488 Interface card
Fmt%
1 Return Readings (FULL or COMPact Format) 2 Return TimeStamp (Full Format only) 3 Return Channel (Full Format only) 4 Return Status (Full Format only) 5 Return Units (Full Format only)
Also, see Read2001BufferS% and Read2001BufferD% Constants in Appendix B.
Returns
The actual number of data points transferred to the array. If zero, then either a TimeOutError occurred, an OutOfRange error occurred, or ArrayName!() or ArrayName#() is dimensioned too small.
Example
Ô BASIC 7.1 or QB45 setup commands called before here Ô Take 5000 AC Volt Full Format Mode Readings: NumPoints% = Take2001BufferReadings%(ACV,FALSE,5000,FALSE) Ô Read Back Readings and TimeStamp in double precision DIM BufferData#(1 to NumPoints%), Times#(1 to NumPoints%) NumPoints%=Read2001BufferD%(BufferData#(), 0, BUFRDGS) NumPoints%=Read2001BufferD%(Times#(), 0, BUFTIMESTAMP) DataViewD BufferData#(), NumPoints%
17
18
Section 4
General Routines
These routines provide data display, graphing, and data manipulating functions that make the handling of the returned data from the Models 2001 and 7001 easier to handle.
NOTE
These functions and subroutines also support the Model 7002 Switch System. Just send Model 7001 commands to a Model 7002.
All functions that have bounded parameters (maximum and/or minimum parameters) will set the Global Variable OutOfRange% if a parameter is not within the limits speciÞed (see Global Variables in Appendix A).
4.1 FUNCTION ParseQuery$(Quer$, QuerNum%)
Description
Returns the query speciÞed by QuerNum inside Quer$. Queries are separated either by commas or semi­colons. Also, leading and trailing spaces are removed.
Parameters
Quer$ A string returned by any of the Model 2001/7001 query functions. QuerNum% The number of the query to retrieve
Returns
ÒError!Ó if Quer$ = ÒÒ, ÒInvalid Query Number.Ó if QuerNum% <= 0, QuerNum% query in Quer$, or last query if QuerNum% is too large
Example
Ô BASIC 7.1 or QB45 setup commands called before here A$ = Ò100; FFF; oii, 4423.223; 4,000Ó B$ = ParseQuery$(A$, 1) Ô B$ = Ò100Ó B$ = ParseQuery$(A$, 2) Ô B$ = ÒFFFÓ B$ = ParseQuery$(A$, 3) Ô B$ = ÒoiiÓ B$ = ParseQuery$(A$, 4) Ô B$ = Ò4423.223Ó B$ = ParseQuery$(A$, 5) Ô B$ = Ò4Ó B$ = ParseQuery$(A$, 6) Ô B$ = Ò000Ó B$ = ParseQuery$(A$, 7) Ô B$ = Ò000Ó B$ = ParseQuery$(A$, 0) Ô B$ = ÒInvalid Query Number.Ó
19
4.2 FUNCTION Str1$(DoubleNumber#)
Description
Returns a string representation of a double precision number with an E in the exponent instead on a D, if DoubleNumber# is large or small enough to be displayed in exponential format.
Parameters
DoubleNumber# Any valid double precision number
Returns
Double-precision mantissa, E, then exponent, or; Double-precision number
Example
Ô BASIC 7.1 or QB45 setup commands called before here A$ = Str1$(9.9d34) Ô A$ = Ò9.9E+34Ó
4.3 FUNCTION IOTECH$(Address%)
Description
Returns a two-digit number string with a leading 0 for use with IOTechÕs IEEE Addressable commands.
Parameters
Address% 0 to 30 Returns: Ò00Ó,Ó01Ó,..,Ó09Ó,Ó10Ó,Ó11Ó,..,Ó30Ó
Example
Ô BASIC 7.1 or QB45 setup commands called before here PRINT #1, ÒOUTPUT Ò+IOTECH$(9)
4.4 SUB XYGraphS(XArray!(), YArray!(), YStart%, YStop%, XTitle$, YT itle$,
Title$, UseCGA2%, MaxMinScale%) SUB XYGraphD(XArray#(), YArray#(), YStart%, YStop%, XTitle$, YT itle$,
Title$, UseCGA2%, MaxMinScale%)
Description
20
Produces a simple X and Y auto-scaled graph using single (XYGraphS) or double (XYGraphD) precision da­ta. These routines will plot YArray versus XArray if the size of the two arrays are equal. If they are not the same, only the YArray is plotted versus its corresponding data point number. Use YStart and YStop to zoom in on a particular area of the graph. Both the X and Y axes are scalable to the maximum and minimum of the arrays within the speciÞed YStart and YStop interval.
Parameters
XArray!() Single-precision X-axis data array XArray#() Double-precision X-axis data array YArray!() Single-precision Y-axis data array YArray#() Double-precision Y-axis data array YStart% First Y data point to plot YStop% Last Y data point to plot XTitle$ X-axis Title YTitle$ Y-axis Title Title$ Graph Title UseCGA2% If non-zero, use CGA 640x200 mode so that GRAPHICS.COM can do a screen dump. MaxMinScale% If non-zero, scale to the minimum and maximum values of the Y-axis data. This has an
effect only if all of the data points are the same sign.
Example
Ô BASIC 7.1 or QB45 setup commands called before here NumPoints% = Take2001BufferReadings%(ACV,FALSE,5000,FALSE) DIM BufferData#(1 to NumPoints%), Times#(1 to NumPoints%) NumPoints%=Read2001BufferS%(BufferData#(), 0, BUFRDGS) NumPoints%=Read2001BufferD%(Times#(), 0, BUFTIMESTAMP) Ô Plot AC Voltage vs. Time scaled to AC Data XYGraphD BufferData#(), Times#(), 1, NumPoints%, ÒTime (sec)Ó, ÒAC Voltage (Vrms)Ó, ÒAC Voltage vs. TimeÓ, FALSE, TRUE
4.5 SUB DataViewS(DataArray!(), NumDataPoints%)
SUB DataViewD(DataArray#(), NumDataPoints%)
Description
Views a single or double precision array, DataArray, NumDataPoints long using PageUp, PageDn, Home, End, and the Arrow keys. Pressing Esc aborts the data display (QuickBASIC 4.5 and BASIC 7.1) as does clicking the right mouse button (BASIC 7.1 only).
Parameters
DataArray!() Single precision data array to display DataArray#() Double precision data array to display NumDataPoints% Number of data points to display. If zero or more than the number of points actually
in the array, display whole array.
Returns
NumDataPoints% with the maximum number of data points in the array if NumDataPoints% was original­ly a variable and was 0 or larger than the number of points in the array.
Example
Ô BASIC 7.1 or QB45 setup commands called before here
21
NumPoints% = BufferSize2001% Ô Read Back Readings in double precision DIM BufferData#(1 to NumPoints%) NumPoints% = Read2001BufferD%(BufferData#(), 0, BUFRDGS) Ô View all Data Buffer Readings DataViewD BufferData#(), NumPoints%
4.6 FUNCTION AutoGraphicsMode% (NumYPixels%, NumTextRows%,
UseCGA2%)
Description
Automatically detects the best available 80 Column Text graphics mode. Graphics Driver Order of Prece­dence:
SCREEN MODE NumXPixels NumYPixels NumTextCols NumTextRows
11 (VGA) 640 480 80 60 10 (EGA) 640 350 80 43 9 (EGA) 640 350 80 43 8 (EGA) 640 200 80 25 2 (CGA) 640 200 80 25
Parameters
UseCGA2%
TRUE (non-zero) Ñ forces Screen Mode 2. FALSE Ñ Automatically detect highest resolution NumYPixels% Ñ must be a variable name NumTextRows% Ñ must be a variable name
Returns
Screen Mode used. NumYPixels in NumYPixels% if NumYPixels% is a variable. NumTextRows in NumTextRows% if NumTextRows% is a variable.
Example
Ô BASIC 7.1 or QB45 setup commands called before here Ô Given: a PC with a VGA monitor Mode% = AutoGraphicsMode%(NumYPixels%, NumTextRows%, FALSE) Ô Mode% = 11, NumYPixels% = 480, NumTextRows% = 60
22
Section 5
General Model 2001 / 7001 Routines
The following routines perform some extra functions that are not in the Model 2001/7001 and manipulate the Model 2001/7001Õs front panel.
NOTE
These functions and subroutines also support the Model 7002 Switch System. Just send Model 7001 commands to a Model 7002.
All of these routines will set the Global Variable TimeOutError% if an IEEE-488 Timeout Error occurs. Func­tions that have bounded parameters (maximum and/or minimum parameters) will set the Global Variable OutOfRange% if a parameter is not within the limits speciÞed (see Global Variables in Appendix A).
5.1 SUB Set2001Function(Func%)
Description
Puts the Model 2001 into the speciÞed measurement function.
Parameters
Func% (1-8) see Function Constants, Appendix B.
Example
Ô BASIC 7.1 or QB45 setup commands called before here Ô All three of the following put the Model 2001 in AC Volts: Set2001Function ACV ACV2001 Send2001 ÒFUNC ÔVOLT:ACÕÓ
5.2 FUNCTION Get2001Units$(Func%)
Description
Gets the proper Model 2001 units for the function speciÞed.
Parameters
Func% 1-8, see Function Constants, Appendix B.
23
Returns
ÒError!Ó if a TimeOutError occurred, or Func% = 1 (DC Volts): ÒVDC Ò Func% = 2 (AC Volts):
<5-character string> + <0-4 character string>, where: <5-character string> = Ò dB Ò, Ò dBm Ò, or ÒVAC Ò
<0-4 character string> = ÒÒ, ÒAvgÓ, ÒPeakÓ, Ò+PkÓ, Ò- PkÓ, or ÒRMSÓ Func% = 3 (DC Current): ÒADCÓ or ÒADC ICktÓ Func% = 4 (AC Current): ÒAAC AvgÓ or ÒAAC RMSÓ Func% = 5 (2-wire Resistance): Ò2WÓ or Ò2W OcmpÓ Func% = 6 (4-wire Resistance): Ò4WÓ or Ò4W OcmpÓ Func% = 7 (Frequency): ÒHzÓ Func% = 8 (Temperature): Ò¡FÓ, Ò¡CÓ, or Ò KÓ
Example
Ô BASIC 7.1 or QB45 setup commands called before here Send2001 Ò*RSTÓ Ô AC Voltage with the detector set to RMS will Ô return ÒVAC RMSÓ A$ = Get2001Units$(ACV)
5.3 FUNCTION Get2001SaveRecallSize%
Description
Finds the number of Model 2001 Save/Recall (*SAV, *RCL) locations available for storing Model 2001 con­Þgurations.
Returns
Model 2001 Option SaveRecallSize
2001 2001/MEM1 2001/MEM2
Example
Ô BASIC 7.1 or QB45 setup commands called before here Ô Model 2001 with MEM1 option Ô RecNum% = number of setup location to recall IF RecNum% < Get2001SaveRecallSize% AND RecNum% >= 0 THEN
Send2001 Ò*RCLÓ + STR$(RecNum%)
ELSE
PRINT ÒRecall Number is too large!Ó
ENDIF
1 5 10
24
5.4 FUNCTION Get2001FuncHeader$(Func%)
Description
Returns the proper SENSe subsystem SCPI Header string for the function speciÞed.
Parameters
Func% (1-8) see Function Constants, Appendix B.
Returns
Func% Returns
1 VOLT:DC: 2 VOLT:AC: 3 CURR:DC: 4 CURR:AC: 5 RES: 6 FRES: 7 FREQ: 8 TEMP:
Example
Ô BASIC 7.1 or QB45 setup commands called before here A$ = Get2001FuncHeader$(DCV) Ô A$ = ÒVOLT:DC:Ó
5.5 FUNCTION Get2001Func%
Description
Finds the present Model 2001 Function
Returns
The Model 2001 function number from 1 to 8 as speciÞed by the Function Constants, Appendix B.
Example
Ô BASIC 7.1 or QB45 setup commands called before here DCV2001 Func% = Get2001Func% Ô Put Model 2001 in DC Volts mode Ô Func% = 1, which is the CONSTant DCV
25
5.6 FUNCTION Check2001Val$(CheckVal#, MinVal#, MaxVal#,
CheckMinInf%)
Description
Checks a given double precision value (CheckVal#) against the given minimum allowed value (MinVal#) and the maximum allowed value (MaxVal#). It is used internally by the Model 2001/7001 routines to check parameter ranges.
Parameters
CheckVal# Any double precision value or one of the following constants:
INF = 9.9D+37 MINIMUM = 9.8D+37 MAXIMUM = 9.7D+37 DEFAULT = 9.6D+37
CheckMinInf%
0 Ñ DonÕt check for MINIMUM, MAXIMUM, DEFAULT, or INF 1 Ñ Check for MINIMUM, MAXIMUM, or DEFAULT 2 Ñ Check for MINIMUM, MAXIMUM, DEFAULT, or INF
Associated constants: CHECKNONE = 0
CHECKMINMAX = 1 CHECKINF = 2
Returns
A null string and sets OutOfRange global variable to TRUE (-1) if CheckVal# is out of range An ASCII string representation of CheckVal# if in range ÒMAXÓ, ÒMINÓ, ÒDEFÓ, or ÒINFÓ if CheckVal# is equivalent to one of the constants above.
Example
Ô BASIC 7.1 or QB45 setup commands called before here Ô Checks for a value to be between 100# an 1000# inclusive Value$ = Check2001Val$(MINIMUM, 100#, 1000#, CHECKMINMAX) Ô Value$ = ÒMINÓ
5.7 SUB Hit2001Key(HitKey%)
Description
Presses the speciÞed Model 2001 front panel key using SYSTEM:KEY.
Parameters
HitKey% 1-23, 26-31 (OutOfRange% set and does nothing otherwise)
26
Loading...
+ 239 hidden pages