← All exercises

Combine Two Registers

medium

Combines two 16-bit device registers into one 32-bit word.

What it teaches

Devices and protocols often split one 32-bit value across two 16-bit registers. Put the low register in output bits 0-15 and the high register in bits 16-31. Register order matters, only the low 16 bits of each input belong to the result, and setting output bit 31 makes the DINT appear negative.

Inputs and outputs

TagTypeDefaultDescription
In_LowRegisterDINT22136Low register; only bits 0-15 are used
In_HighRegisterDINT4660High register; only bits 0-15 are used
Out_ValueDINTCombined 32-bit value

Required behavior