5 ser.receivebyte(timeout), 6 ser.readbyte(), 7 ser.set_speed(speed, <char format>) – Rainbow Electronics GM862-GPS User Manual

Page 32

Advertising
background image





Easy Script

in Python

80000ST10020a Rev.8 - 01/10/08

Reproduction forbidden without Telit Communications S.p.A. written authorization - All Rights Reserved

page 32 of 100

2.4.5 SER.receivebyte(timeout)

This command receives a byte from serial port TXD/RXD 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 ASC0.
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 = SER.receivebyte(20)

receives a byte from serial port ASC0 handling, waiting for it for 2.0 s, assigning return value to b.

2.4.6 SER.readbyte()

This command receives a byte from serial port TXD/RXD without waiting for it. It has 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 = SER.readbyte()

receives a byte from serial port ASC0 handling, assigning return value to b.

2.4.7 SER.set_speed(speed, <char format>)

This command sets serial port TXD/RXD speed. Default serial port TXD/RXD speed is 9600. Input
parameter speed is a Python string which is the value of the serial port speed. It can be the same
speeds as the +IPR command.

NOTE:
sending the +IPR command to the device is not affecting the physical serial, when using
Python engine you must use this function to set the speed of the port.

Optional Parameter <char format> is a Python string that represents the character format to be used:
first is the number of bits per char (7 or 8), then the parity setting (N - none, E- even, O- odd) and the
number of stop bits (1 or 2). Default value is "8N1".
Return value is a Python integer which is -1 if an error occurred otherwise is 1.

Example:

b = SER.set_speed('115200')

Advertising