Serial.read() - Keithley 2651A Reference Manual

High power system sourcemeter instrument
Hide thumbs Also See for 2651A:
Table of Contents

Advertisement

Section 7: Command reference
Allow ample time for the command to be processed before attempting to communicate with the
instrument again. If possible, set parity from one of the other command interfaces or from the front
panel.
The reset function has no effect on parity.
Example
serial.parity = serial.PARITY_NONE
Also see
RS-232 interface operation
serial.baud
(on page 7-163)
serial.databits
serial.flowcontrol

serial.read()

This function reads available characters (data) from the serial port.
Type
TSP-Link accessible
Function
Yes
Usage
data = serial.read(maxchars)
maxchars
data
Details
This function will read available characters from the serial port. It will not wait for new characters to arrive. As
long as maxchars is less than 200 characters, all characters received by the serial port (before the
serial.read() command is executed) are returned. If too many characters are received between calls to this
function, the RS-232 buffers will overflow and some characters may be lost.
Call this function as many times as necessary to receive the required number of characters. For optimal
performance, use a small delay between repeated calls to this function.
The data returned is the raw data stream read from the port. No characters, such as control characters or
terminator characters, are interpreted nor will the data stream be altered.
This function cannot be used if the serial port is enabled as a command interface; a settings conflict error will be
generated.
Example
data = serial.read(200)
print(data)
7-166
Model 2651A High Power System SourceMeter® Instrument Reference Manual
(on page 2-81)
(on page 7-164)
(on page 7-164)
Affected by
An integer that specifies the maximum number of characters to read
A string consisting of all data read from the serial port
NOTE
Sets parity to none.
Where saved
Default value
Read data from the serial port.
Output:
John Doe
The above output indicates that the string "John
Doe" was read from the serial port.
2651A-901-01 Rev. A / March 2011

Advertisement

Table of Contents
loading

Table of Contents