by Carolyn Ivans | Updated: 10/22/2020 | Comments: 5
You may use CompactFlash or microSD memory cards for external storage of your data logger 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 Data Logger 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 the CR1000 or CR3000), or the Eject button on the CR6, CR1000X, or GRANITE™ data loggers/data-acquisition systems, 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 data loggers. Any device that writes to a memory card, including cameras, phones, computers, and data loggers, 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 data logger. 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 data logger (that is, they have different table definitions), a card error occurs when you insert the card into your data logger. 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 data logger by setting it to 1. This setting is found in the data logger 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 data logger's Station Name, the DataTable name, and a .dat extension (stationname.tablename.dat). (A data logger always has a Station Name. If a specific name is not assigned, the default name is the serial number of the data logger.) The file is also assigned a date based on the time the program was compiled in the data logger. 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 Data Logger 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 data logger, explained below.
If you have physical access to your data logger, 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 Data Logger Memory Is Getting Full” blog article. |
Check the CardStatus in the data logger 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.
Comments
JanE | 02/20/2017 at 01:49 AM
Hi,
I have the impression that as long as a file is open on CRD (with FileOpen) it is not shown in File control (Connect Screen). Only after a FileClose it shows.
Cheers, Jan
Carolyn | 02/21/2017 at 08:07 AM
Hi, Jan,
Both CardOut and Tablefile option 64 preallocate memory for card files. This means that as soon as the instruction executes in the CRBasic program, the file will show up in File Control. A difference is that with CardOut, the file will remain open for writing as long as the program is running. For Tablefile option 64, a file is closed each time the time interval or number of records specified in the Tablefile instruction is met and then a new file is opened.
Carolyn
Carolyn | 02/21/2017 at 08:28 AM
Hi, Jan,
I should have added that Tablefile option 64 is the only option of Tablefile that preallocates memory (i.e. behaves the same as CardOut). Other options of Tablefile (such as option 8, ACSII) do not preallocate memory for the files written and hence will not appear in File Control before the first file is written.
Carolyn
mattkun | 01/31/2022 at 09:19 PM
Is it possible to set MicroSD as the default storage method? I'm intended to use it in my Campbell that is set on the mountain, so I'm on my way to something where I don't have to carry out my PC there just to use LoggerNet or PC400 apps. If it is possible, How should I do it? Thanks in advance
Carolyn | 01/31/2022 at 10:28 PM
Thanks for your question. In order to store data to a MicroSD you must use either the CardOut() or Tablefile() instruction in your CRBasic program. The blog article at the link below may be helpful.
https://www.campbellsci.com/blog/store-datalogger-data-to-memory-card
Or, refer to the CRBasic help for more information on the CardOut() and Tablefile() instructions, as well as example programs.
Let me know if you need anything else.
Thanks,
Carolyn
Please log in or register to comment.