'Turning' process data
The process data are transferred in Intel format as standard. 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.
Prerequisites for this step:
- A parameterized slave.
- A slave connected to a master. The master is added in TwinCAT and then scanned for the slave via the master.
'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, the WORD can be swapped in addition.
- In this way you can 'turn' process data. Use the following example to see how the data change for 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 command ROR.
Example for ST: VarProfibus:=ROR(VarAnalog,8); (*Both variables of type WORD*)