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 139
9.2.26.2 /usr Syntax [function] – Text mode
GET E1[, E2]
• E1 is the file number (1-4)
E2 optional: buffer size. When a data is read from the file, it must be read in a buffer to be interpreted. The buffer must be able to hold at least the
whole item and the CRLF at the end of the line if the item is the last of the line. The default buffer size is 1000 bytes, if your file contains items that
may be bigger than 1000 bytes, you should specify this parameter, and otherwise you only have to specify the E1 parameter: file number.
Purpose:
Returns a STRING or a FLOAT according to the data read from the file. If the data read is surrounded with quotes, it is returned as a STRING, if
the data read is not surrounded with quotes, it is returned as a FLOAT. The function never returns an INTEGER.
The function moves the file read pointer to the next item. For string items, the ' quote or " quote can be used.
The separator between items is the ‘;’ character. When a CRLF (CHR$(13)+CHR$(10)) is found it is also skipped.
Example:
9.2.26.3 COM Syntax [function] – Binary mode
GET E1,E2
CLOSE
• E1: File number
• E2: maximum number of bytes to read from the serial port.
Purpose:
Returns a string with the data read from the serial port buffer.
If there are no data to read from the buffer the returned string is empty.
If E2 is specified and the buffer contains more than E2 bytes, the function returns with E2 bytes.
If E2 is specified and the buffer contains less than E2 bytes, then the function returns with the content of the buffer.
Then function always returns immediately.
REM: Attempting to USE a serial port used by an IO server is not allowed and returns an error.
Example:
OPEN “COM:2,... AS 1”
A$=GET 1,100
CLOSE 1
123;"ABC"
1.345;"HOP"
DIM A$[2,20]
DIM A[2]
OPEN "/myfile.txt" FOR TEXT INPUT AS 1
I%=1
ReadNext:
A[I%] = GET 1
A$[I%] = GET 1
I% = I%+1
GOTO ReadNext
IF EOF 1 THEN GOTO ReadDone
ReadDone:
CLOSE 1