Friday, July 8, 2011

Encoder



The Encoder IC can be viewed as a device which produce or generate the binary code for a particular input. In this example, the 10 input pins are connected to a keypad consisting of 10 keys '0' to '9'. When the key '9' is depressed, the particular input signal is active low, and hence the generated output code is binary "1001", representing the decimal number 9.

Now, for encoder (as different from the decoder), there is a possibility of multiple inputs active at the same time. For the example given above, this happens when two or more keys are depressed at the same time. Hence, there must be a priority scheme to give higher priorities to some inputs. For this case, if another key lower value than '9' is depressed at the same time, the priority will be given to '9' and the output will remain at "1001".

Hence, the truth table for the encoder is:




[more: timing diagram]

Decoder



The decoder IC can be viewed with the analogy as shown above. The input code (ABC) is analogous to the delivery instruction written on the package - the name/address/date etc. and the outputs (Y0:Y7) are analogous to dispatching the delivery man. The enable input (G1, G2A, G2B) are analogous to the cash payment. Once received, the delivery service will be enabled. Note that, when enabled, for each code there will only be one output activated.

For example, when the input code (written on the package) is "110", and the enable inputs G1G2aG2b = "100", the decoder will be enabled and activates the output signal on output pin Y6, since binary "110" = decimal 6.

Active High/Active Low

Some students find it difficult to understand the concept of "active high" or "active low". They are just different ways of control, depending on the requirement of the next stage. As an analogy, you can either ask "those who agree put up your hand" or "those who disagree put up your hand", although the purpose of that is more psychological than technical.

Hence, for the decoder 74LS138, only the output that is activated goes low, the other outputs stay high (inactive). Thus, we can construct the truth table of this decoder:




[more: timing diagram]