Encoders

Decimal to BCD encoder

This encoder takes 10 inputs, and gives out 4 bit BCD output. For example, when pin '2' is set to '1' and all other input to '0', the output will be "0010". This shows that the output gives count of the pin which is selected. Again if pin 5 is set to '1' and others to '0' then its BCD output will be "0101". A block diagram of such a encoder is shown below...

decimal_to_bcd

But in case more than one pin is set to '1', then the pin which has higher number will get the priority. For example suppose pin 3 and pin 7 both are set to '1', then input 7 will be taken and BCD output will be "0111".

Lets take a practical example and see where this encoder can be used. Suppose there are 9 devices, and each of them needs their data to get processed by a small microprocessor. In such scenario, we can connect these devices to the processor through Decimal-to-BCD encoder. Here we have the flexibility to connect the most important device to pin 9, and least important device to pin 1. Making connection like this gives them priority over one another.

Now, whenever devices are ready with data, each device will set data available to '1' which is connected to the input of decimal-to-bcd. On the output, BCD value of the highest priority requested device will be there. Once the processor process it, the device will de-assert its request and the processor can look at lower priority devices since BCD of lower priority device will be on the output now. In this way the processor will be able to serve each device depending on their priorities...

Inputs Outputs
    1         2         3         4         5         6         7         8         9    
0 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 0
X 1 0 0 0 0 0 0 0
X X 1 0 0 0 0 0 0
X X X 1 0 0 0 0 0
X X X X 1 0 0 0 0
X X X X X 1 0 0 0
X X X X X X 1 0 0
X X X X X X X 1 0
X X X X X X X X 1
    A         B         C         D    
0 0 0 0
0 0 0 1
0 0 1 0
0 0 1 1
0 1 0 0
0 1 0 1
0 1 1 0
0 1 1 1
1 0 0 0
1 0 0 1


Below is shown truth table of BCD encoder which very much explains how the encoder will behave for each input..