'Turning' process data
The process data are transmitted in Intel format by default. If the data are required in Motorola format, they have to be 'turned' accordingly. This step illustrates how to 'turn' the data in TwinCAT.
If the standard format is required, you can skip this step.
Requirements for this step:
- A parameterized slave.
'Turn' the process data as follows:
- 1. In the tree view, right-click on a variable containing data to be 'turned'.
- 2. Click on the Flags tab.
- 3. Click on the required option. For WORD variables, only LOBYTE and HIBYTE can be swapped. For DWORDs, additionally the LOWORD and HIWORD.
- In this way you can 'turn' process data. Use the following example to see how the data changes with the individual options.
Example for DWORD.
Data of the slave | Data which the master receives | |||
---|---|---|---|---|
Original data | No option selected | Swap Byte (blue) | Swap Word (green) | Swap both (blue and green) |
0x01020304 | 0x01020304 | 0x02010403 | 0x03040102 | 0x04030201 |
The data can also be turned in the PLC project using the ROR command.
Sample for ST: VarProfibus:=ROR(VarAnalog,8); (*both variables of type WORD*)