Answers to 5 Common Questions about Storing Data to Memory Cards

by Carolyn Ivans | Updated: 10/22/2020 | Comments: 5

Search the Blog


Blog Languages

English
Français (French)


Subscribe to the Blog

Get an email when a new article is posted. Choose the topics that interest you most.


Area / Application

Product Category

Activity

Corporate / News

Enter your email address:



Suggest an Article

Is there a topic you would like to learn more about? Let us know.

Leave this field empty

memory cards with question mark

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.

#1 - Why do I have to push a button before removing a memory card from a data logger, and what happens if I don’t?

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:

  1. The transfer of buffered data on the CPU to the memory card is triggered.
  2. Further writing to the memory card is suspended.

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.   

#2 - What happens to data on my memory card if I send a new program while the card is inserted?

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.

  • If data are written to your memory card via TableFile(), files on the card are searched at program compile time. If a .dat file with the same name as a current TableFile() is found, the number at the end of the file is incremented, and new data files continue to be written.
  • If data are written to your memory card via CardOut() and you send a new file to your data logger via LoggerNet, LoggerNet sends a command to delete all old .dat files, and new files are written.
  • If a CardOut() program is sent from LoggerNet or DevConfig File Control, you are given the option to either preserve data if no table definitions have changed, or to delete old .dat files that are associated with the program being sent, as shown below:

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."

#3 - What happens if I swap in a memory card that has old data on it?

The answer depends on three things:

  1. How data are written to your memory card
  2. Whether the old data on your card have the same table definitions as the current program
  3. Whether the Delete CardOut Data Files if CardOut Data Table Mismatch setting is enabled on your data logger

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:

  • Model type
  • Serial #
  • Station Name
  • Program name
  • All table field information

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:

Advanced tab of the Settings Editor

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.)

#4 - Why do I need to use CardConvert software to read my memory card’s data files directly from the card?

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.

#5 - How can I tell if my memory card is OK?

There are two methods to check on the well-being of your memory card while it is active in the data logger, explained below.

Check the LED

If you have physical access to your data logger, check the status of the LED. The different colors and flashing status mean different things:

  • If the LED is flashing red, the card is being accessed—written to or read from. Do not remove the card.
  • If the LED is solid green, it is OK to remove the card.
  • If the LED is solid orange, there is an error.
  • If the LED is flashing orange, the memory card has been removed for a long enough duration that the CPU memory has wrapped, and the data are being overwritten without being stored to the card.

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

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:

Status Table tab with CardStatus

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.

Conclusion

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.


Share This Article



About the Author

carolyn ivans Dr. Carolyn Ivans is the Technical Communications Manager at Campbell Scientific, Inc. She has a doctorate in Ecology, Evolution, and Conservation Biology from the University of Nevada, Reno. She enjoys working with the Technical Communications team, product developers, and customers to create documentation and tutorials for Campbell Scientific products. In her spare time, Carolyn enjoys kayaking, hiking, and bike rides with her family.

View all articles by this author.


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.