19-100
Return to
2600AS-901-01 Rev. B / September 2008
Section 19: Remote Commands
Series 2600A System SourceMeter® Instruments Reference Manual
serial.read
Function
Reads data from the serial port.
TSP-Link
accessibility
This function can be accessed from a remote TSP-Link node.
Usage
data = serial.read(maxchars)
maxchars
The maximum number of characters to read.
data
Returns a string consisting of all data read from the
serial port.
Remarks
• This function will read available characters from the serial port. It will not wait for new characters
to arrive. As long as
maxchars
is a relatively small number (less than several hundred
characters), all characters received by the serial port prior to the call will be returned. This might
be less than
maxchars
. If too many characters are received in between calls to this function, the
RS-232 buffers will overflow and some characters may be lost.
• This function can be called as many times as necessary to receive the required number of
characters. For optimal performance, it is suggested that a small delay be used between repeat
calls to this function.
• The data returned is the raw data stream read from the port. Control characters, terminator
characters, etc. will not be interpreted nor will the data stream be altered in any way.
• This function cannot be used if the serial port is enabled as a command interface. A settings
conflict error will be generated if the serial port is enabled as a command interface when this
function is called.
Also see
Example
Reads data from the serial port:
data = serial.read(200)
print(data)
Output:
John Doe
The above output indicates that the string “John Doe” was read from the serial port.
serial.write
Function
Writes data to the serial port.
TSP-Link
accessibility
This function can be accessed from a remote TSP-Link node.
Usage
serial.write(data)
data
Specify the data string to write.
Remarks
This function will write the given string to the serial port where it can be read by equipment (for
example, a component handler) connected to the other end of the serial port. No terminator
characters are added to the data. The data will be written exactly as is.
Also see
Example
Writes data string “1 2 3 4” to the serial port:
serial.write("1 2 3 4")