BCD to integer FROM BCD
Turns BCD from thumbwheels into a number.
PACKED_BCD_TO_INTEGER
SourceGlobal.Thumbwheel66DestGlobal.Setpoint42
| Tag | After two scans |
|---|---|
| Setpoint | 42 |
| Thumbwheel | 66 |
How it works
While the rung is true, reads each 4 bits of Source as one decimal digit, so 66 (0100 0010) becomes 42. A group of 4 bits above 9 is a fault.
How it's used
Use FROM BCD to read thumbwheel switches.
PACKED_BCD_TO_INTEGER
SourceGlobal.Thumbwheel66DestGlobal.Setpoint42
| Tag | Value |
|---|---|
| Thumbwheel | 66 |
| Setpoint | 42 |
The switches show 4 and 2, so Setpoint is 42.
Operands
| Operand | Data type | Read or write |
|---|---|---|
| Source | DINT or a number | Reads |
| Dest | DINT | Writes |
Common mistakes
- Reading a word that is not BCDEach group of 4 bits must be 0 to 9. A group above 9 is a fault.