RS-232 Operation Using QuickBASIC
The following example shows how to send command instructions and
receive command responses over the
RS-232
interface using QuickBASIC.
CLS
LOCATE 1, 1
DIM cmd$(100), resp$(1000)
’ Set up serial port for 9600 baud, even parity, 7 bits;
’ Ignore Request to Send and Carrier Detect; Send line feed,
’ enable parity check, reserve 1000 bytes for input buffer
’
OPEN "com1:9600,e,7,2,rs,cd,lf,pe" FOR RANDOM AS #1 LEN = 1000
’
’ Put the multimeter into the remote operation mode
PRINT #1, ":SYST:REM"
’
’ Query the multimeter’s id string
’
PRINT #1, "*IDN?"
LINE INPUT #1, resp$
PRINT "*IDN? returned: ", resp$
’
’ Ask what revision of SCPI the multimeter conforms to
PRINT #1, ":SYST:VERS?"
LINE INPUT #1, resp$
PRINT ":SYST:VERS? returned: ", resp$
’
’ Send a message to the multimeter’s display, and generate a beep
PRINT #1, ":SYST:BEEP;:DISP:TEXT ’HP 34401A’"
’
’ Configure the multimeter for dc voltage readings,
’ 10 V range, 0.1 V resolution, 4 readings
PRINT #1, ":CONF:VOLT:DC 10,0.1;:SAMP:COUN 4"
’ Trigger the readings, and fetch the results
PRINT #1, ":READ?"
LINE INPUT #1, resp$
PRINT ":READ? returned: ", resp$
END
RS-232 Operation Using QuickBASIC
Chapter 6 Application Programs
RS-232 Operation Using QuickBASIC
192
Summary of Contents for 34401A
Page 12: ...1 Quick Start 1 ...
Page 26: ...2 Front Panel Menu Operation 2 ...
Page 50: ...3 Features and Functions 3 ...
Page 103: ...4 Remote Interface Reference 4 ...
Page 135: ...SCPI Status System 4 Chapter 4 Remote Interface Reference The SCPI Status Model 135 ...
Page 170: ...5 Error Messages 5 ...
Page 182: ...6 Application Programs 6 ...
Page 196: ...7 Measurement Tutorial 7 ...
Page 214: ...8 Specifications 8 ...