You may use CompactFlash or microSD memory cards for external storage of your datalogger data, but are you using your cards correctly? In this article, I’ll answer some common questions you may have about memory card usage.
Recommended for You: If you haven’t done so already, you may find it helpful to read the “Pick a Memory Card, but Not Just Any Memory Card” and “How to Store Datalogger Data to a Memory Card” blog articles.
When you press either the Initiate Removal button on the face of the NL116 or CFM100 modules (for CR1000 or CR3000 dataloggers) or the Eject button on the CR6 datalogger, two actions occur that are important to avoid data loss or corruption:
You may be interested to know that the requirement to suspend writing to a memory card before removing it from a device is not unique to dataloggers. Any device that writes to a memory card, including cameras, phones, computers, and dataloggers, should not be interrupted while accessing memory because open files are vulnerable to corruption (that is, scrambled or missing information).
If you have open files that become corrupted, your software may not be able to read the memory card. Oftentimes, your only option is to reformat the corrupted memory card, which erases all your data on the card.
To avoid corruption or loss of data, you should only eject a memory card after the status, or activity (Act) light (LED) on the NL116, CFM100, or CR6 displays a solid green color. A solid green LED indicates that buffered data on the CPU has been transferred to the card and that writing to the card has been safely suspended.
To avoid data loss, you should always collect or copy data from your memory card before sending a new program to your datalogger. However, how existing data files on your card are treated depends in part on whether data are written to the card via the TableFile() or CardOut() instruction.
Recommended for You: For more information about File Control, watch these videos: "Connect | Manage Storage Devices with File Control" and "Connect | Manage Files with File Control."
The answer depends on three things:
If data are written to your memory card via the TableFile() instruction, new files are written to the newly inserted card—as long as there is space available on the card.
If data are written to your memory card via the CardOut() instruction, and the card you inserted has old files that were created by the same program (that is, the old files have the same table definitions as the currently compiled program), new data are appended to the old files.
If the files on your memory card are from a different program or a different datalogger (that is, they have different table definitions), a card error occurs when you insert the card into your datalogger. In this case, the status or activity LED turns orange, and no new files are written to your memory card. To resume data storage to your card, delete the old files or edit the program to rename the new files.
The following fields are included in the check of table definitions:
To avoid the issue of no new files being written to a memory card if the table definitions do not match, you can enable the Delete CardOut Data Files if CardOut Data Table Mismatch setting in your datalogger by setting it to 1. This setting is found in the datalogger Settings Editor under the Advanced tab:
The Delete CardOut Data Files if CardOut Data Table Mismatch setting was added in OS 28 and later operating systems (for the CR1000/CR3000) and in OS 4 and later (for the CR6). With this setting enabled, your files with table definitions that don’t match the current running program are deleted from the memory card, and new files are written to your card.
Warning: Use caution when enabling the Delete CardOut Data Files if CardOut Data Table Mismatch setting to prevent the unintentional loss of data. (By default, this setting is NOT enabled.)
For both CardOut() and TableFile Option 64, data are written to your memory card in a binary format (TOB3) with a name consisting of the datalogger's Station Name, the DataTable name, and a .dat extension (stationname.tablename.dat). (A datalogger always has a Station Name. If a specific name is not assigned, the default name is the serial number of the datalogger.) The file is also assigned a date based on the time the program was compiled in the datalogger. To become human-readable, these binary files must be converted to ASCII (TOA5) using the CardConvert software (included in LoggerNet, PC400, PC200W, and other software).
Recommended for You: For more information on TableFile Option 64, read the “How to Store Datalogger Data to a Memory Card” blog article.
There are two methods to check on the well-being of your memory card while it is active in the datalogger, explained below.
If you have physical access to your datalogger, check the status of the LED. The different colors and flashing status mean different things:
Recommended for You: For more information on filling up memory space, read the “How to Know when Your Datalogger Memory Is Getting Full” blog article.
Check the CardStatus in the datalogger Status Table often. The status should be Card OK with no errors reported, as shown in the image below:
If any errors are reported, collect data from your memory card as soon as possible. The card may need to be formatted or replaced if it is damaged.
Tip: It is advisable to collect data as often as possible to avoid data loss from any unexpected events such as power loss, hardware or software malfunctions, or natural disasters.
Recommended for You: For more information about using Station Status to check the CardStatus, review the "Status Table Summary" slide with accompanying video.
I hope this article has answered your questions regarding storing your data to CompactFlash and microSD memory cards. If you have any memory card questions that I didn’t cover here, post them below.