Read
Description
You can read up to 512 bytes at a time using the Read command. If the num
parameter is larger than the number of bytes remaining to be read from the file, then only the remaining bytes are returned. Use the Info command to find the current position. Data is sent verbatim (i.e. raw data) from the file.
Format
R
fh
[num
[addr
]]
Parameters
fh
is a file handle (1 - 4). Use the Free Handle command to get a free file handle.num
is the number of bytes to read. Optional. If not specified, up to 512 bytes will be returned.addr
is the address at which to start reading. Optional.num
must be given for this parameter to be used.
Response Format
«sp» response | Successful (see below) |
Enn | An error occurred |
response
is preceded by a «sp»
, indicating a good read. The length of response is variable, and depends on the num
parameter, the position of the file handle, and the size of the file.
Example
File handle position = 0, file size = 38 bytes:
R 1
«sp»13:22:02 ADC1=4.9V«cr» 13:22:32 ADC1=4.9V«cr»
A subsequent read:
R 1
E07
Same file, read only 18 bytes (starting at address 0):
R 1 18 0
«sp»13:22:02 ADC1=4.9V