BCD (Binary Coded Decimal) Number System -
Each place for example 10's place uses values relative to (8 4 2 1) for example, the number 6=0110, or number 8=1000.
decimal place | Thousands | Hundreds | Tens | SINGLE DIGIT |
Example of 129 | 0000 | 0001 | 0010 | 1001 |
Example of 45 | 0000 | 0000 | 0100 | 0101 |
Bit combinations that add up to be greater then 9 for example 1111 which=15 cannot be used.
For a BCD decode on a machine tool you must use at minimum the 40's or M40. The Mcodes used must not currently be used in the machine. If you do not use all the wires for the hundreds and the single digit sections, then you may have multiple M-codes that will fire the output you decoded.
If using only needing 2 or less M-codes and they are output as BCD. You can setup one for M40, and one for M80. Given the machine dies, do not use them. This way you only need to wire in 2 wires; the 40's and 80's. But remember M40-M49 will all turn on the same output. The same goes for M80-M89.