beautypg.com

5 ser2 built-in module, 1 ser2.send(string) – Rainbow Electronics GM862-GPS User Manual

Page 35

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

2.5 SER2 built-in module

7


SER2 built-in module is the interface between Python and mobile internal serial port ASC1 direct
handling. It is used when you want to send data from Python script to serial port ASC1 and receive
data from serial port ASC1 to Python script.
SER2 built-in module is available only for non-GPS products. When SER2 bulit-in module is imported,
ASC1 will not be available for trace and debug, in order to have these functionalities you should
activate CMUX on ASC0.
If you are using CMUX on ASC0 (AT#CMUXSCR=1) then fourth CMUX port will be available for trace
and debug.
If you want to use SER2 built-in module you need to import it first:

import SER2
than you can use SER2 built-in module methods like in the following example:
a = SER2.send('test')
b = SER2.sendbyte(0x0d)
c = SER2.receive(10)

which sends 'test' followed by and receives data waiting for one second.
More details about SER2 built-in module methods can be found the following paragraphs.

2.5.1 SER2.send(string)


This command sends a string to the serial port ASC1. Input parameter string is a Python string that will
be send to serial port ASC1.
Return value is a Python integer which is -1 if an error occurred otherwise is 1.

Example:

a = SER2.send('test')

sends string 'test' to serial port ASC1 handling, assigning return value to a.

NOTE: The buffer available for SER2.send command is 4096 bytes.


7

feature available for the modules with the following Order-Num. : GM862PYT***-***, GE863PYT***-***,

GE864PYT***-***, , GC864PYT***-***, GE864PYH***-***,.