This is the web edition of the original ⮫ AC500-S safety user manual, version 1.3.2. This web edition is provided for quick reference only. The original safety user manual must be used to meet functional safety application requirements. |

Reading of user data from the flash memory
The function block reads a data set from a data segment in the flash memory and stores this data set beginning at the starting flag defined at input SM. The data contained in the data set were previously stored to the flash memory using the SF_FLASH_WRITE function block.




NOTICE

Access to the flash memory is only possible using the function blocks SF_FLASH_WRITE, SF_FLASH_DEL and SF_FLASH_READ.
NB blocks are read starting at block BNR within segment SEG and stored starting at address SM.
32 binary data or 16 word data or 8 double word data are read per block.
One block contains 38 bytes:
-
32 bytes of data
-
4 bytes for CRC checksum
-
1 byte as "written" identifier
-
1 byte for alignment
⮫ Table 1081 “Structure of one of the flash memory segments with user data”
Reading a data set is triggered once by a FALSE/TRUE edge at input EN. If no error occurred while reading the data, output DONE is set to TRUE and the outputs ERR and ERNO are set to FALSE. The data set is stored beginning at the defined start flag SM.
Storing the data set can take several CPU cycles.
If an error occurs during reading, DONE and ERR are set to TRUE and data from SM are equal to 0. The error type is indicated at output ERNO.




NOTICE

This function block is activated by a positive edge of the input variable EN. During the cycle where the function block notices that the operation is finished (output DONE = TRUE) it will set the output variables only for one cycle. When the function block is called again it will reset the output variables immediately.
Name |
Data type |
Initial value |
Description, parameter values |
---|---|---|---|
VAR_INPUT |
|||
EN |
BOOL |
FALSE |
Activation of the FB using a positive edge The following applies:
|
NB |
WORD |
16#0000 |
Number of data set blocks (decimal 1 ... 1724) Input NB is used to specify the number of blocks contained in the data set. 32 byte data or 16 word data or 8 double word data are read per block. Valid values: 1 ... 1724 Example:
|
SEG |
BYTE |
16#00 |
ID number of the data segment (16#01 or 16#02) |
BNR |
WORD |
16#0000 |
Starting block number in the flash memory data segment (decimal 0 ... 1723) |
SM |
DWORD |
16#00000000 |
Destination address for the read data set (address of the first variable where the data are placed) |
VAR_OUTPUT |
|||
DONE |
BOOL |
FALSE |
Reading procedure is completed (DONE = TRUE) This output always has to be considered together with output ERR. The following applies:
|
ERR |
BOOL |
FALSE |
Error occurred (data segment could not be read) This output always has to be considered together with output DONE. The following applies if an error occurred: DONE = TRUE and ERR = TRUE. Output ERNO indicates the error number. |
ERNO |
WORD |
16#0000 |
Error number⮫ [3]. Output ERNO indicates an error number. This output always has to be considered together with the outputs DONE and ERR. The SF_FLASH_READ operation may take quite a long time since the safety CPU user program is processed with higher priority. Output ERNO indicates that the function block has started the execution (0x0FFF = BUSY). During this phase, the outputs ERR and DONE are set to FALSE. |
Byte: |
1 | 2 |
3 | 4 |
5 | 6 |
... |
29 | 30 |
31 | 32 |
33 ... 36 |
37 |
38 |
|
---|---|---|---|---|---|---|---|---|---|---|
Byte offset |
Block no. |
Word 1 |
Word 2 |
Word 3 |
... |
Word 15 |
Word 16 |
CRC |
Written identifier |
Alignment |
0 |
0 |
|||||||||
38 |
1 |
|||||||||
76 |
2 |
|||||||||
... |
... |
|||||||||
65436 |
1722 |
|||||||||
65474 |
1723 |
Call in ST
READ_FLASH(EN := EN_FLASH_READ, NB := NB_FLASH_READ, SEG := SEG_FLASH_READ, BNR := BNR_FLASH_READ, SM := SM_FLASH_READ, DONE => DONE_FLASH_READ, ERR => ERR_FLASH_READ, ERNO => ERNO_FLASH_READ);