Page 31 of 52
X.
Download Protocol
There are two commands you can use to get archived data records from the console. "
DMP
"
download all data records, while "
DMPAFT
" only downloads the records archived "after" a
selected time and date. The other advantage of the "
DMPAFT
" command is that the data blocks are
sorted so that the oldest data downloaded is in the first page sent. The "
DMP
" command on the
other hand always starts with "page zero" which may not be the oldest data if the archive
memory has filled up.
This section will concentrate on the operation of the "
DMPAFT
" command. The "
DMP
" command is
identical in operation except that you do not send or receive any additional data between sending
the command and receiving archive records.
In order to use the "
DMPAFT
" command you need to determine the time and date-stamp of the last
record that you already have, AND this record should match one of the records already archived
in the WeatherLink data logger. (if the data is not found, then the entire contents of the data
archive will be downloaded.)
To calculate the time and date-stamps, use these formulas: (hour is in 24 hour format, both of
these values are 2-byte values)
vantageDateStamp = day + month*32 + (year-2000)*512);
vantageTimeStamp = (100*hour + minute);
Use zero for both of these values (and the CRC) to force a full download.
Send the command "
DMPAFT
" to the Vantage Pro
When you get an <ACK> back, send the 2 byte vantageDateStamp, the 2 byte
vantageTimeStamp, and a 2 byte CRC value calculated from them. See section XI for more
information on calculating CRC values. Send the MSB of the CRC first, then the LSB.
If the CRC is correct, the console will send back another <ACK> the number of "pages" that will
be send (2 bytes), the location within the first page of the first record, and 2 Byte CRC.
If the CRC is not correct, the vantage will respond with 0x18. If you do not sent 6 bytes, it will
respond with 0x21.
Note that while the console tells you which record in the first page it sends contains the first new
data record, it does not tell you which record in the last page it sends is the last new data record.
Records after the most recent will either contain all 0xFF bytes (if the archive has never been
completely filled), or will contain old data records.
At this point you can either send an <ESC> = 0x1B to cancel the download, or an <ACK> to
start the download.
After receiving each page of data, calculate the CRC value. If the CRC was incorrect, send 0x21
(really "!" but used as <NAK>) to have the Vantage send the page again.
Otherwise, send <ACK> to receive the next page (if there is one), or <ESC> to cancel the
download early.