Telit EZ10-GPRS/-PCS
Product Description
80269ST10014a, Rev. 3 – 26/09/05
Reproduction forbidden without written authorization by Telit Communications S.p.A.
Page 57 of 74
All Rights reserved – Right of modification reserved
For example (script name and size are examples):
AT#WSCRIPT=”a.py”,110
wait for the prompt
>>>
and use “Send Text file” with ASCII Setup: Send line ends with line feeds in HyperTerminal
enabled.
Wait for download result: OK.
3.3.6.3 Enable Python script
Select the Python script which will be executed (the enabled script) from the next start-up and on
using the AT#ESCRIPT command.
First choose the script you want to enable between the ones you downloaded:
AT#LSCRIPT? can help you checking the names of the scripts;
for example:
AT#ESCRIPT=”a.py”
Wait for enable result: OK.
3.3.6.4 Execute Python script
The Python script you downloaded to module and enabled is executed at every module power on if
the DTR line is sensed LOW (2.8V at the EZ10-PYTHON DTR pin - RS232 signals are inverted -)
at start-up, (then no AT command interface is connected to the modem port) and if the script name
you enabled matches one of the script names of the scripts you downloaded.
The Python script is executed with –v -S -OO options.
In order to gain again the AT command interface on the modem physical port (for example to
update locally a new script) the module shall be powered on with the DTR line HIGH (0V at the
EZ10-PYTHON DTR pin) so that the script is not executed and the Python engine is stopped.
The real execution of the Python script is delayed from the power on due to the time needed by
Python to parse the script. The longer is the script, the longer is this delay.
Note that only the running script is compiled at run time, all the others that this script may include
are compiled once and the compiled result is saved in the NVM as a file with extension .pyo.
This delay can be greatly reduced with a simple stratagem:
-
type your script normally, and include the main loop in a function, for example "main()", save
it to the NVM of the module with a known name, for example appl.py
-
write a new script that includes the previous file object, for example "include appl", and this file
should call only the main function of the appl.py script, for example appl.main().
In this way the first time the script is executed the imported files will be compiled and the result
saved as compiled .pyo files (don't delete them during normal operations, but remember to delete
them if you change the corresponding .py script otherwise your changes will not take effect).
From the next start-up and on the imported files will not be anymore compiled and script
execution delay is greatly reduced.