← All exercises

Bit Pack

easy

Packs eight BOOL inputs into the low eight bits of one DINT word.

What it teaches

Build a packed word by clearing it, then writing each BOOL directly to its matching bit address: In_00 controls bit 0 through In_07 controlling bit 7. Clearing first guarantees bits 8-31 are 0 instead of retaining stale data.

Inputs and outputs

TagTypeDefaultDescription
In_00BOOL
In_01BOOL
In_02BOOL
In_03BOOL
In_04BOOL
In_05BOOL
In_06BOOL
In_07BOOL
Out_WordDINTPacked input bits; bits 8-31 are 0

Required behavior