Y_YA_CheckSumCalculate_Byte
Function block to calculate and output a check sum for an array of bytes. Checksum value calculated is a byte.
Parameters
| * | Parameter | Data Type | Description | Default |
|---|---|---|---|---|
| VAR_IN_OUT | ||||
| B | Buffer | Yt_ByteArray512 | Array of bytes for which the check sum is to be calculated. | |
| VAR_INPUT | ||||
| B | Execute | BOOL | Upon the rising edge of the Execute input, all other inputs are read and the function block becomes operational. If an input needs to be modified, the value will have to be changed and the Execute input will have to be re-triggered. | FALSE |
| B | BufferSize | INT | Size of the data array | INT#0 |
| E | CalcMethod | Yt_YA_Method | Yt_YA_Method:(XORput, TwosComp, TwosCompHex); | Yt_YA_Method#XORput |
| VAR_OUTPUT | ||||
| B | Done | BOOL | The Done output is set to TRUE when the commanded action has completed successfully. If another function block takes control before the action is completed, the Done output will never become TRUE. This output is reset when Execute becomes FALSE. | |
| E | Busy | BOOL | For function blocks with Execute input, the Busy output is set to TRUE upon the rising edge of the Execute, and set to FALSE when Done, CommandAborted or Error outputs becomes TRUE. In the case of a function block with an Enable input, Busy indicates that the function block is operating, but may not be ready to provide valid outputs. | |
| B | Error | BOOL | The Error output is set to TRUE if an error has occurred during the operation of the function block. The output is cleared when the Execute or Enable input becomes FALSE. | |
| E | ErrorID | UINT | The ErrorID output provides the identifier of the error when there is an active error in the function block execution. The output is cleared when the Execute or Enable input becomes FALSE. | |
| E | CheckSum | BYTE | Calculated check sum value | |
Notes:
There are three methods that the user can use to calculate check sum.
1) XOR at a byte level
2) Add all bytes, flip all bits in the byte and add one. (Twos complement)
3) Add all bytes, flip all bits, convert to a hex ascii array and use the ascii value of the last element of the array.
Error Description
See the
Function Block ErrorID List