Structure of the File USRDATXX.DAT on the SD Card¶
Depending on the AC500 CPU type, the data are stored to the SD card in the following directory:
AC500 CPU | Directory | File |
---|---|---|
PM591 | ..\UserData\PM591\UserDat | USRDATxx.dat |
An SD Card must be inserted in the AC500!
A maximum of 100 files (USRDAT0.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 elements of a data set are automatically separated by semicolon. Each data set is terminated with <CR><LF> (0dhex, 0ahex).
This allows to directly import/export the data files from/to EXCEL. The data files can be viewed and edited using a standard ASCII editor (such as Notepad).
When saving / loading the data files, the following rules have to be observed:
- Writing on a non-existent file creates that file prior to the first write access.
- 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.
- 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 must know the structure of the data when reading them.)
- The data sets are always appended to the end of the file when writing them.
- 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 Function Blocks SD_READ and SD_WRITE.
- The values of a data set must be available in variables successively arranged in the PLC (e.g. ARRAY, STRING, %M area).
- A data file can be deleted with help of the PLC 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 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
Data file 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
The sector name can consist of a maximum of 32 characters (including []).