Hello,
I would like to reprogram a CR1000 with a data card at a remote site with a new program. The new program does not change any of the table definitions.
It appears that reprogramming a CR1000 with new code that does not change the table definitions sometimes does and sometimes does not cause all the data to be erased on the logger itself.
My question is, if I reprogram the logger with new software which doesn't change any of the data tables, is it safe to assume that the card data would be retained and continue to store new data? Provided I instruct loggernet not to erase the card files during reprogramming.
Thanks,
Steve
On the datalogger itself (files stored to the CPU), the rules for CR1000/CR800/CR3000 are as follows (this is copied from the most recent CRBasic help, though I think this version of the help is being released with the new OS, which is due any day now :)
When using the "Preserve data if no table changed" option, existing data and data table structures are retained unless one of the following occurs:
· Data table name(s) change
· Data interval or offset change
· Number of fields per record change
· Number of bytes per field change
· Number of records per table (table size) change
· Field type, size, name, or position change
To summarize, any change in data table structure will delete all tables on the datalogger's CPU, regardless of whether or not the Preserve Data option was chosen. If the Preserve Data option was chosen but the datalogger was unable to retain the existing data, the following message will appear in the Compile Results: Warning: Internal Data Storage Memory was re-initialized.
Also from the help, with regard to data stored on cards:
Caution: Neither of these options ("preserve data" and "delete associated data tables") affects existing data files on a card if one is being used. If a data table exists on the card that has the same name as one being output with the new program, the message will be returned "Data on Card is from a different program or corrupted". Data will not be written to the card until the existing table is deleted. Data tables on the card that have different names than those declared in the new program will be maintained and will not affect card data storage when the new program is running.
So, your answer to "can I safely assume..." is NO! I haven't tested this in a while, but based on the documentation, data storage to the card would stop. This paragraph may assume a different program name... I am not certain.
Whatever you do, test, test and test again :) Make sure you understand exactly how it will behave before deploying in the field.
I did do quite a bit of testing in regards to data stored on the CPU itself, and can confirm that it does work the way the rules above state.
Hope this helps,
Dana W
Hi Dana,
Thanks for the detailed reply. I've read over most of the documentation at one time or another but I'm having trouble getting it to sink in ;)
I pulled all the data remotely before I reprogrammed the logger and now data is not being recorded to the card as expected. "Data on Card is from a different program or corrupted".
Assuming that I have collected all the data from the logger, can I using file control reformat the card and have it rebuild the tables. Or put another way, what is the best way to format the card so the logger will store its data there?
Thanks again,
Steve
You should be able to just delete the files using file control, rather than having to reformat the card.
You might also want to look at deleting files under program control. You could write some code that runs only once (when the program is first loaded), that uses the FileList instruction to list the files on the card, and then the FileManage instruction to delete the files on the card. If you knew that the FileNames were always the same you could just delete them (without needing the FileList). You'll need to run some tests to see how it works out... the "run once" code may need to be a separate program that runs, deletes the card files, and then runs the new program (running a different program can also be accomplished with FileManage).
Just some ideas... I hope it helps.
Dana W.