PORTREADARRAY

Synopsis
PORTREADARRAY count buffer
Description

Read data from the currently open port into the given buffer array. PORTMODE attempts to read count many characters from the port, if they are available. When characters are written to buffer, they are written as small integers (between 0 and 255). PORTMODE outputs the actual number of bytes read.

If count is larger than the size of the buffer array, then the number of characters read is limited to the size of the buffer.

Example
PORTOPEN "com1
PRINT SENTENCE [Sending...] PORTWRITEARRAY 3 LISTTOARRAY MAP [ASCII ?] ARRAYTOLIST LISTTOARRAY "at
Sending... 2
SHOW PORTWRITECHAR 13
1
WAIT 60
MAKE "buff {0 0 0 0 0 0 0 0 0 0}
PRINT SENTENCE [Receiving...] PORTREADARRAY 10 :buff
Receiving... 9
PRINT SENTENCE [Data Rx...] MAP [CHAR ?] REMOVE [] ARRAYTOLIST :buff
Data Rx... at | |
O K |
PORTCLOSE

SourceForge.net Logo