Integer to BCD TO BCD
Turns a number into BCD for a digit display.
INTEGER_TO_PACKED_BCD
SourceGlobal.Display42DestGlobal.DisplayBCD66
| Tag | After two scans |
|---|---|
| Display | 42 |
| DisplayBCD | 66 |
How it works
While the rung is true, writes Source as BCD: each decimal digit in its own 4 bits, so 42 becomes 0100 0010, which is 66. Source must be 0 to 99,999,999.
How it's used
Use TO BCD to drive a digit display.
INTEGER_TO_PACKED_BCD
SourceGlobal.Count42DestGlobal.Display66
| Tag | Value |
|---|---|
| Count | 42 |
| Display | 66 |
Each digit of 42 gets 4 bits: 0100 0010, which is 66.
Operands
| Operand | Data type | Read or write |
|---|---|---|
| Source | DINT or a number | Reads |
| Dest | DINT | Writes |
Common mistakes
- Using a negative numberSource must be 0 to 99,999,999.