PORTREADARRAY

Synopsis
PORTREADARRAY count buffer
Description

Reads data from the currently open port into the given buffer array. PORTREADARRAY attempts to read count bytes from the port, if they are available. When bytes are written to buffer, they are written as small integers (between -128 and 127). PORTREADARRAY outputs the actual number of bytes read.

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

Example
PORTOPEN "com1
PRINT SENTENCE [Sending...] PORTWRITEARRAY 3 LISTTOARRAY MAP [ASCII ?] [a t]
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