beautypg.com

2 ser.receive(timeout), 3 ser.read(), 4 ser.sendbyte(byte) – Rainbow Electronics GM862-GPS User Manual

Page 31

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 31 of 100

2.4.2 SER.receive(timeout)

This command receives a string from serial port TXD/RXD waiting for it until timeout is expired. Return
value will be the first string 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 the serial port ASC0.
Return value is a Python string which is an empty string if timeout expired without any data received
otherwise is the string containing data received.

Example:

a = SER.receive(15)

receives a string from serial port ASC0 handling, waiting for it for 1.5 s, assigning return value to a.

2.4.3 SER.read()

This command receives a string from serial port TXD/RXD without waiting for it. It has no input
parameter. Return value is a Python string which is an empty string if no data received otherwise is
the string containing data received in the moment when command is activated.

Example:

a = SER.read()

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

NOTE: the buffer available for the SER.receive(timeout) and SER.read() commands is 4096 bytes

6

.

2.4.4 SER.sendbyte(byte)

This command sends a byte to serial port TXD/RXD. Input parameter byte is any Python byte that will
be send to serial port. It can also be zero.
Return value is a Python integer which is -1 if an error occurred otherwise is 1.

Example:

b = SER.sendbyte(0x0d)

sends byte 0x0d, that is , to serial port ASC0 handling, assigning return value to b.

6

For the products with the following old Order-Num. 3390250656, 3390250654 and 3990150466 the available

buffer is 256 bytes