5 ser2.receivebyte(timeout), 6 ser2.readbyte(), 7 ser2.set_speed(speed, ) – Rainbow Electronics GM862-GPS User Manual
Page 37

Easy Script
in Python
80000ST10020a Rev.8 - 01/10/08
Reproduction forbidden without Telit Communications S.p.A. written authorization - All Rights Reserved
page 37 of 100
2.5.5 SER2.receivebyte(timeout)
This command receives a byte from serial port ASC1 waiting for it until timeout is expired. Return
value will be the first byte received no matter of how long the timeout is. Input parameter timeout is a
Python integer which is measured in 1/10s, and represents the maximum time of waiting for the string
from serial port ASC1.
Return value is a Python integer which is -1 if timeout expired without any data received otherwise is
the byte value received. It can also be zero.
Example:
b = SER2.receivebyte(20)
receives a byte from serial port ASC1 handling, waiting for it for 2.0 s, assigning return value to b.
2.5.6 SER2.readbyte()
This command receives a byte from serial port ASC1 without waiting for it. No input parameter.
Return value is a Python integer which is -1 if no data received otherwise is the byte value received. It
can also be zero.
Example:
b = SER2.readbyte()
receives a byte from serial port ASC1 handling, assigning return value to b.
2.5.7 SER2.set_speed(speed,
This command sets serial port ASC1 speed. Default serial port ASC1 speed is 9600. First input
parameter speed is a Python string which is the value of the serial port speed. It can be in the range
from '300' to '115200'. Second input parameter format is optional and is a Python string which is the
serial port format. It can be ‘8N1’, ‘8N2’, ‘8E1’, ‘8O1’, ‘7N1’, ‘7N2’, ‘7E1’, ‘7O1’, or ‘8E2’.
Return value is a Python integer which is -1 if an error occurred otherwise is 1.
Example:
b = SER2.set_speed('115200')
sets serial port ASC1 speed to 115200, assigning return value to b.