WORD
Quick answer
WORD is a 16-bit PLC bit-string type used for masks, packed flags and status registers. Its patterns run from 16#0000 to 16#FFFF; use UINT for unsigned arithmetic when supported.
Key Takeaways
- WORD is a 16-bit PLC bit-string type used for masks, packed flags and status registers. Its patterns run from 16#0000 to...
- Beginner-level topic in Data Types & Variables
- Commonly used in: Drive and instrument status words, Bit masks and packed Boolean flags
- Related to: BYTE, DWORD, INT
Detailed Definition
WORD stores a 16-bit pattern. It is designed for logical operations, masks and protocol fields whose individual bits carry meaning. Although every pattern can also be displayed as 0 through 65,535, that display does not turn WORD into the IEC unsigned arithmetic type; UINT fills that role.
Bit numbering and byte order are separate concerns. A local expression such as StatusWord.3 identifies a bit according to the IDE syntax, while the order of bytes on a network or device register follows that interface specification. Verify both before interpreting a field, and use an explicit conversion when numeric arithmetic is required.
Technical reference
The 16-bit pattern model is stable; bit-access syntax, arithmetic permissions and interface byte order vary.
Reviewed against current primary documentation:
WORD PLC Data Type at a glance
- Type family
- Bit string
- Width
- 16 bits (2 bytes)
- Signedness
- No signedness; interpreted as bits
- Range / values
- 16#0000 to 16#FFFF (all 65,536 patterns)
- IEC-style literal
- WORD#16#0008
- Best fit
- Masks, packed states and 16-bit protocol fields
Avoid this type when: The primary operation is signed or unsigned arithmetic.
Vendor notation and support boundaries
IEC names help portability, but controller generations, compiler options and instruction signatures still differ.
CODESYS / TwinCAT
WORD is documented as a bit string rather than an arithmetic type. Typed hexadecimal literals and indexed bit access are available.
Siemens SIMATIC
S7 documentation lists WORD as a 16-bit bit-sequence type. Confirm optimized-block addressing and instruction-specific operand rules.
Rockwell Logix / CIP
CIP defines WORD as a 16-bit bit string, but controller tag-type availability and common practice differ by Logix family. Verify the exact project target rather than assuming a portable WORD tag.
IEC-style Structured Text
Test bit 3 with a mask
VAR
StatusWord : WORD := WORD#16#000C;
FaultActive : BOOL;
END_VAR
FaultActive :=
(StatusWord AND WORD#16#0008) <> WORD#16#0000;16#0008 isolates bit 3. The example makes no claim about what bit 3 means; that definition must come from the connected device manual.
Ladder equivalent: In Ladder, use the platform’s bit-test or masked-compare instruction against the same documented mask; mnemonics differ by vendor.
Boundary cases to test
These are mathematical boundaries, not promises about one runtime's failure mode.
| Input / operation | Mathematical result | Safe engineering action |
|---|---|---|
| StatusWord = 16#000C; mask = 16#0008 | The masked result is nonzero, so bit 3 is set. | Compare the masked value with zero and document the bit meaning. |
| Two bytes arrive from a field device | Either byte order can produce a valid but different WORD pattern. | Apply the device protocol byte order before interpreting individual bits. |
Conversion guidance
- Use AND, OR, XOR and masks directly on WORD when the platform supports them.
- Convert explicitly to UINT only when the bit pattern is documented as an unsigned number.
- Convert explicitly to INT only when the high bit is documented as a sign bit.
- Verify whether a conversion preserves the bit pattern or performs a numeric conversion on the target runtime.
Before using this type
- 1Document the meaning of every used and reserved bit.
- 2Test the mask with both the target bit clear and set.
- 3Verify bit numbering and network byte order independently.
- 4Confirm any WORD-to-integer conversion at 16#7FFF, 16#8000 and 16#FFFF.
Primary technical sources
These sources support the type ranges and platform notes above. The project's controller, firmware and compiler documentation remains authoritative for execution.
- PLC variable naming and type families
CODESYS Development System — Distinguishes arithmetic integer types from WORD-family bit strings.
- Bit access in variables
CODESYS Development System — Documents indexed bit access and the valid integer and bit-string operands.
- Typed literals
Beckhoff Automation — Documents TYPE#literal notation and compile-time loss checks in TwinCAT.
- S7-1200 system manual: data types
Siemens — S7-1200 integer widths, ranges and constant examples; verify the manual for the CPU and firmware in use.
Common Questions
What is WORD?
WORD is a 16-bit PLC bit-string type used for masks, packed flags and status registers. Its patterns run from 16#0000 to 16#FFFF; use UINT for unsigned arithmetic when supported.
When should I use WORD?
WORD is particularly useful in scenarios such as Drive and instrument status words and Bit masks and packed Boolean flags. Consider implementing it when you need reliable, efficient solutions for these types of applications.
What should I verify before using WORD?
Document the meaning of every used and reserved bit. Test the mask with both the target bit clear and set. Verify bit numbering and network byte order independently. Confirm any WORD-to-integer conversion at 16#7FFF, 16#8000 and 16#FFFF.
What are related concepts I should learn?
To fully understand WORD, you should also familiarize yourself with BYTE, DWORD, and INT. These concepts work together in industrial automation systems.
Continue Learning
Ready to deepen your understanding of WORD? Here are some recommended resources:
Was this helpful?
Let us know if this glossary term helped you understand WORD better.
Your feedback helps us improve our glossary and create better content for the PLC programming community.
Quick Info
- Category
- Data Types & Variables
- Difficulty
- Beginner
- Tier
- Important
About Data Types & Variables
Data structures, variable types, and memory organization