User guide
eWON 500-2001-4001-4002 User Guide - Programming the eWON
eWON 500®2001®4001®4002® Version 4_3_0 - User Guide - 10/5/05 - ©ACT'L sa - Page 154
9.2.56 ONTIMER
Syntax [command]
ONTIMER E1,S1
• E1 is the timer number (see TSET page 167)
• S1 is the command line to execute when timer expires.
Purpose:
Executes S1 command line when E1 expires.
The EVTINFO parameter (see GETSYS page 141) is set to the timer number when command is called.
Example:
See also:
“GETSYS, SETSYS” on page 141, “ONxxxxxx” on page 151, “TSET” on page 167
9.2.57 OPEN
9.2.57.1 Introduction to file management
Files accessed in BASIC can be of 4 different types:
• Files from the /usr directory (or from other directories such as /sys)
• Serial communication link
• TCP or UDP socket
• Export Block Descriptor
9.2.57.2 OPEN general syntax
There are two different modes of operation for the file access:
• BINARY mode: file is read by blocks of bytes
• TEXT mode: files are read or written as CSV files
See the “GET” on page 138 and “PUT” on page 160 commands for a detailed difference between the BINARY and TEXT mode outputs.
There are 3 operation types:
When binary mode is used, the data written to the file are strings of characters that are considered as stream of bytes.
The GET command returns the amount of bytes requested.
When Text mode is used, the operation is completely different: the PUT operation is more like a PRINT command directed to file,
the data are formatted as text, and each data is separated by a ‘;’ in the output file (strings are exported between quotes).
The GET command works like a READ command, the file is read sequentially and each GET returns one of the ‘;’ separated element,
the type of the data returned depends on the type of data read.
In both modes, files are read sequentially until end of file is reached. End of file can be tested with the EOF function.
The eWON user flash file system allows up to 8 files to be simultaneously opened for read (even twice the same file), and 1 file opened for write.
If a file is opened for read it cannot be opened for write at the same time (and vice versa).
Running the program will close any previously opened files (not GOTO).
ONTIMER 1,"goto Timer1"
ONTIMER 1, "LOGIO ‘mytag’ "
Parameter
value
Description
INPUT
The file must exist it is opened for a read only operation
The file pointer is set to the beginning of the file
OUTPUT The Path must exist. If the file exists it is erased first. The file is opened for write only operation
APPEND
The Path must exist. The file must not exist. If the file does not exist, it is created (like with OUTPUT type),
if the file exists, it is opened and the write pointer is located at the end of the file.
The file is opened for write only operation
Table 99: OPEN read and write operations parameters