Memory Card Data Saving
Ta treść nie jest jeszcze dostępna w Twoim języku.
The Overvis MC251 supports microSD compatible memory cards formatted as FAT/FAT32. Only the first volume of the card is used (the maximum usable capacity on the card is 32 GB). The card can be inserted before powering the device or while the device is in operation.
MC251 uses a memory card for the following actions:
- taskfiles operations;
- logging of collected data;
- diagnostic logging;
- export and import of settings;
- firmware updates;
- navigation on the memory card, downloading and uploading files through the WEB-interface.
When the device is started or when a memory card is inserted, its parameters are checked (it may take up to 3 seconds). After that, the card can be used for other actions.
When the device is restarted, or when the supply voltage drops below the value specified in the settings (see Modbus Register Map, register 724), MC251 safely ejects the memory card. Before unmounting, temporary data is saved and files are closed.
Taskfiles operations
Section titled “Taskfiles operations”MC251 performs several operations with taskfiles in the TASKS folder:
FolderTASKS/
- .txt (Source taskfiles)
- .MAP (Token lists created at compilation)
- .OBJ (Compiled bytecode)
- .CNF (Taskfiles parameters)
- Reading: MC251 reads text taskfiles from the
TASKSfolder (and its subfolders). - Compilation:
- Stores taskfiles found token lists into
MAPtext files. - Stores taskfiles compiled bytecode into
.OBJbinary files.
- Stores taskfiles found token lists into
- Execution: Reads and writes taskfiles parameters into
.CNFtext files.
See Logic Programming for details on files in the TASKS folder.
Logging of collected data
Section titled “Logging of collected data”MC251 saves the collected data to the log in the LOGS\TASKS folder on the memory card. The order of data collection and conditions for logging are specified in the taskfiles (see Logic Programming).
FolderLOGS/
FolderTASKS/
FolderYYYY_MM/
- YYMMDDII.EEE (Log files)
If the folder is missing, it will be created. For each month, a subfolder is created with a name in the format YYYY_ММ, where:
YYYY– year;ММ– month.
In this subfolder, for each day of the month, a file is created with the name in the format YYMMDDII.EEE, where:
YY– the last two digits of the year;ММ– month;DD– day of the month;II– index;EEE– file extensionCSVorDAT(depending on the settings, see Modbus Register Map, register 725).
The data is appended to the end of the current file. A new file with the next index is created when one or more of the following conditions are met:
- the file is filled up to the maximum size (specified in the settings, from 1 KB to 64 MB, see Modbus Register Map, register 726);
- an error occurs while writing to the log file,
- the card is unmounted or removed, or the device is restarted.
File Indexing
Section titled “File Indexing”Before creating the file, the presence of files in the subfolder with names for the given day of the month is checked, and the maximum occupied index is found.
Files are numbered starting from 01.
- Numeric indices:
01…99 - Alphanumeric indices:
A0…A9,AA…AZ,B0…ZZ
In total, up to 1035 indexes can be used for one day of the month. After that, recording is suspended until the date changes.
Log Formats
Section titled “Log Formats”When the binary log format is selected, the MC251 saves the collected data in a compact form into files with the DAT extension.
Records of a fixed size of 24 bytes are appended to the files.
Each record can contain the value of one parameter or a service message.
Table 1 - Format of the service record in the log data bytes file
| Bytes | Field | Range of values | Description |
|---|---|---|---|
| 0 – 3 | Timestamp | 0 – 4294967295 | Time in Epoch format: number of seconds since midnight 1.01.1970 UTC+00 |
| 4 – 7 | Service record code | 4294967295 | Indicator for distinguishing from other types of records |
| 8 – 15 | Message type | 0 | 0 – losses due to repetitive errors |
| 16 – 23 | Message | 0 – 4294967295 | For loss reporting – the number of bytes |
Table 2 - Format of parameter recording in the log data bytes file
| Bytes | Field | Range of values | Bits | Description |
|---|---|---|---|---|
| 0 – 3 | Timestamp | 0 – 4294967295 | Time in Epoch format: number of seconds since midnight 1.01.1970 UTC+00 | |
| 4 | Parameter type | 0 - 49, 128 – 177 | 0 – 6 | Parameter type index: 6 – parameter is the bit (Modbus coil or digital input) other values – parameter is in the registers (Modbus holding or input) (see Parameter Types) |
| 7 | 0 – parameter is from read/write table (Modbus coil or holding register) 1 – parameter is from the read-only table (Modbus discrete input or input register) | |||
| 5 | Device ID | 1 – 255 | address of the Modbus device | |
| 6 – 7 | Parameter address | 0 – 65535 | starting address of the parameter on the Modbus device | |
| 8 – 15 | Parameter value | -9223372036854775808 – +9223372036854775807 | The value converted to a signed 64-bit integer | |
| 16 – 23 | 0 - 18446744073709551615 | Data read from the device before being converted to a parameter value |
When the text table log format is selected, MC251 saves the collected data in text form into files with the CSV extension.
- Records are text strings with variable length fields.
- Fields are separated by the character selected in settings (see Modbus Register Map, register 725).
- Lines are separated by
CR+LF. - Maximum record length: 80 bytes (without comment), up to 200 bytes (with comment).
Table 3 – Format of records in the file of text tables of the log
| Column | Field | Description |
|---|---|---|
| 1 | Timestamp | Date and time in ISO8601 format when the parameter value was received |
| 3 | Parameter value | The value converted to a signed 32-bit integer |
| 4 | Data type | Parameter type name similar to that used in the taskfile (see Parameter Types) |
| 5 | Parameter address | Starting address of the parameter on the Modbus device |
| 6 | Data table | One symbol representing the Modbus data table:H – holding registers;I – input registers;D – discrete inputs;C – flags |
| 7 | Device ID | address of the Modbus device |
| 8 | Data losses | The number of bytes that could not be written (and were removed from the write queue before creating this record) 0 – no losses |
| 9 | Comment | An empty field or comment line if the entry was created by a command of logging with a comment. (it is not recommended to include the table field separator character in the comment) |
Filling the memory card
Section titled “Filling the memory card”The time it takes for an empty memory card to be filled, can be calculated using the formula:
Tfull ≈ (Vfree * Tupd) / (Npar * Lsiz), where:
Tfull – the time till the card is full;
Vfree – free space on the memory card;
Tupd – task run (parameters update) period;
Npar – the number of parameters to be logged (if the log record is made with each task run);
Lsiz – the size of the log entry (depends on its format).
Examples:
- Binary data format: Writing 7 parameters every 20 seconds. A 2 GB card will be filled in ~383,479,222 s (or more than 12 years).
- Text table format: Writing 3 parameters 10 times per second (without comments). A 32 GB card can be filled in ~16,361,780 s (or more than 6 months).
Diagnostic logging
Section titled “Diagnostic logging”MC251 can be configured to store diagnostic logs into the LOGS folder.
FolderLOGS/
- ATM.LOG (GSM AT-modem exchange log)
- SYS.LOG (System events log)
Export and import settings
Section titled “Export and import settings”MC251 can export the saved settings from the internal memory to the SETTINGS\MC251SET.DAT file, or import the settings from this file and save them to the internal memory.
FolderSETTINGS/
- MC251SET.DAT (Settings file, up to 16 kB)
Firmware updates
Section titled “Firmware updates”MC251 can update the firmware (see Firmware Update) with one of three files:
FolderUPGRADES/
- MC251FW1.FUS
- MC251FW2.FUS
- MC251FW3.FUS
The file size can be up to 10 MB each in size.
Q: What type of memory card does MC251 support?
A: MC251 supports microSD compatible memory cards formatted as FAT or FAT32. Only the first volume is used, with a maximum usable capacity of 32 GB.
Q: Can I insert or remove the memory card while the device is running?
A: You can insert the card while the device is running. However, removing the card during operation may result in data loss. To safely remove the card, wait until after a device reset while the device title is displayed on screen.
Q: What happens if the power supply drops while the card is in use?
A: MC251 monitors supply voltage and safely unmounts the memory card when voltage drops below a configurable threshold (register 724). Before unmounting, temporary data is saved and files are closed to prevent corruption. A high-capacitive power supply is recommended to give enough time for this feature.
Q: Which log format should I use — binary (.DAT) or text (.CSV)?
A:
- Binary (.DAT): More compact (24 bytes per record), better for long-term logging with limited card space, but requires parsing tools to read.
- Text (.CSV): Human-readable, can be opened directly in spreadsheet software, but takes more space (up to 200 bytes per record with comments).
Q: How long will it take to fill my memory card with log data?
A: Use the formula: Tfull ≈ (Vfree * Tupd) / (Npar * Lsiz). For example, logging 7 parameters every 20 seconds in binary format on a 2 GB card takes over 12 years to fill. Logging 3 parameters 10 times per second in CSV format on a 32 GB card takes about 6 months.
Q: What happens when the memory card is full?
A: It depends on the recorder mode setting (register 727). When enabled, the oldest files are automatically deleted to make room for new data. When disabled, logging pauses until you manually free up space.
Q: How much data can be logged per day?
A: The file size limit is configurable (up to 64Mb). And up to 1035 files per day can be created in the day folder. After all file indices are used, recording is suspended until the date changes.
Q: What happens if a write error occurs during logging?
A: Data remains in a temporary write queue and the device retries for up to 10 minutes. If writing still fails, the data is removed from the queue and the number of lost bytes is recorded for reporting in subsequent log entries.
Q: Can I use the same memory card for multiple MC251 devices?
A: Yes, but be careful with taskfiles — each device will try to load and execute taskfiles from the TASKS folder. Settings export/import files are also shared. Consider using separate cards or carefully managing folder contents if moving cards between devices.
Q: Where are taskfile compilation results stored?
A: In the same TASKS folder alongside your source files:
.MAPfiles contain token lists from compilation.OBJfiles contain compiled bytecode.CNFfiles store taskfile runtime parameters
Q: How do I back up my MC251 settings to the memory card?
A: Export settings to the SETTINGS\MC251SET.DAT file using Modbus commands. This file (up to 16 KB) can be imported later to restore settings or transfer them to another device.
Q: Why does the SD card take up to 3 seconds to become available after insertion?
A: MC251 performs parameter checks on the card after insertion or device startup. This verification ensures the card is properly formatted and usable.
Need Help?
Section titled “Need Help?”For technical support and assistance:
- Email: support@overvis.com
- Support portal: www.overvis.com/support