FB_CX70xx_RW_EEPROM
The function block allows a maximum of 120 bytes to be written to the EEPROM (hardware) of the CX70xx. The EEPROM may be written to a maximum of 200 times. The memory is intended for one-time writing.
This function block can be used to personalize the CX70xx. That means, in the simplest case you write your company ID into the EEPROM. When starting the CX70xx program, read the contents of the memory. For example, if it is empty, you cannot continue to run the program because it is no longer your original CX70xx that you programmed.
If you want to exchange a CX70xx for a new device, the EEPROM must be written again by you.
Inputs
VAR_INPUT
bExecute : BOOL; // rising edge triggers process with selected mode
eMode : E_CX70xx_EEPROM_Mode; // select RW mode
pSrcBuf : PVOID; // pointer to WRITE EEPROM data buffer
cbSrcBufSize : UINT; // size of WRITE EEPROM data buffer (max.120 Bytes)
pDstBuf : PVOID; // pointer to READ EEPROM data buffer
cbDstBufSize : UINT; // max.size of READ EEPROM data buffer (max.120 Bytes)
END_VAR
Name | Type | Description |
---|---|---|
bExecute | BOOL | A positive edge starts the function block. |
eMode | E_CX70xx_EEPROM_Mode | ReadOnly: EEPROM read |
pSrcBuf | PVOID | Pointer to the data buffer to be written. |
cbSrcBufLen | UINT | Length of data to be written (max. 120 bytes) |
pDstBuf | PVOID | Pointer to the data buffer into which the contents of the EEPROM are to be copied. |
cbDstBufLen | UINT | Length of data to be read. (maximum 120 bytes) |
Outputs
VAR_OUTPUT
bBusy : BOOL; // FB is working
bError : BOOL; // FB has an Error
nErrorID : UDINT; (* Error Code
If nErrorID=DEVICE_INVALIDACCESS the EEPROM write cycles reached max. value.
If nErrorID=DEVICE_INVALIDPARM the given pointer parameter is invalid/null.
If nErrorID=DEVICE_INVALIDSIZE the given buffer size is too small or too big.
If nErrorID=DEVICE_SRVNOTSUPP probably the image version need to be updated to support this feature. *)
nDataSizeEEPROM : UINT; // current size of (read) EEPROM data in bytes (max.120 Bytes)
nWritesCycles : UINT; // already performed EEPROM write cycles (maximum possible = 200)
END_VAR
Name | Type | Description |
---|---|---|
bBusy | BOOL | The function block is active and working. |
bError | BOOL | The function block has an error. |
nErrorID | UDINT | ADS Error Code DEVICE_INVALIDACCESS: the EEPROM write cycles have reached the maximum value. The EEPROM cannot be rewritten. DEVICE_INVALIDPARM: the allocated pointers are invalid/NULL. DEVICE_INVALIDSIZE: the allocated buffer size is too small or too large. DEVICE_SRVNOTSUPP: the image version of the CX70xx does not support this feature. An update (>=35695) is necessary. |
nDataSizeEEPROM | UINT | Current size in bytes of the read EEPROM data |
nWritesCycles | UINT | Number of write operations still available |