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
6.3DC Voltage Functions................................................................................................................................ 33
6.4AC Voltage Functions................................................................................................................................. 35
6.5DC Current Functions................................................................................................................................ 37
B.2Status Model Constants ............................................................................................................................. 75
You must have Rev C.10 or later of the National Instruments NI-488 Software or Rev 1.0 or later of the National 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 Instruments Card (AT-GPIB card listed here; use all that are applicable) when you are conÞguring GPIB.COM
with IBCONF.EXE.
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 Software. 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 reside 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 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, 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.2General 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.qlbto use CEC
QBX /Liotqbx.qlbto use IOTech
QBX /Lnatqbx1.qlbto use NI-488
QBX /Lnatqbx2.qlbto use NI-488.2
In your program, use Ô$INCLUDE:Õ20017001.BIÕ which contains the Model 2001/7001 library function definitions 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 included 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 limitations 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 commands, 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.qlbto use CEC
QB /Liotech.qlbto use IOTech
QB /Lnat488_1.qlbto use NI-488
QB /Lnat488_2.qlbto use NI-488.2
In your program, use Ô$INCLUDE:Õ20017001.BIÕ, which contains the Model 2001/7001 library function definitions 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 MAXIMUM, MINIMUM, and DEFAULT. INF will be accepted for Trigger Model Count1# and Count2# parameters.
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 comparable 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 software.
9. See Appendix B for a description the deÞned CONSTants used in the Model 2001/7001 support software.
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.1FUNCTION 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%
0Initialize Interface Only
2001Change the IEEE address of the Model 2001 only
7001Change the IEEE address of the Model 7001 only
Address%
0-30if Device% is Model 2001 or 7001
ignoredif Device% is 0
Returns
TRUE (-1) if a TimeOutError occurred or a parameter is OutOfRange.
Global V ariables Affected (see Global Variables Appendix A) :
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.2SUB 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.3FUNCTION 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.4SUB 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.5SUB 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.6FUNCTION 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.1FUNCTION 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)
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 BASIC 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. BurstMode 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)
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%
0DonÕt use DMA
1Use DMA (IOTech or National Instruments)
1-7Use DMA channel conÞgured on CEC IEEE-488 Interface card
Fmt%
1Return Readings (FULL or COMPact Format)
2Return TimeStamp (Full Format only)
3Return Channel (Full Format only)
4Return Status (Full Format only)
5Return 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.1FUNCTION ParseQuery$(Quer$, QuerNum%)
Description
Returns the query speciÞed by QuerNum inside Quer$. Queries are separated either by commas or semicolons. 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
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.3FUNCTION 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)
Produces a simple X and Y auto-scaled graph using single (XYGraphS) or double (XYGraphD) precision data. 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.5SUB 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 originally 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%
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. 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).
5.1SUB 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.2FUNCTION 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.3FUNCTION Get2001SaveRecallSize%
Description
Finds the number of Model 2001 Save/Recall (*SAV, *RCL) locations available for storing Model 2001 conÞgurations.
Returns
Model 2001 OptionSaveRecallSize
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.4FUNCTION Get2001FuncHeader$(Func%)
Description
Returns the proper SENSe subsystem SCPI Header string for the function speciÞed.
Ô BASIC 7.1 or QB45 setup commands called before here
A$ = Get2001FuncHeader$(DCV) Ô A$ = ÒVOLT:DC:Ó
5.5FUNCTION 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
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:
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.7SUB 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
DeÞned keys are as follows:
UPKEY = 1TEMPKEY = 2LEFTKEY = 3
Ô BASIC 7.1 or QB45 setup commands called before here
Hit2001Key AUTOKEYÔ Hit Auto Range key on Model 2001
5.8SUB Disp2001(line1$, line2$)
SUB Disp7001(line1$, line2$)
Description
Immediately displays line1$ on the Þrst line and line2$ on the second line of the Model 2001/7001Õs display.
Parameters
Line1$maximum of 20 characters
Line2$maximum of 32 characters
Returns
Line1$ truncated to 20 characters if line1$ is a variable name.
Line2$ truncated to 32 characters if line2$ is a variable name.
Example
Ô BASCI 7.1 or QB45 setup commands called before here
Line1$ = Ò2001/7001 Support SoftwareÓ
Disp2001 Line1$,Ó(c) 1992 Keithley InstrumentsÓ
Ô Line1$ now = Ò2001/7001 Support SoÓ
NoDisp2001Ô turn off user display
5.9SUB NoDisp2001
SUB NoDisp7001
Description
Turns off the userÕs displayed messages on the Model 2001/7001.
27
28
Section 6
Model 2001 SENSe[1] Subsystem Commands
All of these 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, Appendix A).
See Model 2001 Minimum and Maximum Sense Constants in Appendix B for CONSTants for use with the
Model 2001 SENSe[1] Subsystem commands.
6.1Model 2001 Function Change Subroutines
Theses subroutines change the present function of the Model 2001.
6.1.1 SUB DCV2001
Description
Puts Model 2001 into DC Volts mode.
Example
Ô BASIC 7.1 or QB45 setup commands called before here
Ô All three of the following put the Model 2001 in DC Volts:
DCV2001
Set2001Function DCV
Send2001 ÒFUNC ÔVOLT:DCÕÓ
6.1.2 SUB ACV2001
Description
Puts Model 2001 into AC Volts mode.
6.1.3 SUB DCA2001
Description
Puts Model 2001 into DC Current mode.
29
6.1.4 SUB ACA2001
Description
Puts Model 2001 into AC Current mode.
6.1.5 SUB RES2.2001
Description
Puts Model 2001 into 2-wire Resistance mode.
6.1.6 SUB RES4.2001
Description
Puts Model 2001 into 4-wire Resistance mode.
6.1.7 SUB FREQ2001
Description
Puts Model 2001 into Frequency mode.
6.1.8 SUB TEMP2001
Description
Puts Model 2001 into Temperature mode.
6.2Return Model 2001 Reading Functions
Theses subroutines return the latest reading on the speciÞed function of the Model 2001. All routines use
the SCPI command, MEASure:(FunctionName)?, except Get2001Rdg$ which uses the SCPI command,
ÒFETCh?Ó.
6.2.1 FUNCTION Get2001Rdg$
Description
FETCHes a Model 2001 reading in the present Mode and FORMat.
30
Returns
ÒError!Ó if a TimeOutError occurred, or Reading String.
Example
Ô BASIC 7.1 or QB45 setup commands called before here
Ô The following two statements are equivalent:
A$ = Get2001Rdg$
B$ = Q2001$(ÒFETCH?Ó)
6.2.2 FUNCTION GetDCV2001$
Description
Gets a Model 2001 DC Volts Reading
Returns
ÒError!Ó if a TimeOutError occurred, or DC Volts Reading String.
Example
Ô BASIC 7.1 or QB45 setup commands called before here
Ô The following two statements are equivalent:
A$ = GetDCV2001$
B$ = Q2001$(ÒMEASURE:VOLT:DC?Ó)
6.2.3 FUNCTION GetACV2001$
Description
Gets a Model 2001 AC Volts Reading
Returns
ÒError!Ó if a TimeOutError occurred, or AC Volts Reading String.
6.2.4 FUNCTION GetDCA2001$
Description
Gets a Model 2001 DC Current Reading
Returns
ÒError!Ó if a TimeOutError occurred, or DC Current Reading String.
31
6.2.5 FUNCTION GetACA2001$
Description
Gets a Model 2001 AC Current Reading
Returns
ÒError!Ó if a TimeOutError occurred, or AC Current Reading String.
6.2.6 FUNCTION Get2RES2001$
Description
Gets a Model 2001 2-wire Resistance Reading
Returns
ÒError!Ó if a TimeOutError occurred, or 2-wire Resistance Reading String.
6.2.7 FUNCTION Get4RES2001$
Description
Gets a Model 2001 4-wire Resistance Reading
Returns
ÒError!Ó if a TimeOutError occurred, or 4-wire Resistance Reading String.
6.2.8 FUNCTION GetFREQ2001$
Description
Gets a Model 2001 Frequency Reading
Returns
ÒError!Ó if a TimeOutError occurred, or Frequency Reading String.
6.2.9 FUNCTION GetTEMP2001$
Description
32
Gets a Model 2001 Temperature Reading
Returns
ÒError!Ó if a TimeOutError occurred, or Temperature Reading String.
6.3DC V oltage Functions
These functions setup and return the settings of the conÞgurable options of the Model 2001Õs DC Voltage
measurement function.
6.3.1 SUB Set2001DCV(Range#, Time#, Digits#)
Description
Sets the Model 2001Õs DC Voltage Range, Aperture Time, and Number of Digits.
Parameters
Range#
0 to +1100
MAXIMUM, MINIMUM, or DEFAULT
Time# (Aperture Time)
166.667e-6s to 166.666667e-3s (60Hz); 2e-4 to .2 (50Hz)
MAXIMUM, MINIMUM, or DEFAULT
Digits#
3.5 to 8.4999 (7.5-8.4999=>7.5d, 3.5-4.4999=>3.5d)
MAXIMUM, MINIMUM, or DEFAULT
Example
Ô BASIC 7.1 or QB45 setup commands called before here
Ô Set DC Voltage MAXIMUM range, 1 Power Line Cycle
Ô Integration, and 6-1/2 digits
Set2001DCV MAXIMUM, 1/60, 7
6.3.2 FUNCTION Set2001DCVQ$
Description
Queries the Model 2001 for its DC Voltage Range, Aperture Time, and Number of Digits settings.
Returns
ÒError!Ó if a TimeOutError occurred, or
Query 1: Range 0 to +1100
Query 2: Time: 166.667e-6 to .2
Query 3: Digits 4 to 8 (4=3.5d, 8=7.5d, etc.)
Use ParseQuery$ to separate return string into components.
33
Example
Ô BASIC 7.1 or QB45 setup commands called before here
A$ = Set2001DCVQ$Ô Get 2001 DC Voltage Settings
Range$ = ParseQuery$(A$, 1)Ô Extract Range setting
AperTime$ = ParseQuery$(A$, 2)Ô Extract Aperture Time
Digits$ = ParseQuery$(A$, 3)Ô Extract Number of Digits
6.3.3 SUB Auto2001DCV(AutoRange%, AutoTime%, AutoDigits%)
Description
Sets the Model 2001Õs DC Voltage Auto Range, Auto Time, and Auto Digits settings.
Parameters
AutoRange%, AutoTime%, AutoDigits%
-1 = DonÕt set, 0 = Off, +1 = On, +2 = Once
The following constants can also be used:
NO = -1, TOFF = 0, TON = +1, ONCE = +2
Example
Ô BASIC 7.1 or QB45 setup commands called before here
Ô Turn 2001Õs DC Voltage Auto Range ON, Time OFF,
Ô and Digits ONCE:
Auto2001DCV TON, TOFF, ONCE
6.3.4 FUNCTION Auto2001DCVQ$
Description
Queries the Model 2001 for its DC Voltage Auto Range, Auto Time, and Auto Digits settings.
Returns
ÒError!Ó if a TimeOutError occurred, or
Query 1: Auto Range: 1 or 0 (1=ON, 0=OFF)
Query 2: Auto Time: 1 or 0 (1=ON, 0=OFF)
Query 3: Auto Digits: 1 or 0 (1=ON, 0=OFF)
Use ParseQuery$ to separate return string into components.
34
Example
Ô BASIC 7.1 or QB45 setup commands called before here
A$ = Auto2001DCVQ$Ô Get 2001 DC Voltage Auto Settings
AutoRange$ = ParseQuery$(A$, 1)Ô Extract Auto Range setting
AutoTime$ = ParseQuery$(A$, 2)Ô Extract Auto Time
AutoDigits$ = ParseQuery$(A$, 3)Ô Extract Auto Digits
6.4AC V oltage Functions
These functions setup and return the settings of the conÞgurable options of the Model 2001Õs AC Voltage
measurement function.
6.4.1 SUB Set2001ACV(Range#, Time#, Digits#)
Description
Sets the Model 2001Õs AC Voltage Range, Aperture Time, and Number of Digits.
Parameters
Range#
0 to +775 (+1100 if Peak, +Peak or -Peak On) MAXIMUM, MINIMUM, or DEFAULT
Time# (Aperture Time)
166.667e-6s to 166.666667e-3s (60Hz); 2e-4 to .2 (50Hz) MAXIMUM, MINIMUM, or DEFAULT
Digits#
3.5 to 8.4999 (7.5-8.4999=>7.5d, 3.5-4.4999=>3.5d) MAXIMUM, MINIMUM, or DEFAULT
Example
Ô BASIC 7.1 or QB45 setup commands called before here
Ô Set AC Voltage MINIMUM range, 10 Power Line Cycle
Ô Integration, and 6½ digits
Set2001ACV MINIMUM, 1/6, 6.5
6.4.2 FUNCTION Set2001ACVQ$
Description
Queries the Model 2001 for its AC Voltage Range, Aperture Time, and Number of Digits settings.
Returns
ÒError!Ó if a TimeOutError occurred, or
Query 1: Range: 0 to +1100
Query 2: Time: 166.667e-6 to .2
Query 3: Digits: 4 to 8 (4=3.5d, 8=7.5d, etc.)
Use ParseQuery$ to separate return string into components.
35
Example
Ô BASIC 7.1 or QB45 setup commands called before here
A$ = Set2001ACVQ$Ô Get 2001 AC Voltage Settings
Range# = VAL(ParseQuery$(A$, 1))Ô Extract Range setting
AperTime# = VAL(ParseQuery$(A$, 2))Ô Extract Aperture Time
Digits# = VAL(ParseQuery$(A$, 3))Ô Extract Number of Digits
6.4.3 SUB Auto2001ACV(AutoRange%, AutoTime%, AutoDigits%)
Description
Sets the Model 2001Õs AC Voltage Auto Range, Auto Time, and Auto Digits settings.
Parameters
AutoRange%, AutoTime%, AutoDigits%
-1 = DonÕt set, 0 = Off, +1 = On, +2 = Once
The following constants can also be used:
NO = -1, TOFF = 0, TON = +1, ONCE = +2
Example
Ô BASIC 7.1 or QB45 setup commands called before here
Ô Turn Model 2001Õs AC Voltage Auto Range ON, Time OFF,
Ô and Digits unaffected:
Auto2001ACV TON, TOFF, NO
6.4.4 FUNCTION Auto2001ACVQ$
Description
Queries the Model 2001 for its AC Voltage Auto Range, Auto Time, and Auto Digits settings.
Returns
ÒError!Ó if a TimeOutError occurred, or
Query 1: Auto Range: 1 or 0 (1=ON, 0=OFF)
Query 2: Auto Time: 1 or 0 (1=ON, 0=OFF)
Query 3: Auto Digits: 1 or 0 (1=ON, 0=OFF)
Use ParseQuery$ to separate return string into components.
36
Example
Ô BASIC 7.1 or QB45 setup commands called before here
A$ = Auto2001ACVQ$Ô Get 2001 AC Voltage Auto Settings
AutoRange$ = ParseQuery$(A$, 1)Ô Extract Auto Range setting
AutoTime$ = ParseQuery$(A$, 2)Ô Extract Auto Time
AutoDigits$ = ParseQuery$(A$, 3)Ô Extract Auto Digits
6.5DC Current Functions
These functions setup and return the settings of the conÞgurable options of the 2001Õs DC Current measurement function.
6.5.1 SUB Set2001DCA(Range#, Time#, Digits#)
Description
Sets the Model 2001Õs DC Current Range, Aperture Time, and Number of Digits.
Parameters
Range#
0 to +2.1, ignored if In Circuit Mode is enabled. MAXIMUM, MINIMUM, or DEFAULT
Time# (Aperture Time)
166.667e-6s to 166.666667e-3s (60Hz); 2e-4 to .2 (50Hz) MAXIMUM, MINIMUM, or DEFAULT
Digits#
3.5 to 8.4999 (7.5-8.4999=>7.5d, 3.5-4.4999=>3.5d) MAXIMUM, MINIMUM, or DEFAULT
Example
Ô BASIC 7.1 or QB45 setup commands called before here
Ô Set DC Current to .2A range, 10ms Integration, & 6-1/2d
Set2001DCA .2, .01, 7.1
6.5.2 FUNCTION Set2001DCAQ$
Description
Queries the Model 2001 for its DC Current Range, Aperture Time, and Number of Digits settings.
Returns
ÒError!Ó if a TimeOutError occurred, or
Query 1: Range: 0 to +2.1
Query 2: Time: 166.667e-6 to .2
Query 3: Digits: 4 to 8 (4=3.5d, 8=7.5d, etc.)
Use ParseQuery$ to separate return string into components.
37
Example
Ô BASIC 7.1 or QB45 setup commands called before here
A$ = Set2001DCAQ$Ô Get 2001 DC Current Settings
Range$ = ParseQuery$(A$, 1)Ô Extract Range setting
AperTime$ = ParseQuery$(A$, 2)Ô Extract Aperture Time
Digits$ = ParseQuery$(A$, 3)Ô Extract Number of Digits
6.5.3 SUB Auto2001DCA(AutoRange%, AutoTime%, AutoDigits%)
Description
Sets the Model 2001Õs DC Current Auto Range, Auto Time, and Auto Digits settings.
Parameters
AutoRange%, AutoTime%, AutoDigits%
-1 = DonÕt set, 0 = Off, +1 = On, +2 = Once
The following constants can also be used:
NO = -1, TOFF = 0, TON = +1, ONCE = +2
Example
BASIC 7.1 or QB45 setup commands called before here
Ô Turn DC Current Auto Range ON, Time OFF, and Digits ONCE:
Auto2001DCA 1, 0, 2
6.5.4 FUNCTION Auto2001DCAQ$
Description
Queries the Model 2001 for its DC Current Auto Range, Auto Time, and Auto Digits settings.
Returns
ÒError!Ó if a TimeOutError occurred, or
Query 1: Auto Range: 1 or 0 (1=ON, 0=OFF)
Query 2: Auto Time: 1 or 0 (1=ON, 0=OFF)
Query 3: Auto Digits: 1 or 0 (1=ON, 0=OFF)
Use ParseQuery$ to separate return string into components.
Example
38
Ô BASIC 7.1 or QB45 setup commands called before here
A$ = Auto2001DCAQ$Ô Get 2001 DC Current Auto Settings
AutoRange$ = ParseQuery$(A$, 1)Ô Extract Auto Range setting
AutoTime$ = ParseQuery$(A$, 2)Ô Extract Auto Time
AutoDigits$ = ParseQuery$(A$, 3)Ô Extract Auto Digits
6.6AC Current Functions
These functions setup and return the settings of the conÞgurable options of the Model 2001Õs AC Current
measurement function.
6.6.1 SUB Set2001ACA(Range#, Time#, Digits#)
Description
Sets the Model 2001Õs AC Current Range, Aperture Time, and Number of Digits.
Parameters
Range#
0 to +2.1 MAXIMUM, MINIMUM, or DEFAULT
Time# (Aperture Time)
166.667e-6s to 166.666667e-3s (60Hz); 2e-4 to .2 (50Hz) MAXIMUM, MINIMUM, or DEFAULT
Digits#
3.5 to 8.4999 (7.5-8.4999=>7.5d, 3.5-4.4999=>3.5d) MAXIMUM, MINIMUM, or DEFAULT
Example
Ô BASIC 7.1 or QB45 setup commands called before here
Ô Set AC Current to 2mA range, .1 msec
Ô Integration, and 7-1/2 digits
Set2001ACA 2e-3, 1e-4, 7.5
6.6.2 FUNCTION Set2001ACAQ$
Description
Queries the Model 2001 for its AC Current Range, Aperture Time, and Number of Digits settings.
Returns
ÒError!Ó if a TimeOutError occurred, or
Query 1: Range: 0 to +2.1
Query 2: Time: 166.667e-6 to .2
Query 3: Digits: 4 to 8 (4=3.5d, 8=7.5d, etc.)
Use ParseQuery$ to separate return string into components.
Example
Ô BASIC 7.1 or QB45 setup commands called before here
A$ = Set2001ACAQ$Ô Get 2001 AC Current Settings
39
Range$ = ParseQuery$(A$, 1)Ô Extract Range setting
AperTime$ = ParseQuery$(A$, 2)Ô Extract Aperture Time
Digits$ = ParseQuery$(A$, 3)Ô Extract Number of Digits
6.6.3 SUB Auto2001ACA(AutoRange%, AutoTime%, AutoDigits%)
Description
Sets the Model 2001Õs AC Current Auto Range, Auto Time, and Auto Digits settings.
Parameters
AutoRange%, AutoTime%, AutoDigits%
-1 = DonÕt set, 0 = Off, +1 = On, +2 = Once
The following constants can also be used:
NO = -1, TOFF = 0, TON = +1, ONCE = +2
Example
Ô BASIC 7.1 or QB45 setup commands called before here
Ô Turn 2001Õs AC Current Auto Range ON, Time OFF,
Ô and Digits unaffected:
Auto2001ACA TON, 0, -1
6.6.4 FUNCTION Auto2001ACAQ$
Description
Queries the Model 2001 for its AC Current Auto Range, Auto Time, and Auto Digits settings.
Returns
ÒError!Ó if a TimeOutError occurred, or
Query 1: Auto Range: 1 or 0 (1=ON, 0=OFF)
Query 2: Auto Time: 1 or 0 (1=ON, 0=OFF)
Query 3: Auto Digits: 1 or 0 (1=ON, 0=OFF)
Use ParseQuery$ to separate return string into components.
Example
Ô Basic 7.1 or QB45 setup commands called before here
A$ = Auto2001ACAQ$Ô Get 2001 AC Current Auto Settings
AutoRange$ = ParseQuery$(A$, 1)Ô Extract Auto Range setting
AutoTime$ = ParseQuery$(A$, 2)Ô Extract Auto Time
AutoDigits$ = ParseQuery$(A$, 3)Ô Extract Auto Digits
40
6.7Two-Wire Resistance Functions
These functions setup and return the settings of the conÞgurable options of the Model 2001Õs 2-wire Resistance measurement function.
6.7.1 SUB Set2001R2(Range#, Time#, Digits#)
Description
Sets the Model 2001Õs 2-wire Resistance Range, Aperture Time, and Number of Digits.
Parameters
Range#
0 to +1.05e9 or 2.1e5 if SENSe1:RESistance:OCOMpensated ON is set.
MAXIMUM, MINIMUM, or DEFAULT
Time# (Aperture Time)
166.667e-6s to 166.666667e-3s (60Hz); 2e-4 to .2 (50Hz) MAXIMUM, MINIMUM, or DEFAULT
Digits#
3.5 to 8.4999 (7.5-8.4999≥7.5d, 3.5-4.4999≥3.5d) MAXIMUM, MINIMUM, or DEFAULT
Example
Ô BASIC 7.1 or QB45 setup commands called before here
Ô Set 2-wire Resistance to 200kΩ range, 100 msec
Ô Integration, and 5-1/2 digits
Set2001R2 1e5, .1, 6.49
6.7.2 FUNCTION Set2001R2Q$
Description
Queries the Model 2001 for its 2-wire Resistance Range, Aperture Time, and Number of Digits settings.
Returns
ÒError!Ó if a TimeOutError occurred, or
Query 1: Range: 0 to +1.05e9
Query 2: Time: 166.667e-6 to .2
Query 3: Digits: 4 to 8 (4=3.5d, 8=7.5d, etc.)
Use ParseQuery$ to separate return string into components.
Example
Ô BASIC 7.1 or QB45 setup commands called before here
A$ = Set2001R2Q$Ô Get 2001 2-wire Resistance settings
41
Range$ = ParseQuery$(A$, 1)Ô Extract Range setting
AperTime$ = ParseQuery$(A$, 2)Ô Extract Aperture Time
Digits$ = ParseQuery$(A$, 3)Ô Extract Number of Digits
6.7.3 SUB Auto2001R2(AutoRange%, AutoTime%, AutoDigits%)
Description
Sets the Model 2001Õs 2-wire Resistance Auto Range, Auto Time, and Auto Digits settings.
Parameters
AutoRange%, AutoTime%, AutoDigits%
-1 = DonÕt set, 0 = Off, +1 = On, +2 = Once
The following constants can also be used:
NO = -1, TOFF = 0, TON = +1, ONCE = +2
Example
Ô BASIC 7.1 or QB45 setup commands called before here
Ô Turn 2001Õs 2-wire Resistance Auto Range ON, Time OFF,
Ô and Digits ONCE:
Auto2001R2 TON, TOFF, ONCE
6.7.4 FUNCTION Auto2001R2Q$
Description
Queries the Model 2001 for its 2-wire Resistance Auto Range, Auto Time, and Auto Digits settings.
Returns
ÒError!Ó if a TimeOutError occurred, or
Query 1: Auto Range: 1 or 0 (1=ON, 0=OFF)
Query 2: Auto Time: 1 or 0 (1=ON, 0=OFF)
Query 3: Auto Digits: 1 or 0 (1=ON, 0=OFF)
Use ParseQuery$ to separate return string into components.
Example
42
Ô BASIC 7.1 or QB45 setup commands called before here
A$ = Auto2001R2Q$Ô Get 2001 2-wire Resistance Auto Settings
AutoRange$ = ParseQuery$(A$, 1)Ô Extract Auto Range setting
AutoTime$ = ParseQuery$(A$, 2)Ô Extract Auto Time
AutoDigits$ = ParseQuery$(A$, 3)Ô Extract Auto Digits
6.8Four-Wire Resistance Functions
These functions setup and return the settings of the conÞgurable options of the Model 2001Õs 4-wire Resistance measurement function.
6.8.1 SUB Set2001R4(Range#, Time#, Digits#)
Description
Sets the Model 2001Õs 4-wire Resistance Range, Aperture Time, and Number of Digits.
Parameters
Range#
0 to 2.1e5
MAXIMUM, MINIMUM, or DEFAULT
Time# (Aperture Time)
166.667e-6s to 166.666667e-3s (60Hz); 2e-4 to .2 (50Hz) MAXIMUM, MINIMUM, or DEFAULT
Digits#
3.5 to 8.4999 (7.5-8.4999≥7.5d, 3.5-4.4999≥3.5d) MAXIMUM, MINIMUM, or DEFAULT
Example
Ô BASIC 7.1 or QB45 setup commands called before here
Ô Set 4-wire Resistance to 20kΩ range, 100 msec
Ô Integration, and 5-1/2 digits
Set2001R4 15000#, 100d-3, 5.649
6.8.2 FUNCTION Set2001R4Q$
Description
Queries the Model 2001 for its 4-wire Resistance Range, Aperture Time, and Number of Digits settings.
Returns
ÒError!Ó if a TimeOutError occurred, or
Query 1: Range: 0 to +2.1e5
Query 2: Time: 166.667e-6 to .2
Query 3: Digits: 4 to 8 (4=3.5d, 8=7.5d, etc.)
Use ParseQuery$ to separate return string into components.
Example
Ô BASIC 7.1 or QB45 setup commands called before here
43
A$ = Set2001R4Q$Ô Get 2001 4-wire Resistance settings
Range$ = ParseQuery$(A$, 1)Ô Extract Range setting
AperTime$ = ParseQuery$(A$, 2)Ô Extract Aperture Time
Digits$ = ParseQuery$(A$, 3)Ô Extract Number of Digits
6.8.3 SUB Auto2001R4(AutoRange%, AutoTime%, AutoDigits%)
Description
Sets the Model 2001Õs 4-wire Resistance Auto Range, Auto Time, and Auto Digits settings.
Parameters
AutoRange%, AutoTime%, AutoDigits%
-1 = DonÕt set, 0 = Off, +1 = On, +2 = Once
The following constants can also be used:
NO = -1, TOFF = 0, TON = +1, ONCE = +2
Example
Ô BASIC 7.1 or QB45 setup commands called before here
Ô Turn 2001Õs 4-wire Resistance Auto Range ON, Time OFF,
Ô and Digits ONCE:
Auto2001R4 TON, TOFF, ONCE
6.8.4 FUNCTION Auto2001R4Q$
Description
Queries the Model 2001 for its 4-wire Resistance Auto Range, Auto Time, and Auto Digits settings.
Returns
ÒError!Ó if a TimeOutError occurred, or
Query 1: Auto Range: 1 or 0 (1=ON, 0=OFF)
Query 2: Auto Time: 1 or 0 (1=ON, 0=OFF)
Query 3: Auto Digits: 1 or 0 (1=ON, 0=OFF)
Use ParseQuery$ to separate return string into components.
Example
44
Ô BASIC 7.1 or QB45 setup commands called before here
A$ = Auto2001R4Q$Ô Get 2001 4-wire Resistance Auto Settings
AutoRange$ = ParseQuery$(A$, 1)Ô Extract Auto Range setting
AutoTime$ = ParseQuery$(A$, 2)Ô Extract Auto Time
AutoDigits$ = ParseQuery$(A$, 3)Ô Extract Auto Digits
6.9Frequency Functions
These functions setup and return the settings of the conÞgurable options of the Model 2001Õs Frequency
measurement function.
6.9.1 SUB Set2001F(Digits#, Source%)
Description
Sets the Model 2001Õs Frequency Number of Digits and Source settings.
Parameters
Digits#
3.5 to 5.4999 (4.5-5.4999≥4.5d, 3.5-4.4999≥3.5d) MAXIMUM, MINIMUM, or DEFAULT
Source%
0 Ñ Current
1 Ñ Voltage
Example
Ô BASIC 7.1 or QB45 setup commands called before here
Ô Set Frequency to 5 digits, Current triggered
Set2001F 5.49, 0
6.9.2 FUNCTION Set2001FQ$
Description
Queries the Model 2001 for its Frequency Number of Digits and Measurement Source settings.
Returns
ÒError!Ó if a TimeOutError occurred, or
Query 1: Digits: 4 to 5 (4=3.5d, 5=4.5d)
Query 2: Source: VOLT or CURR
Use ParseQuery$ to separate return string into components.
Example
Ô BASIC 7.1 or QB45 setup commands called before here
A$ = Set2001FQ$Ô Get Model 2001 Frequency settings
Digits$ = ParseQuery$(A$, 1)Ô Extract Number of Digits
Source$ = ParseQuery$(A$, 2)Ô Extract Frequency Source
45
6.10 Temperature Functions
These functions setup and return the settings of the conÞgurable options of the Model 2001Õs Temperature
measurement function.
6.10.1 SUB Set2001T(Time#, Digits#)
Description
Sets the Model 2001Õs Temperature Aperture Time and Number of Digits.
Parameters
Time# (Aperture time)
166.667e-6s to 166.666667e-3s (60Hz); 2e-4 to .2 (50Hz)
MAXIMUM, MINIMUM, or DEFAULT
Digits#
3.5 to 7.4999 (6.5-7.4999≥6.5d, 3.5-4.4999≥3.5d)
MAXIMUM, MINIMUM, or DEFAULT
Example
Ô BASIC 7.1 or QB45 setup commands called before here
Ô Set Temperature to 100msec Integration, and 5½ digits
Set2001T .1, 6.49
6.10.2 FUNCTION Set2001TQ$
Description
Queries the Model 2001 for its Temperature Aperture Time and Number of Digits settings.
Returns
ÒError!Ó if a TimeOutError occurred, or
Query 1: Time: 166.667e-6 to .2
Query 2: Digits: 4 to 7 (4=3.5d, 7=6.5d, etc.)
Use ParseQuery$ to separate return string into components.
Example
46
Ô BASIC 7.1 or QB45 setup commands called before here
A$ = Set2001TQ$Ô Get Model 2001 Temperature settings
AperTime$ = ParseQuery$(A$, 1)Ô Extract Aperture Time
Digits$ = ParseQuery$(A$, 2)Ô Extract Number of Digits
6.10.3 SUB Auto2001T(AutoTime%, AutoDigits%)
Description
Set the Model 2001Õs Temperature Auto Time and Auto Digits settings.
Parameters
AutoTime%, AutoDigits%
-1 = DonÕt set, 0 = Off, +1 = On, +2 = Once
The following constants can also be used:
NO = -1, TOFF = 0, TON = +1, ONCE = +2
Example
Ô BASIC 7.1 or QB45 setup commands called before here
Ô Turn Model 2001Õs Temperature Auto Time OFF, and Digits ONCE:
Auto2001T TOFF, ONCE
6.10.4 FUNCTION Auto2001TQ$
Description
Queries the Model 2001 for its Temperature Auto Time and Auto Digits settings.
Returns
ÒError!Ó if a TimeOutError occurred, or
Query 1: Auto Time: 1 or 0 (1=ON, 0=OFF)
Query 2: Auto Digits: 1 or 0 (1=ON, 0=OFF)
Use ParseQuery$ to separate return string into components.
Example
Ô Basic 7.1 or QB45 setup commands called before here
A$ = Auto2001TQ$Ô Get Model 2001 Temperature Auto Settings
AutoTime$ = ParseQuery$(A$, 1)Ô Extract Auto Time
AutoDigits$ = ParseQuery$(A$, 2)Ô Extract Auto Digits
6.10.5 SUB Set2001RTD(Mode%, RType%, Alpha#, Beta#, Delta#, RZero#)
Description
ConÞgure and use RTDs to make temperature measurements.
47
Parameters
Mode%2 or 4 (2-wire or 4-wire RTD)
Type%0 = PT385, 1 = PT3916, 2 = USER
Alpha#0.00 to 0.01 (ignored if not USER)
Beta#0.00 to 1.00 (ignored if not USER)
Delta#0.00 to 5.00 (ignored if not USER)
RZero#0.0 to 1000.0 (ignored if not USER)
Example
Ô BASIC 7.1 or QB45 setup commands called before here
Ô Set RTD Mode to 4-wire RTD, User, Alpha=.005, Beta= .5
Ô Delta=2.4, and RZero=500
Set2001RTD 4, 2, .005, .5, 2.4, 500
6.10.6 FUNCTION Set2001RTDQ$
Description
Queries the Model 2001 for the Temperature transducer Type, the RTD Type, Alpha, Beta, Delta, and RZero
settings.
Returns
ÒError!Ó if a TimeOutError occurred, or
Query 1: Mode: RTD or FRTD or TC
Query 2: RType: USER, PT385, or PT3916
Query 3: Alpha: 0.00 to 0.01
Query 4: Beta: 0.00 to 1.00
Query 5: Delta: 0.00 to 5.00
Query 6: RZero: 0 to 1000
Use ParseQuery$ to separate return string into components.
Example
Ô BASIC 7.1 or QB45 setup commands called before here
A$ = Set2001RTDQ$Ô Get 2001 RTD settings
Mode$ = ParseQuery$(A$, 1)Ô Extract Temp. Device
RType$ = ParseQuery$(A$, 2)Ô Extract RTD Type
Alpha# = VAL(ParseQuery$(A$, 3))Ô Extract Alpha setting
Beta# = VAL(ParseQuery$(A$, 4))Ô Extract Beta setting
Delta# = VAL(ParseQuery$(A$, 5))Ô Extract Delta setting
RZero# = VAL(ParseQuery$(A$, 6))Ô Extract RZero setting
48
6.10.7 SUB Set2001TC(TType$)
Description
Sets the thermocouple type and uses TCÕs for temperature measurement.
Parameters
TType$ÒJÓ, ÒKÓ, ÒTÓ, ÒEÓ, ÒRÓ, ÒSÓ, or ÒBÓ
Example
Ô BASIC 7.1 or QB45 setup commands called before here
Ô Use Type J thermocouples
Set2001TC ÒJÓ
6.10.8 FUNCTION Set2001TCQ$
Description
Queries the Model 2001 for the Thermocouple Type.
Returns
ÒError!Ó if a TimeOutError occurred, or ÒJÓ, ÒKÓ, ÒTÓ, ÒEÓ, ÒRÓ, ÒSÓ, or ÒBÓ
Example
Ô BASIC 7.1 or QB45 setup commands called before here
A$ = Set2001TCQ$ Ô Get Model 2001 Thermocouple Type
49
50
Section 7
Model 2001 / 7001 Status Commands
These routines control the SCPI Status Model of the Model 2001/7001. Constants (see Status Model Constants in Appendix B) are deÞned for all of the registers and their bits to make programming the Model
2001/7001 status model simpler. Please refer to the IEEE-488 Reference Section of the Model 2001 or 7001
manual for more details on the speciÞc bit patterns of these registers and bit patterns.
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. 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, Appendix A).
7.1SUB Stat2001(Event2001%, PTF%, NTF%, SEN%)
SUB Stat7001(Event7001%, PTF%, NTF%, SEN%)
Description
Sets the Model 2001/7001Õs Operation, Trigger, Arm, Sequence, Questionable, or Measurement EventsÕ Positive Transition Filter, Negative Transition Filter, and Status Enable Registers.
PTF% (Positive Transition Filter)0 to 32767
NTF% (Negative Transition Filter)0 to 32767
SEN% (Status Enable Register)0 to 32767
Example
Ô BASIC7.1 or QB45 setup commands called before here
Ô Cause the TRIG and/or ARM bits to be set in the 2001Õs
Ô Measurement Event Register when the Model 2001 enters or exits
Ô Triggering or Arming
Stat2001 MEASUREMENT, TRIG + ARM, TRIG + ARM, TRIG + ARM
51
7.2FUNCTION Stat2001Q$(Event2001%)
FUNCTION Stat7001Q$(Event7001%)
Description
Queries the Model 2001/7001Õs Operation, Trigger, Arm, Sequence, Questionable, or Measurement EventsÕ
Status, Condition, Positive Transition Filter, Negative Transition Filter, and Status Enable Registers.
ÒError!Ó if a TimeOutError occurred, or
Query 1: Status Register (0 to 32767)
Query 2: Condition Register (0 to 32767)
Query 3: Positive Transition Filter (0 to 32767)
Query 4: Negative Transition Filter (0 to 32767)
Query 5: Status Enable Register (0 to 32767)
Use ParseQuery$ to separate return string into components.
Example
Ô BASIC 7.1 or QB45 setup commands called before here
A$ = Stat7001Q$(OPERATION)Ô Read Model 7001Õs Operation Event Registers
StatReg$ = ParseQuery$(A$, 1)Ô Extract Status Register
CondReg$ = ParseQuery$(A$, 2)Ô Extract Condition Register
PTranReg$ = ParseQuery$(A$, 3)Ô Extract +Transition Reg.
NTranReg$ = ParseQuery$(A$, 4)Ô Extract -Transition Reg.
SEnableReg$ = ParseQuery$(A$, 5)Ô Status Enable Reg.
7.3SUB SRE2001(mask%)
SUB SRE7001(mask%)
Description
Enables the Model 2001/7001 to generate a Service Request when the indicated bit(s) of the Status Byte Register are set. If a bit is already set when this command is given, no Service Request is generated.
Parameters
52
mask%0 to 255
Example
Ô BASIC 7.1 or QB45 setup commands called before here
Poll% = Poll2001%Ô Clear any pending SRQÕs
SRE2001 MAVÔ Set up to SRQ on MAV
Send2001 ÒFETCH?ÓÔ fetch a 2001 reading
DOÔ Set up an uninterruptable wait
LOOP UNTIL Wait2001RQS%
Reading$ = Q2001$(ÒÒ)Ô Get reading
7.4SUB ESE2001(mask%)
SUB ESE7001(mask%)
Description
Sets which bits of the Model 2001/7001Õs Standard Event Status Register cause the Event Summary Bit (ESB)
of the Status Byte Register to be set.
Parameters
mask%0 to 255
Example
Ô BASIC 7.1 or QB45 setup commands called before here
Ô Setup an SRQ on OPeration Complete
ESE2001 OPC
SRE2001 ESB
Send2001 ÒVOLTage:DC:RANGe 200;*OPCÓ
RQS2001% = Wait2001RQS%Ô Wait until range change complete
7.5FUNCTION OPC2001$(UnInterruptable%)
FUNCTION OPC7001$(UnInterruptable%)
Description
Performs a Model 2001/7001 *OPC? command which returns a Ò1Ó when the present operation is complete.
However, the Ò1Ó may not be output by the 2001/7001 for a long time, which would cause an IEEE timeout
on reading data immediately after sending the *OPC?. Thus, this routine waits for a Model 2001/7001 SRQ
on MAV after sending the query. The Model 2001/7001 may wait forever to send the Ò1Ó out if :INITiate:CONTinuous ON was explicitly set as in the case of the Factory Defaults. Thus, the :ABORt command
would have to be issued before calling these routines.
Parameters
UnInterruptable%
FALSE (0) - the command can be aborted by pressing the Esc key or the right mouse button (BASIC 7.1 only).
TRUE (non-zero) - the command cannot be aborted.
53
Returns
ÒError!Ó if a TimeOutError occurred, or
Ò1Ó if operation was completed
ÒCancelÓ if aborted
Example
Ô BASIC 7.1 or QB45 setup commands called before here
Ô Guarantee that *OPC? will not wait forever.
IF Q2001$(ÒINIT:CONT?Ó) = Ò1Ó THEN Send2001 ÒABORTÓ
Send2001 ÒVOLTage:DC:RANGe 200Ó
OPC$=OPC2001$(TRUE)Ô Wait until range change complete
7.6SUB Clear2001
SUB Clear7001
Description
Sends the SCPI command *CLS (Clear Status Model) to the 2001/7001.
54
Section 8
Model 2001 / 7001 Scanning Commands
These Routines control the SCPI Trigger Model and Scanning functions of the Model 2001/7001. Please refer
to the IEEE-488 Reference Section of the Model 2001 or 7001 manual for more details. All of these 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).
NOTE
These functions and subroutines also support the Model 7002 Switch System. Just send
Model 7001 commands to a Model 7002.
See Model 2001/7001 Scanning Minimum and Maximum Constants in Appendix B for CONSTants for use
with the Model 2001/7001 Scanning Commands.
8.1SUB Close2001(Channel%)
Description
Closes a single channel on the Model 2001 scanner card.
Parameters
Channel%1 to 10
Example
Ô BASIC 7.1 or QB45 setup commands called before here
Ô Take Readings on Channel 3
Close2001 3
8.2SUB Close7001(ChanList$)
Description
Closes the speciÞed channels on the Model 7001 scanner card.
55
Parameters
ChanList$
Any valid SCPI channel-list like (@1!1, 1!2, 1!4:1!10, 2!1!2) with valid channels depending on the scanner
card selected. The Model 7001 EAV bit in the serial poll register must be checked to see if the command was
accepted, or watch the front panel of the instrument for an error message.
Example
Ô BASIC 7.1 or QB45 setup commands called before here
Ô Close channels 3 to 6 on card 1
Close7001 Ò(@1!3:1!6)Ó
8.3FUNCTION Close2001Q$
FUNCTION Close7001Q$
Description
Queries the Model 2001/7001 for a list of closed channels. The Model 2001 can have only one channel closed
at a time on its internal scanner, whereas the Model 7001 many have none or all channels closed.
Returns
ÒError!Ó if a TimeOutError occurred, or a list of closed channels.
Example
Ô BASIC 7.1 or QB45 setup commands called before here
Close2001 2Ô Close Channel 2
A$ = Close2001Q$Ô A$ = Ò(@2)Ó
8.4SUB Open2001(Channel%)
Description
Opens one or all channel(s) on the Model 2001 scanner card.
Parameters
Channel%
0 Ñ Open all channels
1 to 10
56
Example
Ô BASIC 7.1 or QB45 setup commands called before here
Open2001 1Ô Open channel 1
Open2001 0Ô Open all Model 2001 channels
8.5SUB Open7001(ChanList$)
Description
Opens the speciÞed channels on the 7001 scanner card.
Parameters
ChanList$
Any valid SCPI channel-list with valid channels depending on the scanner card selected. The Model 7001
EAV bit in the serial poll register must be checked to see if the command was accepted, or watch the front
panel of the instrument for an error message.
Example
Ô BASIC 7.1 or QB45 setup commands called before here
Open7001 Ò(@1!3:1!6)ÓÔ Open channels 3 to 6 on card 1
Open7001 ÒALLÓÔ Open all 7001 channels
8.6SUB Scan2001(ChanList$)
SUB Scan7001(ChanList$)
Description
DeÞnes the Model 2001Õs Internal ScanList or the Model 7001Õs scanlist.
Parameters
ChanList$
Any valid SCPI channel-list like (@1, 2, 4:10) with channels ranging from 1 to 10 for the Model 2001, or like
(@1!1:1!40, 2!1:2!40) for the Model 7001. The Model 2001/7001 EAV bit in the serial poll register must be
checked to see if the command was accepted, or watch the front panel of the instrument for an error message.
Example
Ô BASIC 7.1 or QB45 setup commands called before here
Scan2001 Ò(@1:10)ÓÔ Scan all Model 2001 channels
Scan7001 Ò(@1!1:1!40, 2!1:2!40)ÓÔ Scan all Model 7001 channels
SUB Arm7001(Count1#, Source1$, Count2#, Delay2#, Source2$)
Description
Sets up the Model 2001/7001Õs Arm Layer 1 (Arm Layer) and Arm Layer 2 (Scan Layer)
57
Parameters
Count1# and Count2#
1 to 99999, 9.9e37
MAXIMUM, MINIMUM, DEFAULT, or INF
Source1$ and Source2$
HOLD Ñ Hold
MANual Ñ Manual
IMMediate Ñ Immediate
TIMEr Ñ Timer (Source2$ only)
BUS Ñ IEEE-488 Bus (GET or *TRG)
TLINk Ñ Trigger Link
EXTernal Ñ External
Delay2#
0 to 999999.999 seconds
MAXIMUM, MINIMUM, or DEFAULT
Example
Ô BASIC 7.1 or QB45 setup commands called before here
Ô Setup the Model 7001 to do three sets of Þve scans. Each scan starts
Ô immediately at 1 hour intervals.
Arm7001 3, ÒIMMÓ, 5, MINIMUM, ÒTIMERÓ
Timers7001 3600, 1.5
8.8FUNCTION Arm2001Q$
FUNCTION Arm7001Q$
Description
Queries the Model 2001/7001 for its Arm Layer 1 (Arm Layer) and Arm Layer 2 (Scan Layer) settings.
Returns
ÒError!Ó if a TimeOutError occurred, or
Query 1: Arm Layer 1 Count (1 to 99999, 9.9e+37)
Query 2: Arm Layer 1 Source (see Arm2001/7001, short form)
Query 3: Arm Layer 2 Count (1 to 99999, 9.9e+37)
Query 4: Arm Layer 2 Source (see Arm2001/7001, short form)
Query 5: Arm Layer 2 Delay (0 to 999999.999)
Use ParseQuery$ to separate return string into components.
Example
Ô BASIC 7.1 or QB45 setup commands called before here
A$ = Arm7001Q$Ô Read 7001Õs Arm Layers 1&2 Setup
Count1# = VAL(ParseQuery$(A$, 1))Ô Get Arm Layer 1 Count
Source1$ = ParseQuery$(A$, 2)Ô Get Arm Layer 1 Source
58
Count2# = VAL(ParseQuery$(A$, 3))Ô Get Arm Layer 2 Count
Delay2# = VAL(ParseQuery$(A$, 4))Ô Get Arm Layer 2 Delay
Source2$ = ParseQuery$(A$, 5)Ô Get Arm Layer 2 Source
8.9SUB Trig2001(Count1#, Delay1#, Source1$)
SUB Trig7001(Count1#, Delay1#, Source1$)
Description
Sets up the Model 2001/7001Õs Trigger Sequence (Trigger Layer, i.e., Model 2001 Measure Layer and Model
7001 Channel Layer).
Parameters
Count1#
1 to 99999, 9.9e37
MAXIMUM, MINIMUM, DEFAULT or INF
Delay1#
0 to 999999.999 seconds
MAXIMUM, MINIMUM, or DEFAULT
Source1$
HOLD Ñ Hold
MANual Ñ Manual
IMMediate Ñ Immediate
BUS Ñ IEEE-488 Bus (GET or *TRG)
TLINK Ñ Trigger Link
EXTernal Ñ External
Example
Ô BASIC 7.1 or QB45 setup commands called before here
Ô Setup the 7001 to scan 40 channels with no delay at
Ô 1.5 second intervals.
Trig7001 40, MINIMUM,ÒTIMÓ
Timers7001 3600, 1.5
8.10 FUNCTION Trig2001Q$
FUNCTION Trig7001Q$
Description
Queries the Model 2001/7001 for its Trigger Sequence (Trigger Layer) settings.
59
Returns
ÒError!Ó if a TimeOutError occurred, or
Query 1: Trigger Sequence 1 Count (1 to 99999, 9.9e+37)
Query 2: Trigger Sequence 1 Source (see Trig2001/7001, short form)
Query 3: Trigger Sequence 1 Delay (0 to 999999.999)
Use ParseQuery$ to separate return string into components.
Example
Ô BASIC 7.1 or QB45 setup commands called before here
A$ = Trig7001Q$Ô Read 7001Õs Trigger Setup
Count1# = VAL(ParseQuery$(A$, 1))Ô Get Trigger Count
Delay1# = VAL(ParseQuery$(A$, 2))Ô Get Trigger Delay
Source1$ = ParseQuery$(A$, 3)Ô Get Trigger Source
8.11 SUB Timers2001(ArmTimer2#, TrigTimer1#)
SUB Timers7001(ArmTimer2#, TrigTimer1#)
Description
Sets the Model 2001/7001Õs Trigger Model timers in Arm Layer 2 (Scan Layer) and Trigger Sequence 1 (Trigger Layer).
Parameters
ArmTimer2#, TrigTimer1#
.001 to 999999.999
MAXIMUM, MINIMUM, or DEFAULT
Example
Ô BASIC 7.1 or QB45 setup commands called before here
Ô Scan at one hour intervals, trigger at 1.5 seconds intervals.
Timers7001 3600, 1.5
8.12 FUNCTION Timers2001Q$
FUNCTION Timers7001Q$
Description
Queries the Model 2001/7001 for its Arm Layer 2 (Scan Layer) and Trigger Sequence 1 (Trigger Layer) timer
settings.
Returns
60
ÒError!Ó if a TimeOutError occurred, or
Query 1: Arm Layer 2 Timer (see Timers2001/7001)
Query 2: Trigger Sequence Timer (see Timers2001/7001)
Use ParseQuery$ to separate return string into components.
Example
Ô BASIC 7.1 or QB45 setup commands called before here
A$ = Timers7001Q$Ô Read Arm Layer 1 and Trigger Timers
ArmTimer# = VAL(ParseQuery$(A$, 1))Ô Get Arm Layer 1 Timer
TrigTimer# = VAL(ParseQuery$(A$, 2))Ô Get Trigger Timer
8.13 SUB ArmTcon2001(Dir1$, ILine1%, Oline1%, Dir2$, ILine2%, Oline2%)
SUB ArmT con7001(Dir1$, ILine1%, Oline1%, Dir2$, ILine2%, Oline2%)
Description
Sets the Model 2001/7001Õs Arm Layer 1 (Arm Layer) and Arm Layer 2 (Scan Layer) Trigger conÞgurations.
Note that OLine can not be the same as ILine. If they are, the Oline will be made 1 line number (wrapping
around to 1 if necessary) higher than the Iline.
Ô BASIC 7.1 or QB45 setup commands called before here
Ô DonÕt bypass Arm Layer 1 source and use Trigger Link Lines
Ô 1 and 2 as input and output. Bypass Arm Layer 2 source
Ô and use Trigger Link lines 3 and 4 as I/O.
ArmTcon7001 ÒACCÓ, 1, 2, ÒSOURCEÓ, 3, 4
8.14 FUNCTION ArmTcon2001Q$
FUNCTION ArmTcon7001Q$
Description
Queries the Model 2001/7001 for its Arm Layer 1 (Arm Layer) and Arm Layer 2 (Scan Layer) trigger conÞguration settings.
61
Returns
ÒError!Ó if a TimeOutError occurred, or
Query 1: Arm Layer 1 Direction (ACC or SOUR)
Query 2: Arm Layer 1 Input Line (1-6)
Query 3: Arm Layer 1 Output Line (1-6)
Query 4: Arm Layer 2 Direction (ACC or SOUR)
Query 5: Arm Layer 2 Input Line (1-6)
Query 6: Arm Layer 2 Output Line (1-6)
Use ParseQuery$ to separate return string into components.
Example
Ô BASIC 7.1 or QB45 setup commands called before here
A$ = ArmTcon7001Q$ÔGet Arm Layers 1&2 Trigger ConÞguration
Dir1$ = (ParseQuery$(A$, 1)Ô Get Arm Layer 1 Direction
In1% = VAL(ParseQuery$(A$, 2))ÔGet Arm Layer 1 Input Line
Out1% = VAL(ParseQuery$(A$, 3))ÔGet Arm Layer 1 Output Line
Dir2$ = (ParseQuery$(A$, 4)Ô Get Arm Layer 2 Direction
In2% = VAL(ParseQuery$(A$, 5))ÔGet Arm Layer 2 Input Line
Out2% = VAL(ParseQuery$(A$, 6))ÔGet Arm Layer 2 Output Line
8.15 SUB TrigTcon2001(Dir1$, Synch1$, ILine1%, Oline1%)
SUB TrigTcon7001(Dir1$, Synch1$, ILine1%, Oline1%)
Description
Sets the Model 2001/7001Õs Trigger Sequence 1 and Trigger Sequence 2 trigger conÞgurations. Note that
OLine1% can not be the same as ILine1% if Synch1$=ÓASYNÓ. If they are, the Oline1% will be made one
line number (wrapping around to 1 if necessary) higher than the Iline1%.
ASYNchronous Ñ Asynchronous Trigger Link
SSYNchronous Ñ Semi-Synchronous Link
ILine1%
1-6 Ñ Trigger Link input line number (I/O if SSYN)
OLine1%
62
1-6 Ñ Trigger Link output line number (ignored if SSYN)
Example
Ô BASIC 7.1 or QB45 setup commands called before here
Ô DonÕt bypass Trigger Sequence 1 source, use the SemiÔ Synchronous Trigger Link, and use Trigger Link Line 5 as
Ô both input and output.
TrigTcon7001 ÒACCÓ, ÒSSYNÓ, 5, 6
8.16 FUNCTION TrigTcon2001Q$
FUNCTION TrigTcon7001Q$
Description
Queries the Model 2001/7001 for its Trigger Sequence 1 (Trigger Layer, i.e., Model 2001 Measure Layer and
Model 7001 Channel Layer) trigger conÞguration settings.
Returns
ÒError!Ó if a TimeOutError occurred, or
Query 1: Trigger Sequence 1 Direction (ACC or SOUR)
Query 2: Trigger Sequence 1 Trigger Link Mode (ASYN or SSYN)
Query 3: Trigger Sequence 1 Input Line (1-6)
Query 4: Trigger Sequence 1 Output Line (1-6, 0 if SSYN)
Use ParseQuery$ to separate return string into components.
Example
Ô BASIC 7.1 or QB45 setup commands called before here
A$ = TrigTcon7001Q$Ô Get Trigger Layer setup from 7001
Dir1$ = (ParseQuery$(A$, 1))Ô Get Trigger Layer Direction
Syn1$ = (ParseQuery$(A$, 2))Ô Get Trigger Layer Protocol
In1% = VAL(ParseQuery$(A$, 3))Ô Get Trigger Layer Input Line
Out1% = VAL(ParseQuery$(A$, 4))Ô Get Trigger Layer Output Line
63
64
Section 9
Model 2001 Calculate Commands
These Routines control the Model 2001Õs Calculate subsystem capabilities, which include limit testing,
mX+B, percent, and data buffer statistics.
All of these 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).
See Model 2001 Minimum and Maximum Calculate Constants in Appendix B for CONSTants for use with
the Model 2001 Calculate commands.
9.1SUB Set2001Calc1MXB(MMFactor#, MBFactor#)
Description
Sets the Model 2001Õs CALCulate1 subsystemÕs Mx+B coefÞcients and enables the Mx+B mode of operation.
Parameters
MMFactor#
-9.999999999e20 to +9.999999999e20
MBFactor#
-9.999999999e30 to +9.999999999e30
Example
Ô BASIC 7.1 or QB45 setup commands called before here
Ô Set and use mX+b with slope of 10 and intercept of 5
Set2001Calc1MXB 10, 5
9.2SUB Set2001Calc1PERC(Percent#)
Description
Sets the Model 2001Õs CALCulate1 SubsystemÕs Percentage target and enables the percentage mode of operation.
65
Parameters
Percent#-9.999999999e35 to +9.999999999e35
Example
Ô BASIC 7.1 or QB45 setup commands called before here
Ô Set 100% of full scale at 15.24
Set2001Calc1PERC 15.24
9.3SUB Calc1.2001(State%)
Description
Sets the state of the Model 2001Õs CALCulate1 Subsystem.
Parameters
State%
0, TOFF = Turn CALC1 Off
+1, TON = Turn CALC1 On
Example
Ô BASIC 7.1 or QB45 setup commands called before here
Calc1.2001 TOFFÔ Turn off CALC1 System
9.4FUNCTION Set2001Calc1Q$
Description
Queries the Model 2001 for its CALCulate1 SubsystemÕs State, MMFactor, MBFactor, and Percent settings.
Returns
ÒError!Ó if a TimeOutError occurred, or
Query 1: CALCulate1Õs State (1 or 0)
Query 2: CALCulate1Õs MMFactor (see Set2001Calc1MXB)
Query 3: CALCulate1Õs MBFactor (see Set2001Calc1MXB)
Query 4: CALCulate1Õs Percent (see Set2001Calc1PERC)
Use ParseQuery$ to separate return string into components.
Example:
66
Ô BASIC 7.1 or QB45 setup commands called before here
A$ = Set2001Calc1Q$Ô Get 2001 CALC1 settings
Calc1State$ = ParseQuery$(A$, 1)Ô Get CALC1Õs State
MMFactor# = VAL(ParseQuery$(A$, 2)) ÔGet slope of mX+b
MBFactor# = VAL(ParseQuery$(A$, 3))Ô Get intercept of mX+b
Percent# = VAL(ParseQuery$(A$, 4))Ô Get 100% value
9.5FUNCTION Calc1.2001Q$
Description
Queries the Model 2001 for the result of the latest CALCulate1 calculation.
Returns
ÒError!Ó if a TimeOutError occurred, or Model 2001Õs present CALCulate1 calculation.
Example
Ô BASIC 7.1 or QB45 setup commands called before here
Set2001Calc1MXB 10, 5
Ô Reading from SENSe:DATA? is 10.4
PRINT Calc1.2001Q$Ô Outputs 109
9.6SUB Set2001Calc2(Format$)
Description
Sets up the Model 2001 Data BufferÕs Format and activates the CALCulate2 subsystem.
Parameters
Format$
NONE
MEAN
SDEViation (Standard Deviation)
MAXimum
MINimum
PKPK (Peak to Peak)
Example
Ô BASIC 7.1 or QB45 setup commands called before here
Set2001Calc2 ÒMAXIMUMÓ Ô calculate maximum of data buffer
Calc2.2001 TON
Ô Data buffer contains 1.122, 10.211, 10.2222
Ô A$ = Calc2.2001Q$
Ô A$ = Ò10.2222Ó
67
9.7 SUB Calc2.2001(State%)
Description
Sets the state of the Model 2001Õs CALCulate2 Subsystem.
Parameters
State%
0, TOFF = Turn CALC2 Off
+1, TON = Turn CALC2 On
Example
Ô BASIC 7.1 or QB45 setup commands called before here
Calc2.2001 0Ô Turn off CALC2 System
9.8FUNCTION Set2001Calc2Q$
Description
Queries the Model 2001 for its CALCulate2 subsystemÕs Format and State.
Returns
ÒError!Ó if a TimeOutError occurred, or
Query 1: CALCulate 2 Format (see Set2001Calc2 above)
Query 2: CALCulate 2 State (0 or 1)
Use ParseQuery$ to separate return string into components.
Example
Ô BASIC 7.1 or QB45 setup commands called before here
A$ = Set2001Calc2Q$Ô Get 2001 CALC2 settings
Format$ = ParseQuery$(A$, 1)Ô Get CALC2Õs Format
Calc2State$ = ParseQuery$(A$, 2)Ô Get CALC2Õs State
9.9FUNCTION Calc2.2001Q$
Description
Queries the Model 2001 for the result of the present CALCulate2 subsystemÕs calculation.
Returns
68
ÒError!Ó if a TimeOutError occurred, or the result of the present CALC2 calculation.
Example
Ô BASIC 7.1 or QB45 setup commands called before here
A$ = Calc2.2001Q$ Ô Get 2001 CALC2Õs last result
9.10 SUB Set2001Calc3(Upper1#, Lower1#, Upper2#, Lower2#)
Description
Sets the Model 2001Õs CALCulate3 subsystems Limit Testing Hi/Lo Limits.
Parameters
Upper1#, Upper2#, Lower1#, Lower2#
-9.999999999e35 to +9.999999999e35
MAXIMUM, MINIMUM, or DEFAULT
Example
Ô BASIC 7.1 or QB45 setup commands called before here
Ô Setup Limit Testing Ranges
Ô Limit 1 Range: -100.56 to -10.5 or 10.5 to 100.56
Ô Limit 2 Range: <-100.56 or >100.56
Ô Pass Range: -10.5 to 10.5
Set2001Calc3 10.5, -10.5, 100.56, -100.56
9.11 FUNCTION Set2001Calc3Q$
Description
Queries the Model 2001 for its CALCulate3 subsystems Limit Testing Hi/Lo Limits.
Use ParseQuery$ to separate return string into components.
Example
Ô BASIC 7.1 or QB45 setup commands called before here
A$ = Set2001Calc3Q$Ô Get Model 2001 CALC3 settings
Upper1# = VAL(ParseQuery$(A$, 1))Ô Get Upper Limit 1
Lower1# = VAL(ParseQuery$(A$, 2))Ô Get Lower Limit 1
Upper2# = VAL(ParseQuery$(A$, 3))Ô Get Upper Limit 2
Lower2# = VAL(ParseQuery$(A$, 4))Ô Get Lower Limit 2
69
9.12 SUB Calc3.2001(State%)
Description
Sets the state of the Model 2001Õs CALCulate3 Subsystem.
Parameters
State%
0, TOFF = Turn CALC3 Off
+1, TON = Turn CALC3 On
Example
Ô BASIC 7.1 or QB45 setup commands called before here
Calc3.2001 TON Ô Turn on CALC3 System
9.13 SUB Set2001Calc3Dig(Du1%, Dl1%, Du2%, Dl2%)
Description
Sets the Model 2001Õs CALCulate3Õs Limit Testing HI/Lo Digital Output values.
Parameters
Du1%Value (0-15) to place on digital output to indicate Upper 1 Limit Reached
Dl1%Value (0-15) to place on digital output to indicate Lower 1 Limit Reached
Du2%Value (0-15) to place on digital output to indicate Upper 2 Limit Reached
Dl2%Value (0-15) to place on digital output to indicate Lower 2 Limit Reached
Example
Ô BASIC 7.1 or QB45 setup commands called before here
Ô Set 1st bit of digital output if Upper Limit 1 Reached
Ô Set 2nd bit of digital output if Lower Limit 1 Reached
Ô Set 3rd bit of digital output if Upper Limit 2 Reached
Ô Set 4th bit of digital output if Lower Limit 2 Reached
Set2001Calc3Dig 1, 2, 4, 8
9.14 FUNCTION Set2001Calc3DigQ$
Description
Queries the Model 2001 for its CALCulate3 subsystemÕs Limit Testing HI/LO Digital Output Values.
70
Returns
ÒError!Ó if a TimeOutError occurred, or
Query 1: digital output Upper Limit 1 value
Query 2: digital output Lower Limit 1 value
Query 3: digital output Upper Limit 2 value
Query 4: digital output Lower Limit 2 value
Use ParseQuery$ to separate return string into components.
Example
Ô BASIC 7.1 or QB45 setup commands called before here
A$ = Set2001Calc3DigQ$Ô Get Model 2001 CALC3 Digital I/O settings
Du1% = VAL(ParseQuery$(A$, 1))Ô Get UpLim1 DigI/O Value
Dl1% = VAL(ParseQuery$(A$, 2))Ô Get LoLim1 DigI/O Value
Du2% = VAL(ParseQuery$(A$, 3))Ô Get UpLim2 DigI/O Value
Dl2% = VAL(ParseQuery$(A$, 4))Ô Get LoLim2 DigI/O Value
9.15 FUNCTION Calc3.2001Q$
Description
Queries the Model 2001 for the result of the present CALCulate3 subsystemÕs calculation.
Returns
ÒError!Ó if a TimeOutError occurred, or
Query 1: Upper/Lower Limit Range 1 result (0=PASS or 1=FAIL)
Query 2: Upper/Lower Limit Range 2 result (0=PASS or 1=FAIL)
Use ParseQuery$ to separate return string into components.
Example
Ô BASIC 7.1 or QB45 setup commands called before here
A$ = Calc3.2001Q$Ô Get Model 2001 CALC3 Limit Test Results
Test1$ = ParseQuery$(A$, 1)Ô Get Upper/Lower 1 Test Result
Test2$ = ParseQuery$(A$, 2)Ô Get Upper/Lower 2 Test Result
71
72
Appendix A
Model 2001/7001 Global V ariables
The following is a list of all the global variables used by the Model 2001/7001 Support Software for Microsoft QuickBASIC 4.5 and Professional BASIC 7.1:
KI2001%Global variable that contains the Model 2001Õs IEEE address.
KI7001%Global variable that contains the Model 7001Õs IEEE address.
TimeOutError%Set to TRUE (-1) when a timeout error occurs.
brd0%The location of board ÒGPIB0Ó for National Instruments.
Nat2001Addr%Integer value of the actual Model 2001 IEEE Address for use with National Instruments
board commands.
Nat7001Addr%Integer value of the actual Model 7001 IEEE Address for use with National Instruments
board commands.
IeeeIn%Integer value of the Þle handle used for IOTech Driver 488 input operations.
IeeeOut%Integer value of the Þle handle used for IOTech Driver 488 output operations.
Resp$2048 byte Þxed-length string used for the input string on all IEEE-488 read functions.
IeeeInterface%Contains a number from 1 to 4 indicating the IEEE interface as deÞned by the constants
below:
IEEECEC (1)Capital Equipment Corp.
IEEEIOTECH (2)IOTech Driver 488
IEEENATIONALOLD (3)National Instruments NI-488 (C.10 or C.11)
IEEENATIONALNEW (4)NI-488 (C.12 or greater) or NI-488.2
OutOfRange%Set to TRUE (-1) whenever a parameter given to a Set Model 2001/7001 routine is out
of range.
NOTE
These variables also support the Model 7002 Switch System.
73
74
Appendix B
Model 2001 / 7001 Constants
The following Model 2001/7001 Support Software CONSTants are deÞned to make using the support software easier. The use of these constants are deÞned below and in the appropriate group of routines that use
them.
NOTE
These constants also support the Model 7002 Switch System.
B.1Function Constants
DCV (1)DC VoltageACV (2)AC Voltage
DCA (3)DC CurrentACA (4)AC Current
R2 (5)2-wire ResistanceR4 (6)4-wire Resistance
FREQ (7)FrequencyTEMP (8)Temperature
B.2Status Model Constants
For use with Stat2001, Stat2001Q$, Stat7001, Stat7001Q$:
Constants for use with *STB?, *SRE, *SRE?, and serial poll:
MSB ( 1)Measurement Summary Bit (Model 2001 Only)
EAV ( 4) Error Available
QSB ( 8)Questionable Summary Bit (in Model 7001 only for SCPI)
MAV ( 16)Message Available
ESB ( 32)Event Summary Bit
RQS1 ( 64)Request for Service (Serial Poll)
MSS ( 64)Master Summary Status (Status Byte)
OSB (128)Operation Summary Bit
75
Constants for use with *ESR?, *ESE, and *ESE?:
OPC ( 1)Operation Complete
RQC ( 2)Request Control (not used in Model 2001/7001)
QYE ( 4)Query Error
DDE ( 8)Device SpeciÞc Error
EXE ( 16)Execution Error
CME ( 32)Command Error
URQ ( 64)User Request
PON (128)Power On
Constants for use with the Operation Event Condition Register, Positive Transition Filter, Negative Transition Filter, Status Register, and Status Enable Register:
CAL ( 1)Calibrating (Model 2001 only)
SET ( 2)Settling
TRIG ( 32)Waiting for Trigger
ARM ( 64)Waiting for Arm
CALC ( 512)Calculating (Model 2001 only)
SCAN (1024)Scanning (Model 7001 only)
IDLE (1024)in IDLE layer (Model 2001 only)
Constants for use with the Trigger Event Condition Register, Positive Transition Filter, Negative Transition
Filter, Status Register, and Status Enable Register:
SEQ1 (2)Model 2001/7001 is in the Trigger Layer of Sequence 1.
Constants for use with the Arm Event Condition Register, Positive Transition Filter, Negative Transition Filter, Status Register, and Status Enable Register:
SEQ1 (2)Model 2001/7001 is in the ARM Layer of Sequence 1.
Constants for use with the Sequence Event Condition Register, Positive Transition Filter, Negative Transition Filter, Status Register, and Status Enable Register:
LAY1 (2)Model 2001 or 7001 is in the Arm Layer 1 of Sequence 1.
LAY2 (4)Model 2001 or 7001 is in the Arm Layer 2 of Sequence 1.
Constants for use with the Model 2001 Questionable Event Condition Register, Positive Transition Filter,
Negative Transition Filter, Status Register, and Status Enable Register:
QTEMP ( 16)Questionable Calibration Process
QCAL ( 128)Questionable Calibration Process
WARN (16384)Command Warning
76
Constants for use with the Model 2001 Measurement Event Condition Register, Positive Transition Filter,
Negative Transition Filter, Status Register, and Status Enable Register:
Use these constants with the Model 2001 Auto measurement functions, like AutoDCV, or any Model 2001/
7001 function that requires an ON or OFF state.
NO (-1)DonÕt set automatic parameter.
TOFF (+0)Turn off automatic parameter.
TON (+1)Turn on automatic parameter.
ONCE (+2)Set auto parameter for the next measurement.
AutoGraphicsMode, IOTECH, ParseQuery, Str1, DataViewS, XYGraphS, DataViewD, XYGraphD
GENERAL .OBJ Ñ Object Þle from BASIC 7.1 GENERAL.BAS
MAKEFILE. Ñ File for BASIC 7.1 NMAKE program to create various the *.LIB, *.QLB, *.EXE Þles of the
BASIC 7.1 routines
MENU .OBJ Ñ Object Þle from BASIC 7.1 MENU.BAS
MOUSE .OBJ Ñ Object Þle from BASIC 7.1 MOUSE.BAS
QBX .LIB Ñ Library Þle from BASIC 7.1
UIASM .OBJ Ñ Object Þle from BASIC 7.1
WINDOW .OBJ Ñ Object Þle from BASIC 7.1 WINDOW.BAS
80
C.1.4 Capital Equipment Corp. (CEC) IEEE-488 Interface Files
Read2001BufferS, Read2001BufferD
NATQBX1 .LIB Ñ BASIC 7.1 old NI 2001/7001 driver library
NATQBX1 .QLB Ñ BASIC 7.1 old NI 2001/7001 driver quick library
NATQBX1 .BAT Ñ BASIC 7.1 old NI 2001/7001 QBX environment loader
NI4881B7.BI Ñ Old NI header Þle
NI4881B7.OBJ Ñ Old NI object Þle
NI4881B7.C Ñ Old NI-488 BASIC 7.1 to Quick C link C Þle
NI4881B7.H Ñ Old NI-488 BASIC 7.1 to Quick C link header Þle
NI4881 .LIB Ñ Old NI-488 BASIC 7.1 to Quick C link library
NI4881 .OBJ Ñ Old NI-488 BASIC 7.1 to Quick C link object Þle
MAKENAT1.BAT Ñ Makes all *.OBJ, *.LIB, *.QLB, and *.EXE Þles for National Instruments NI-488 (rev C.11
and older)
MAKENAT1.LNK Ñ Make old NI Demo Program
2001NAT1.EXE Ñ 2001 National Instruments (NI-488 rev <= C.11) Demo Program
81
C.1.7 National Instruments NI-488 rev C.12 (and newer) and NI-488.2 Files
NATQBX2 .BAS Ñ BASIC 7.1 new NI 2001/7001 driver library source
Read2001BufferS, Read2001BufferD
NATQBX2 .LIB Ñ BASIC 7.1 new NI 2001/7001 driver library
NATQBX2 .QLB Ñ BASIC 7.1 new NI 2001/7001 driver quick library
NATQBX2 .BAT Ñ BASIC 7.1 new NI 2001/7001 QBX environment loader
NI4882B7.BI Ñ New NI header Þle
NI4882B7.OBJ Ñ New NI object Þle.
MAKENAT2.BAT Ñ Makes all *.OBJ, *.LIB, *.QLB, and *.EXE Þles for NI-488.2 and NI-488 (rev C.12 and
newer)
MAKENAT2.LNK Ñ Make new NI Demo Program
2001NAT2.EXE Ñ 2001 NI-488 rev >= C.12 & NI-488.2 Demo Program
C.2Microsoft QuickBasic 4.5 File Names
C.2.1 Model 2001/7001 IEEE Interface Independent Files
KISend, KISendGET, KISendSDC, KIWaitRQS, ModelNumber, SetupIEEE
IOTECHS .BAS Ñ QuickBASIC 4.5 IOTech 2001/7001 source Read2001BufferS
IOTECHD .BAS Ñ QuickBASIC 4.5 IOTech 2001/7001 source Read2001BufferD
MAKEIOT .BAT Ñ Makes all *.OBJ, *.LIB, *.QLB, and *.EXE Þles for IOTech Driver 488.
C.2.4National Instruments NI-488 rev C.11 Files
NAT488_1.BAS Ñ QuickBASIC 4.5 old NI 2001/7001 source DataInvalid, Gpiberror, KIOPC, KIPoll, KIQ,
KISend, KISendGET, KISendSDC, KIWaitRQS, ModelNumber, SetupIEEE
NAT4881S.BAS Ñ QuickBASIC 4.5 old NI 2001/7001 source Read2001BufferS
NAT4881D.BAS Ñ QuickBASIC 4.5 old NI 2001/7001 source Read2001BufferD
NAT488_1.LIB Ñ QuickBASIC 4.5 old NI 2001/7001 driver library
NAT488_1.QLB Ñ QuickBASIC 4.5 old NI 2001/7001 quick library
NI4881QB.BI Ñ Old NI header Þle
NI4881QB.OBJ Ñ Old NI object Þle
MAKENAT1.BAT Ñ Makes all *.OBJ, *.LIB, *.QLB, and *.EXE Þles for National Instruments NI-488 (rev C.11
and older)
83
C.2.5National Instruments NI-488 rev C.12 (and newer) and NI-488.2 Files
NAT488_2.BAS Ñ QuickBASIC 4.5 new NI 2001/7001 source DataInvalid, Gpiberror, KIOPC, KIPoll, KIQ,
KISend, KISendGET, KISendSDC, KIWaitRQS, ModelNumber, SetupIEEE
NAT4882S.BAS Ñ QuickBASIC 4.5 new NI 2001/7001 source Read2001BufferS
NAT4882D.BAS Ñ QuickBASIC 4.5 new NI 2001/7001 source Read2001BufferD
NAT488_2.LIB Ñ QuickBASIC 4.5 new NI 2001/7001 driver library
NAT488_2.QLB Ñ QuickBASIC 4.5 new NI 2001/7001 quick library
NI4882QB.BI Ñ New NI header Þle
NI4882QB.OBJ Ñ New NI object Þle.
MAKENAT2.BAT Ñ Makes all *.OBJ, *.LIB, *.QLB, and *.EXE Þles for NI-488.2 and NI-488 (rev C.12 and
newer)
84
Quick C2.5
Table of Contents
Section 1 — Using the Library Routines..........................................................................91
1.1.4Quick C 2.5............................................................................................................................................ 91
1.2.1Quick C 2.5............................................................................................................................................ 92
3.2int Take2001BufferReadings( int Func, int BurstMode, int NumDataPoints1,
int Compact); ............................................................................................................................................... 99
3.3int Read2001Buffer( ßoat or double *ArrayName, int DMA, int Fmt); int _Read2001Buffer
( void *ArrayName, unsigned int ArraySize, unsigned int ElementSize, int DMA,
int Fmt); ...................................................................................................................................................... 101
Section 4 — General Routines ......................................................................................103
4.1char *ParseQuery( char *response, char *Quer, int QuerNum);......................................................... 103
4.2char *IOTECH( char *response, int Address);....................................................................................... 104
85
4.3void XYGraphS( ßoat *XArray, ßoat *YArray, unsigned int YStart, unsigned int YStop,
char *XTitle, char *YTitle, char *Title, char UseCGA2, char MaxMinScale);
void _XYGraphS( ßoat *XArray, unsigned int NumX, ßoat *YArray, unsigned int NumY,
unsigned int StartNum, unsigned int StopNum, char *XTitle, char *YTitle, char *Title,
char UseCGA2, char MinMaxScale);
void XYGraphD( double *XArray, double *YArray, unsigned int YStart, unsigned int YStop,
char *XTitle, char *YTitle, char *Title, char UseCGA2, char MaxMinScale);
void _XYGraphD( double *XArray, unsigned int NumX, double *YArray, unsigned int NumY,
unsigned int StartNum, unsigned int StopNum, char *XTitle, char *YTitle, char *Title,
int CheckMinInf);.......................................................................................................................................110
5.7int Hit2001Key( int HitKey); ....................................................................................................................111
6.3DC Voltage Functions............................................................................................................................... 122
6.3.1int Set2001DCV( double Range, double Time, double Digits);................................................... 122
6.4AC Voltage Functions............................................................................................................................... 124
6.4.1int Set2001ACV( double Range, double Time, double Digits);................................................... 124
6.5DC Current Functions.............................................................................................................................. 127
6.5.1int Set2001DCA( double Range, double Time, double Digits);................................................... 127
6.6AC Current Functions.............................................................................................................................. 129
6.6.1int Set2001ACA( double Range, double Time, double Digits);................................................... 129
9.3int Calc1_2001( int State);......................................................................................................................... 162
9.7int Calc2_2001( int State);......................................................................................................................... 164
9.12int Calc3_2001( int State);......................................................................................................................... 167
9.13int Set2001Calc3Dig( int Du1, int Dl1, int Du2, int Dl2);..................................................................... 167
B.2Status Model Constants ........................................................................................................................... 173
C.5National Instruments NI-488 rev C.12(and newer) and NI-488.2 Files............................................. 178
89
90
Section 1
Using the Library Routines
1.1Installation
1.1.1 National Instruments GPIB.COM
You must have at least Rev C.10 of the National Instruments NI-488 Software or at least Rev 1.0 of the National Instruments NI-488.2 Software to use the 2001/7001 Support Software. Some older revisions may
work, but they are not guaranteed by Keithley to do so. Use the following settings to set up your National
Instruments Card (AT-GPIB card listed here, use all that are applicable) when you are conÞguring
GPIB.COM with IBCONF.EXE.
CIC Protocol .............................................................. no
Disable Device Unaddressing................................. no
1.1.2 Capital Equipment Corp.
You must have at least Rev 2.14 of the Capital Equipment Corp. Software to use the 2001/7001 Support Software. All older revisions will not work without the removal of setatnmode() from SetupIEEE() in CEC.C.
1.1.3 IOTech Driver 488
You must have at least Rev 2.6 of the IOTech Driver 488 Software to use the 2001/7001 Support Software.
Some older revisions may work, but they are not guaranteed by Keithley to do so.
1.1.4 Quick C 2.5
Type A:INSTALL or B:INSTALL to install the Quick C 2.5 2001/7001 support software. The installation program will prompt you for certain information that it needs to copy Þles and build the make Þles
91
MAKECEC.BAT, MAKEIOT.BAT, MAKENAT1.BAT, and MAKENAT2.BAT. These Þles will build the *.OBJ,
*.LIB, and *.QLB needed to use the routines.
Installation Notes:
1. QCL.EXE and LIB.EXE must be installed in the Quick C 2.5 Compiler Directory.
2. NMAKE.EXE must be installed in the NMAKE directory.
3. IEEE488.LIB (if installing CEC) and LLIBC7.LIB and/or LLIBCE.LIB must reside in the Library Files Directory to make programs.
4. STRING.H, STDLIB.H, STDIO.H, CONIO.H, DOS.H, TIMR.H, GRAPH.H and FCNTL.H must reside
in the Include Files Directory.
5. The 2001/7001 Support Software directory must exist and you will be prompted to build it if not.
6. The Install Source Code Only option will install only the *.C and *.H Þles and not check for any of the
Quick C 2.5 Þles listed above. MAKECEC.BAT, MAKEIOT.BAT, MAKENAT1.BAT, and
MAKENAT2.BAT will still be created and can be edited later.
7. The Þle GENERAL1.C is the only module that uses Quick C 2.5 speciÞc routines for data and graphical
displays. The other modules were made as ANSI-C as possible, which allows for their use on any platform with the use of the proper CEC, IOTech, and National Instruments include Þles, object modules,
and libraries as supplied by the IEEE-488 interface manufacturers.
1.2General Instructions
1.2.1 Quick C 2.5
In your program, use #include Ò20017001.HÓ which contains the 2001/7001 library function deÞnitions and
CONSTants. Also, make sure that you are compiling in the large or huge data model since the libraries use
the huge model. Furthermore, at least 4096 bytes of stack space should be used when creating an executable
with ILINK. When creating a *.MAK Þle include your program name and:
¥CEC.LIB and IEEE488.LIB for CEC,
¥IOTECH.LIB for IOTech Driver 488,
¥NAT488_1.LIB for old NI-488, or
¥NAT488_2.LIB for new NI-488 and NI-488.2.
If using DataViewS, DataViewD, XYGraphS, or XYGraphD make sure to specify GRAPHICS.LIB if it is not
included in LLIBC7.LIB or LLIBCE.LIB. A sample setup follows:
#include Ò20017001.hÓ
int SetupErr;
char response[2048];
/*
start of user program here
*/
SetupErr = SetupIEEE(0,0);/* Setup IEEE Interface */
SetupErr = SetupIEEE(2001,16);/* Setup 2001 at IEEE Address 16 */
SetupErr = SetupIEEE(7001,7);/* Setup 7001 at IEEE Address 7 */
/*
User program follows
*/
92
1.2.2 Documentation Notes
1. Query forms of a function have the format of function-nameQ( char * response, ...) which returns a
pointer to response containing a query string of the speciÞed Model 2001/7001 parameters. Automatic
values are returned as 0 for OFF and 1 for ON.
2. If a function query returns more than one parameter, the responses will be separated by a semicolon (;)
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.
3. Any Model 2001/7001 command parameters out of range will not be sent to the instrument leaving the
previously set or default values intact. Most routines that have a return type of int will return a -1 for a
parameter out of range.
4. Most Model 2001/7001 parameters that are double precision values will accept the constants MAXIMUM, MINIMUM, and DEFAULT. INF will be accepted for Trigger Model Count1 and Count2 parameters.
5. All example code fragments assume that Quick C 2.5 setup commands listed above were used before
issuing any commands.
6. 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 comparable to the short and long form notation used for SCPI commands.
7. See Appendix A for a description of the Global Variables used in the Model 2001/7001 support software.
8. See Appendix B for a description of the deÞned CONSTants used in the Model 2001/7001 support software.
9. See Appendix C for a list of all Quick C 2.5 Þle names used by the Model 2001/7001 support software.
93
94
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.
NOTE
These functions and subroutines also support the Model 7002 Switch System. Just send
Model 7001 commands to a Model 7002.
2.1int SetupIEEE( int Device, int 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 and 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
0Initialize interface only
2001Change the IEEE address of the 2001 only
7001Change the IEEE address of the 7001 only
Address
0-30if Device is 2001 or 7001
ignoredif Device is 0
Returns
0if no errors.
-1if a parameter is out of range.
-2if an IEEE-488 timeout error occurred.
Global V ariables Affected (see Global Variables Appendix A)