DWORD
Quick answer
DWORD is a 32-bit bit-string data type used for masks, packed status bits and hexadecimal patterns. It has the same storage width as DINT and UDINT, but DWORD represents bits rather than a signed or unsigned numeric quantity.
Key Takeaways
- DWORD is a 32-bit bit-string data type used for masks, packed status bits and hexadecimal patterns. It has the same stor...
- Beginner-level topic in Data Types & Variables
- Commonly used in: Bit masks and packed status flags, Protocol and device status words
- Related to: WORD, LWORD, DINT
Detailed Definition
DWORD means double word and contains 32 addressable bits. Typical uses include status masks, control words, protocol fields and packed Boolean flags. Hexadecimal notation is useful because each hex digit represents four bits.
Do not describe DWORD as simply an unsigned 32-bit integer. In IEC-style type systems, UDINT is the unsigned numeric type while DWORD belongs to the bit-string family. Some vendors allow convenient casts or bit-level access, but arithmetic and conversion rules differ; consult the target runtime before mixing DWORD with DINT or UDINT.
Evidence and review status
The distinction between numeric and bit-string types is supported by PLCopen guidance and Rockwell CIP data-type documentation. Bit-access syntax remains vendor-specific.
Technical review date:
Critical behavior to understand
- DWORD stores 32 bits; its meaning depends on the mask or protocol definition applied to those bits.
- DINT is signed numeric, UDINT is unsigned numeric and DWORD is a bit string.
- Logical operations such as AND, OR and XOR are natural DWORD operations; arithmetic may require conversion.
- Bit numbering, byte order and network byte order must be confirmed at interface boundaries.
Verification checklist
- 1Document the meaning of every used bit and every reserved bit.
- 2Test the mask in hexadecimal and binary representations.
- 3Confirm bit numbering and endianness with the connected device manual.
- 4Use an explicit conversion when crossing between bit-string and numeric types.
Worked example
Test whether status bit 3 is set
StatusWord = 16#0000000C and Mask = 16#00000008.
- 1Apply MaskedValue := StatusWord AND Mask.
- 2Compare MaskedValue with zero.
- 3Repeat with StatusWord = 16#00000004.
Expected result: Bit 3 is set in 16#0000000C, so the first masked result is nonzero. It is clear in 16#00000004, so the second result is zero.
Primary and technical sources
These links support the specific behavior or product identity described above. Project documentation and the target platform's help remain authoritative for implementation.
- CIP data types
Rockwell Automation — Separates UDINT numeric and DWORD bit-string types
- IEC data-type consistency overview
PLCopen
Continue with the relevant guide
Common Questions
What is DWORD?
DWORD is a 32-bit bit-string data type used for masks, packed status bits and hexadecimal patterns. It has the same storage width as DINT and UDINT, but DWORD represents bits rather than a signed or unsigned numeric quantity.
When should I use DWORD?
DWORD is particularly useful in scenarios such as Bit masks and packed status flags and Protocol and device status words. Consider implementing it when you need reliable, efficient solutions for these types of applications.
What should I verify before using DWORD?
Document the meaning of every used bit and every reserved bit. Test the mask in hexadecimal and binary representations. Confirm bit numbering and endianness with the connected device manual. Use an explicit conversion when crossing between bit-string and numeric types.
What are related concepts I should learn?
To fully understand DWORD, you should also familiarize yourself with WORD, LWORD, and DINT. These concepts work together in industrial automation systems.
Continue Learning
Ready to deepen your understanding of DWORD? Here are some recommended resources:
Was this helpful?
Let us know if this glossary term helped you understand DWORD 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