Taking Readings Using The :Read? Command; Controlling The Model 2010 Via The Rs-232 Com2 Port - Keithley 2010 User Manual

Hide thumbs Also See for 2010:
Table of Contents

Advertisement

C-12
Example Programs

Taking readings using the :READ? command

This programming example demonstrates a simple method for taking and displaying (on the
computer CRT) a specified number of readings. The number of readings is specified by the
:SAMPle:COUNt command. When :READ? is asserted, the specified number of readings is
taken. After all the readings are taken, they are sent to the computer. Note that these readings are
also stored in the buffer.
The following program takes 10 readings on the DCV function and displays them on the
computer CRT.

Controlling the Model 2010 via the RS-232 COM2 port

This example program illustrates the use of the Keithley Model 2010 interfaced to the RS-232
COM2 port. The Model 2010 is set up to take 100 readings at the fastest possible rate (2000 per
second). The readings are taken, sent across the serial port, and displayed on the screen.
' For QuickBASIC 4.5 and CEC PC488 interface card
' edit the following line to where the QuickBASIC libraries are
' on your computer
' $INCLUDE: 'c:\qb45\ieeeqb.bi
' Initialize the CEC interface as address 21
CALL initialize(21, 0)
' Reset controls, clear buffer and place 2010 in idle
CALL SEND(16, "*rst", status%)
CALL SEND(16, "trac:cle", status%)
CALL SEND(16, "sample:coun 10", status%)
CALL SEND(16, "form:elem read,unit", status%)
CALL SEND(16, "read?", status%)
reading$ = SPACE$ (300)
CALL ENTER(reading$, length%, 16, status%)
PRINT reading$
' Example program controlling the Model 2000 vi1 the RS-232 COM2 port
' For QuickBASIC 4.5 and CEC PC488 interface card
RD$=SPACE$(1500)
CLS
PRINT "Set COM2 baud rate to 9600"
PRINT "Set no flow control, and CR as Terminator"
' Configure serial port parameters
ComOpen$="COM2:9600,N,8,1,ASC,CD0,CS0,DS0,LF,OP0,RS,TB8192,RB8192"
OPEN ComOpen$ FOR RANDOM AS #1
' Model 2010 setup commands
' Note Serial communications only operate with SCPI mode....
PRINT #1, "*RST"
PRINT #1, "*CLS"
' Set string space
' CLear screen
' Clear registers
' Clear Model 2010

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents