How to Store Data Logger Data to a Memory Card

经过卡罗琳·伊万斯(Carolyn Ivans)|更新:2016年6月22日|评论:5

搜索the Blog


Subscribe to the Blog

在发布新的博客文章时,设置您的偏好,以接收电子邮件通知,以匹配您感兴趣的领域。


Area / Application

Product Category

活动

公司 /新闻

Enter your email address:



Suggest an Article

Is there a topic you would like to learn more about? Let us know. Please be as specific as possible.

Leave this field empty

datalogger and microSD card

你可能已经确定了需要添加外部data storage to your data logger with flash-memory cards. But do you know which CRBasic instruction to use to do it? In this article, I’ll help you choose the most suitable instruction for your application. In a future article, I’ll discuss some more complex issues and offer handy card tips and tricks that you may not be familiar with.

If you're not that familiar with memory cards, you may find it helpful to review the"Pick a Memory Card, but Not Just Any Memory Card" blog article

How do I store data to a memory card?

有两个CRBASIC指令通常用于指示数据记录器将最终存储数据写入存储卡:

  1. cardout()instruction
  2. tablefile()oPtion 64instruction

这se instructions are added between theDataTable()andEndTable()本文稍后的示例中所示的说明。请注意,您不能同时使用cardout()andtablefile()oPtion 64在同一数据表中。您必须选择最适合您的指令。那么,为什么有两个说明将数据存储到卡中?一种方法比另一种方法好吗?

Before answering these questions, it is important to understand that the maximum size of any one file stored on a data logger is 2 GB. This is because the data logger natively supports signed-4-byte integers. This data type can represent a number as large as 231, 或者in terms of bytes, roughly 2 GB. Hence, 2 GB is the maximum file length that can be represented in the data logger directory table, and consequently, that is its maximum file size.

Partially because of this file size limitation, and also due to the high cost of large memory cards, Campbell Scientific data loggers did not support memory cards larger than 2 GB prior to operating system (OS) 25 in the CR1000 or CR3000. However, as demands for high-frequency data and greater data storage grew, support for cards up to 16 GB was added to the data logger operating system.

对大于2 GB的卡的支持提出了一个难题。如果最终存储文件的最大尺寸为2 GB,我们如何将2 GB的数据写入卡中?通过添加新选项提供了解决方案(oPtion 64tablefile()instruction that allows more than one final-storage data file to be created from the same data table. Hence, many small files can be created from the same data table, thus allowing up to 16 GB of final-data storage from one data table.

So, prior to OS 25, only thecardout()instruction was available to store data to a card, and only one file could be created for each data table. However, with OS 25 and later,tablefile()oPtion 64is also available for storing more than one file for a given data table to a card.

Is one method of writing data to a card better than the other?

一个优势cardout()指示是添加到程序非常简单。有关cardout()instruction is available in the CRBasic Editor Help files.

但是,在许多应用中,tablefile()指示oPtion 64has several advantages over thecardout()instruction. These advantages include:

  • 允许从同一数据表编写多个小文件,以便单个表的存储超过2 GB。这tablefile()指令通过NumRecs,,,,TimeIntoInterval,,,,andInterval参数。
  • Faster compile times when small file sizes are specified
  • Easy retrieval of closed files via File Control utility, FTP, or email
  • Closed files are safe files. Anytime a file is open for writing, it can become corrupted if a power loss occurs or if the writing is interrupted for any reason.tablefile()oPtion 64将在编程时间或记录间隔关闭文件。一旦关闭这些文件,它们就会免受这种类型的损坏。

cardout()Program Example

public batt_volt datatable(测试,1,1000)datainterval(0,15,sec,10)CardOut(0,-1) Sample (1,batt_volt,FP2) EndTable BeginProg Scan (1,Sec,0,0) Battery (batt_volt) CallTable Test NextScan EndProg

tablefile()程序示例

Public batt_volt, OutStat As Boolean, LastFileName As String * 32 DataTable (Test,1,1000) DataInterval (0,15,Sec,10)桌面(“CRD: Test_ ", 64年,10 0,1分钟,OutStat, LastFileName)ample (1,batt_volt,FP2) EndTable BeginProg Scan (1,Sec,0,0) Battery (batt_volt) CallTable Test NextScan EndProg

为你推荐:To learn more about the TableFile() instruction with Option 64, read the“将高频数据写入16 GB和较小CF卡的更好方法”技术论文。

数据收集和访问

cardout()只要cardout()指令正在运行,因此始终可用于远程数据收集。和tablefile()oPtion 64,,,,the most recent file is open and available for remote collection. After a file is closed, data can be accessed only by first retrieving the file (for example, via the File Control Utility, FTP, email or, copying files from the card).

For bothcardout()andtablefile()oPtion 64说明,卡上的打开文件成为表存储器的扩展。任何时间数据都通过搜集orCustom Collectutilities ofLoggernet,,,,PC400, 或者RTDAQ,,,,the internal SRAM is searched first, then the card. If a file is found on the card with the same name and file header as the data table in the internal memory, the data from the card is appended to that file.

笔记:To be considered identical, the file must have been created on the same data logger using the same program.

您可以使用数据记录器支持软件查看存储卡数据,例如View Prologgernet软件包中的客户端应用程序。您还可以使用数据表访问语法,例如TableName.FieldName。(Refer to the CRBasic Editor Help file.)

为你推荐:有关更多信息,请阅读"How to Programmatically Access Stored Data Values" blog article

CardConvert软件

请注意,两者都cardout()andtablefile()oPtion 64,数据以TOB3格式存储在卡上。TOB3是一种二进制格式,它包含功能以提高CF卡的可靠性。TOB3格式与通过通信链接(TOA5或ASCII格式)收集数据时创建的数据文件格式不同。因此,直接从CF卡读取的数据文件需要转换为另一种格式,以使其可读。您可以使用包含在Loggernet,,,,PC400,,,,andPC200W

Conclusion

I hope this article has helped you to understand how easy it is to add acardout()ortablefile()instruction to a CRBasic program that will direct your data logger to store data to a memory card. (For details on each of these instructions, see the CRBasic Editor Help files.) In a future article, I’ll address some more complex card issues and offer handy card tips and tricks.

If you have any questions or comments about memory cards, post them below.


分享这篇文章



关于the Author

卡罗琳·伊万斯(Carolyn Ivans)Carolyn Ivans是Campbell Scientific,Inc。的硬件支持小组的成员,专注于测试用于数据记万博matex网页登录录仪,外围设备和新设备的新操作系统。她拥有内华达大学里诺大学的生态,进化和保护生物学博士学位,并以最终用户的身份享受测试产品。当卡罗琳(Carolyn)不忙于测试产品时,她会喜欢长途跋涉,并与家人一起骑自行车。

View all articles by this author.


Comments

ReadyDAQ|2016年7月29日晚上10:59

很棒的提示。从这个博客中了解了很多有关data logger software。感谢分享。

Flipper66|04/11/2017 at 02:08 PM

Is there any way to programatically determine the amount of free space on a CARD ?

Carolyn|04/11/2017 at 03:09 PM

是的,使用TableName.FieldName语法从状态表中读取CardBytesFree,如下所示:

Public Card_Bytes_Free as Long 'declare a variable to store the card bytes free

BeginProg
扫描(1,SEC,0,0)

Card_Bytes_Free = Status.CardBytesFree 'read the card bytes free from the Status Table

Nikki|04/17/2018 at 07:34 AM

Thank you for the explanantion!
Is it true that u can store a maximum of 30 data tables on a microSD card? (CR6-datalogger)

Carolyn|04/20/2018在05:02 pm

您可以在Micro SD卡上存储许多超过30个文件。文件数量受卡上可用的内存数量而不是表的数量限制。

登录或注册to comment.

We're active on social media!
通过在这些平台上关注我们,请了解我们的最新更新:

Baidu