Structure of Data Files Stored on the SD Memory Card

Depending on the AC500 CPU type, the data is stored in the following SD memory card directory:

AC500 CPU Directory File
PM5xy ..\UserData\PM5xy\UserDat USRDATxx.DAT
PM5xy-ETH ..\UserData\PM5xyETH\UserDat USRDATxx.DAT

A maximum of 100 files (USRDAT00.DAT…USRDAT99.DAT) can be stored in one directory.

Each data file USRDATxx.DAT can be divided into individual sectors, if necessary. The “sector label” enclosed in square brackets (such as [Sector_01]<CR><LF>) indicates the start of the sector. Within a sector, data are saved as data sets in ASCII format. The individual values of a data set are separated by semicolon. Each data set is closed with <CR><LF> (0Dhex, 0Ahex).

This enables the direct import/export of the data from/to MS Excel. The data files can be viewed and edited using a standard ASCII editor (such as Notepad).

When saving/loading data files, observe the following rules:

  • Data sets within a sector must always have the same number of values.

  • Data sets in different sectors can have a different number of values.

  • Values of integer data types can be stored. REAL or LREAL variables cannot be stored.

  • The values of a data set must have the same data format (BYTE, WORD, INT,..).

  • A sector can have data sets with different data format.

    Warning: The user has to know the structure of the data for reading them.

  • The data sets are always appended to the end of the file when writing.

  • Searching for a “sector label” within a file is possible when reading it.

  • Data sets can be read starting from a particular “sector label”.

  • A particular data set of a sector cannot be read or written.

  • If you want to read each data set individually, a “sector label” must be inserted before each data set.

  • Reading and writing the data with help of the user program is done with the blocks SD_READ and SD_WRITE.

  • The values of a data set must be available in variables successively stored in the CPU (e.g., ARRAY, STRING, %M area).

  • A data file can be deleted with help of the CPU program.

  • Individual data sets and/or sectors cannot be deleted with the user program. This has to be done on the PC using an ASCII editor such as Notepad.

Data File Examples

Example 1:

Data file USRDAT5.DAT without sectors:

-> 5 data sets, each with 10 DINT values:

600462;430;506;469;409;465;466;474;476;-1327203

600477;446;521;484;425;480;482;490;491;-1327187

600493;461;537;499;440;496;497;505;507;-1327172

600508;477;552;515;456;511;513;521;522;-1327156

600524;492;568;530;471;527;528;536;538;-1327141

Example 2:

Data file USRDAT7.DAT with sectors:

-> 3 sectors, each with 3 data sets and 10 DINT values per data set:

[Sector_01]

610439;10408;10483;10446;10387;10442;10444;10452;10453;-1317225

610455;10423;10499;10462;10402;10458;10460;10467;10469;-1317209

610476;10445;10520;10483;10424;10479;10481;10489;10490;-1317188

[Sector_02]

610570;10539;10614;10577;10518;10573;10575;10583;10584;-1317094

610585;10554;10630;10592;10533;10589;10591;10598;10600;-1317078

610602;10571;10646;10609;10550;10605;10607;10615;10616;-1317062

[Sector_03]

610701;10670;10746;10708;10649;10704;10706;10714;10715;-1316963

610717;10686;10761;10724;10665;10720;10722;10730;10731;-1316947

610739;10708;10783;10746;10686;10742;10744;10751;10753;-1316926