58
RS-232 Operation Using QuickBACSIC
The following example shows how to send command instruction and receive
command responses over the RS-232 interface using QuickBASIC. This program has
been tested and can be used directly.
RS-232 operation using QuickBACSIC
CLS ' clear the display
LOCATE 1, 1
' Set the cursor at the first line of the first row
DIM
Recv$(100)
' Restore and receive the data array
OPEN "COM1:9600, N, 8, 2, RS, LF, PE" FOR RANDOM AS #1 LEN = 1000
' Baud Rate: 9600
' Parity Check: None
' Data Bit: 8
' Stop Bit: 2
' RS: sending RTS signal is forbidden
' LF: a <carriage return> followed by a <new line> automatically
' Visit: Random
' File number: 1
' #1 Length: 1000
PRINT #1, "SYST:REM"
' Put the power supply into the remote operation mode
PRINT #1, "OUTP ON"
' Enable the outputs
PRINT #1, "SYST:ERR?"
' Error message
LINE INPUT #1, Recv$
' Receive the data from the power supply
PRINT "SYST:ERR? : ", Recv$
' Output the received data on the display
Chapter 6 Tutorial
Tutorial