Example Programs E-7
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 DCV1 function and displays them on the
computer CRT.
' 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 2182 in idle
CALL SEND(7, "*rst", status%)
CALL SEND(7, "trac:cle", status%)
CALL SEND(7, "sample:coun 10", status%)
CALL SEND(7, "form:elem read,unit", status%)
CALL SEND(7, "read?", status%)
reading$ = SPACE$ (300)
CALL ENTER(reading$, length%, 16, status%)
PRINT reading$