9
OPERATION MANUAL
recv
recv
reads a string from the selected interface. The function reads data until one of the following
end conditions occur:
An End of Line is received.
There was a Timeout.
More than 256 characters were received via the serial interface without an End of Line.
In case of one of the last two conditions, an error message is generated and the script terminates.
Examples:
com.send("{M00****\r\n")
queries the current setpoint ...
s = com.recv()
receives the response from the interface ...
print("Received answer was: " + s)
and outputs the response.
recv_bytes
recv_bytes
reads a bytearray from the selected interface. The function reads data until one of the
following end conditions occur:
An End of Line is received.
There was a Timeout.
In case of a Timeout, an error message is generated and the script terminates.
Note: This should only be used for ModbusTCP.
Examples:
com.send_bytes(bytearray([0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xFF, 0x41])
ba = com.recv_bytes()
open
open(first, second)
opens an interface for data transmission. The transfer parameters are:
Ethernet: First parameter: IP address to be used to address the device.
The second parameter is the Ethernet port.
ModbusTCP: First parameter: IP address to be used to address the device.
The second parameter is the Ethernet port.
Serial interface: First parameter: Port used for communication. The serial interface permits the fol-
lowing options:
Under Windows the current Com Port -1. That is, 0 for COM1, 1 for COM2, ...
Under Linux the device to be used for communication (/dev/ttyS0, /dev/ttyUSB0, …).
The second parameter is the baud rate.
Examples:
com.open("192.168.0.1", 8081)
opens on Port 8081 an Ethernet connection to IP address
192.168.0.1.
com.open("192.168.0.1", 502)
opens on Port 502 an Ethernet connection to IP address
192.168.0.1.
com.open(0, 9600)
opens a connection via COM1 with 9600 Baud.
com.open("/dev/ttyACM0", 9600)
opens a connection via /dev/ttyACM0. A speed specification is
not required.
com.open("/dev/ttyS0", 115200)
opens a connection via /dev/ttyS0 (COM1 under Linux) with 115
kBaud.
set_timeout
Used to set the time after which the reception is aborted if no terminator character or no other char-
acters are received. The time value
set_timeout(time)
is specified in seconds or in fractions of
seconds.
Examples:
pySoftcheck.01.20171002.2
Liability for errors and misprints excluded.
pySoftcheck
Summary of Contents for Pilot ONE
Page 1: ...Operation Manual ...
Page 2: ......