Y_SB_DataRecordWrite
This function block is able to write data records to individual modules configured on the SliceBus node.
Parameters
| * | Parameter | Data Type | Description | Default |
|---|---|---|---|---|
| VAR_IN_OUT | ||||
| E | Record | ANY | Provides the data to be written. The Length input indicates the number of bytes to be written. | |
| 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 |
| E | SlotID | WORD | Slot ID of the SliceBus Node module. The SliceBus Node Master has Slot ID 0. | WORD#0 |
| E | Index | WORD | Index of the data record that is to be written. | WORD#0 |
| E | Length | UDINT | Number of bytes which are to be written from the object. The variable connected to the VAR_IN_OUT Record must have at least this length, otherwise an error message will be generated. If a value of 0 is passed, then the full size of the connected VAR_IN_OUT Record data type is used by default. | UDINT#0 |
| 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. | |
| B | 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. | |
| B | 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. | |
Notes
- All Input and In-Output values are read in the FB call with the rising edge of Execute. If a command is ongoing a change of the Execute input has no influence.
- The size of the record that is to be written needs to match the size of the index number as specified in the product manual; otherwise, the execution of the Function Block will not be successful. This means that the Length input needs to match the total size, or the size of the Record needs to match the total size when the Length is set to 0.
- Some information cannot be written when the controller is in RUN state. In such cases, the execution of the Function Block will not be successful.
- Use the index numbers shown in the following table to write parameter data.
| Reading Index | Description |
|---|---|
| 16#007D | Write the whole parameter data. |
| 16#007E | Write DS 00h of the parameter data. |
| 16#007F | Write DS 01h of the parameter data. |
| 16#0080 … 16#0090 | Write DS 80h ... DS 90h of the parameter data. |
Error Description
See the
Function Block ErrorID List
Example
The following example shows how to write some of the Parameter data (DS 01h) to the 050-1BA10 counter module. According to the product manual, the DS 01h information consists of 4 bytes as seen in the following picture.
The product manual specifies a range of allowable values for
the input frequency of both tracks (CH0A and CH1B). Input frequency Reset (CH2R) and the reserved value (CH3) are kept in their default values.
In this example, the value of the Input frequency track A is set to 10kHz (06h) andthe one of track B is set to 2kHz (08h), as seen in the following image. A value of 4 is used for the Length input because the product manual specifies a size of 4 bytes for DS 01h.