PLC Reads 18 When the Device Shows 12? It Might Be BCD
- PLC Play Ground
- 0
- Posted on
A register that resembles an ordinary integer may contain binary-coded decimal. If a device displays 12 while the PLC reads 18, inspect the documented representation. BCD and binary agree for some small values, hiding the problem during limited testing.
Packed BCD teaching example; special codes and supported instructions vary.
What is happening?
Packed BCD assigns one decimal digit to each four-bit nibble. Interpreting the complete pattern as binary gives a different number when additional digit positions are used. Sign conventions, unused positions, and invalid codes are device-specific.
Check these five things
-
Confirm the manual explicitly specifies BCD.
-
Capture the raw hexadecimal register before conversion.
-
Validate every digit position against allowed values.
-
Use a documented converter with explicit width and sign handling.
-
Test digit boundaries and invalid nibbles in an offline model.
Worked example
Packed BCD 0x0012 represents decimal 12; ordinary binary interpretation gives 18. Likewise, BCD 0x0010 represents 10 while binary interpretation gives 16. A digit nibble of 0xA is invalid unless that position has a separately documented purpose.
Quick diagnostic reference
| Raw word | BCD | Binary |
|---|---|---|
| 0x0009 | 9 | 9 |
| 0x0010 | 10 | 16 |
| 0x0012 | 12 | 18 |
The mistake to avoid
A scale factor cannot repair BCD decoding. The relationship changes at digit boundaries, so a multiplier fitting one observation will fail elsewhere.
How to verify the fix
Compare known device values across every supported digit boundary. Invalid encodings should produce a clear diagnostic, not a plausible measurement. Include the representation and width in tag descriptions and interface records.
Field-work boundary: These are educational diagnostic guides. Use the exact equipment manuals and approved site procedures. Electrical testing and machinery changes belong to qualified, authorized personnel; control hazardous energy and validate affected functions before release.
Technical reference
Rockwell Automation: General Instructions Reference. The examples and diagnostic tables above are original teaching material; they do not replace the product manual.
