Blocks for Storing/Reading User Data to/from the SD CardΒΆ
The following blocks are used to write and read user data from the CPU program to/from\ the SD card:\ \ \
- Library: SysInt_AC500_Vxx.lib
- Folder: ..\Data Storage\ SD card The library SysExt_AC500_Vxx.lib is also required. Both libraries are loaded automatically when creating a project for an AC500 CPU.
- Blocks: SD_WRITE: SD_WRITE SD_WRITE - Writes user data; SD_READ: SD_READ SD_READ - Reads user data
The blocks SD_WRITE and SD_READ are described in the documentation for the block library SysInt_AC500_Vxx.lib.
The inputs and outputs of the block SD_WRITE and their functions are as follows:
Name | Type | Assignment |
---|---|---|
Inputs | ||
EN | BOOL | The FALSE->TRUE edge starts the write process |
ATTRIB | BYTE | Write attribute of the block: 1 - Delete file 2 - Write append 3 - Write sector label |
FILENO | BYTE | Consecutive file number 0 <=xx<=99 (USRDATxx.DAT) |
SEG | POINTER TO STRING | Pointer to sector label string (via ADR operator) |
FORMAT | BYTE | Data format: 00 hex - 0 - BYTE 01 hex - 1 - CHAR 10 hex - 16 - WORD 11 hex - 17 - INT 20 hex - 32 - DWORD 21 hex - 33 - DINT |
NVAR | WORD | Number of variables to be written |
ADRVAR | DWORD | Address of the first variable, starting from which the data are available in the CPU (via ADR operator) |
Outputs | ||
DONE | BOOL | Function completed |
ERR | BOOL | Error: FALSE=no error, TRUE=error |
ERNO | INT | Error number |
The inputs and outputs of the block SD_READ and their functions are as follows:
Name | Type | Assignment |
---|---|---|
Inputs | ||
EN | BOOL | The FALSE->TRUE edge starts the read process |
ATTRIB | BYTE | Read attribute of the block: 1 - Open file, seek sector, read data set 2 - Open file, read data set 3 - Open and read next data set 4 - Read data set, close file 5 - Close file |
FILENO | BYTE | Consecutive file number 0 <=xx<=99 (USRDATxx.DAT) |
SEG | POINTER TO STRING | Pointer to sector label string (via ADR operator) |
FORMAT | BYTE | Data format: 00 hex - 0 - BYTE 01 hex - 1 - CHAR 10 hex - 16 - WORD 11 hex - 17 - INT 20 hex - 32 - DWORD 21 hex - 33 - DINT |
NVAR | WORD | Number of variables to be read |
ADRVAR | DWORD | Address of the first variable, starting from which the data are stored to the CPU (via ADR operator) |
Outputs | ||
DONE | BOOL | Function completed |
ERR | BOOL | Error: FALSE=no error, TRUE=error |
ERNO | INT | Error number |