Please enable JavaScript to view this site.

Waijung 2 User Guide

How this block appears in a Simulink model?

sd_card_file_system1

What can be configured?

Append Block

sd_card_file_system2

sd_card_file_system3

Configuration Parameter

Selectable Option/Value

Description

Mode

Append

Select the operation mode

File save path

 

SD card file path to save data

Maximum data packets per file

 

Maximum number of rows per file.Data will store row by row therefore one data packet that fed in to input port is save in a raw

Input data from buffer

 

fed data from external buffer.Once activated input port will disable

Buffer name

 

Name of data buffer

Sample time (sec)

-1(inherited) or specify

Specify the sample time

 

INPUT Port

Port Name

Port Type

Date Type

Description

Data in

Vector

uint8

Feed char vector with the data to be stored

Activation

Scalar

Boolean

Set activation status to high to append data in to SD card.

Read Block

sd_card_file_system4

sd_card_file_system5

Configuration Parameter

Selectable Option/Value

Description

Mode

Read

Select the operation mode

Output data buffer size

 

buffer size of the output port.It outputs save data line by line which save in the file on SD card

Assign read data to a buffer

Check--Uncheck

Assigning read data to a buffer.Once active the output port will disabled

Buffer name

 

Buffer name which store read data

Buffer size

 

Size of the buffer (bytes)

Sample time (sec)

-1(inherited) or specify

Specify the sample time

 

INPUT Port

Port Name

Port Type

Date Type

Description

Activation

Scalar

Boolean

Set activation status to high to Read data from SD card.

OUTPUT Port

Port Name

Port Type

Date Type

Description

Data out

Vector

uint8

The port outputs a vector with the data that read from the SD card

Data available

Scalar

Boolean

if data available to read it returns 1 and it not zero

When to use this block?

This block is employed when there's a need to store and retrieve data on an SD card. It's responsible for managing the file system during the data-saving process on the SD card. To comprehend the file system's functioning during data storage, it's recommended to explore the provided demonstration.

How does this block work?

Please note to use this blocks you need to add SD card setup block in addition to these blocks.

Append block: Use to set up SD card path and .

Read block: Use to read data from SD card file directory.

To attain a more comprehensive understanding of this blocks, highly recommend engaging with the provided demo. It will furnish you with practical insights into the operational dynamics of this SD card file system.

Demo

Append data and read data from SD card file system

Demo1 file: sd_card_file_system_demo1.slx

Demo 1 : Append data and read data from SD card file system

Description

This example serves as an educational tool to showcase the how SD card file system blocks work. The primary goal of this example is to facilitate a clear comprehension of the process of append data into the SD card and subsequently reading data from file system.

 

Full Model

 

sd_card_file_system6

What should be happening?

Build the "demo1" file by compiling the provided demo file. Upon successful deployment of this file to the hardware, proceed to initiate the serial communication software for testing the aforementioned demo. In the software interface, choose the appropriate COM port to establish a connection for data monitoring.

 

sd_card_file_system7

 

Referring to the image above, you'll observe a comprehensive depiction of the process. This image illustrates the seamless flow of sensor data being append into the SD card file system and subsequently read from it.The append task execute in every second  while the read task execute once every 5s.

 

sd_card_file_system8

 

Upon accessing the configured SD card file directory, you'll come across distinct files: a folder named "Files," alongside "packet_head" and "packet_tail" files. The "Files" folder is where data is stored, as depicted in the provided image. Each file within it accommodates a predetermined number of data packets, which corresponds to your settings in the append block.

The "packet_head" file serves as a reference point for the file system's latest appended location. Conversely, the "packet_tail" file denotes the position of the most recent read location within the file system. Importantly, when the append and read positions align, all files within the directory are delete from the folder. The system then recommences storage starting from the initial "file0" position.

 

sd_card_file_system9

 

 

 

Copyright 2024 Aimagin Co.,Ltd. Rev.1659