Swap words in UDINT

Hi,

from Modbus I read a UDINT value. Unfortunately the variable is incorrect formatted. When I read 0x12 (18 decimal) from Modbus, the variable shows 1179648 as decimal. This is 0x00120000, the words are swapped. So I need to swap the words (not bytes) for this variable. I found the swapUDINT() function but this swaps bytes not words.
The swapUDINT() make the variable more worse: 0x00001200 or in decimal: 4608.
I need to swap words, 0x00120000 → 0x00000012, how can this be done?
Language: ST.

Walter

You can use the ROL Rotate bits left (or ROR, rotate bits right) to shift the low word to the high word, and vice versa. Rotating a UDINT 16 bits will swap the words in order.

In Structured Text:
newUDINT := ROL(oldUDINT, 16);

See the AS Help about ROL (or ROR) for additional information:
B&R Online Help (br-automation.com)

Austin,
thank you, I will try.