Electronics Tutorials Home Page


Valid XHTML Web Page

Do you like our Site?
Help us to Share It

Bookmark to: Google Bookmark to: Yahoo Bookmark to: Digg Bookmark to: Del.icio.us Bookmark to: Technorati
Bookmark to: Facebook Bookmark to: Reddit Bookmark to: StumbleUpon Bookmark to: Slashdot Bookmark to: Newsvine
Bookmark to: Propeller Bookmark to: Blinklist Bookmark to: Simpy


Electronics Tutorial about Encoders
 

Priority Encoders

Navigation
Page: 4 of 8

The Encoder

Unlike a multiplexer that selects one individual data input line and then sends that data to a single output line or switch, an Encoder takes all the data inputs one at a time and converts them to a single encoded output. Then, it is a multi-input data line, combinational logic circuit that converts the logic level "1" data at its inputs to an equivalent binary code at its output. Generally encoders produce outputs of 2-bit, 3-bit or 4-bit codes depending upon the number of data input lines and a "n-bit" encoder has 2n input lines with common types that include 4-to-2, 8-to-3 and 16-to-4 line configurations. Encoders are available to encode either a decimal or hexadecimal input pattern to typically a binary or B.C.D. output code.

4-to-2 Bit Encoder

4-input Encoder

One of the main disadvantages of standard encoders is that they can generate the wrong output code when there is more than one input present at logic level "1". For example, if we make inputs D1 and D2 HIGH at logic "1" at the same time, the resulting output is neither at "01" or at "10" but will be at "11" which is an output code that is different to the actual input present. One simple way to overcome this problem is to "Prioritize" the level of each input pin and if there was more than one input at logic level "1" the actual output code would only correspond to the input with the highest designated priority. Then this type of encoder are known as Priority Encoders or P-encoder.

Priority Encoders

Priority Encoders come in many forma and an example of an 8-input Priority Encoder along with its truth table is as shown below.

8-to-3 Bit Priority Encoder

Priority Encoders

Priority encoders are available in standard IC form and the TTL 74LS148 is an 8 to 3 bit priority encoder which has eight active LOW (logic "0") inputs and provides a 3-bit code of the highest ranked input at its output. Priority encoders output the highest order input first for example, if input lines "D2", "D3" and "D5" are applied simultaneously the output code would be for input "D5" ("101") as this has the highest order out of the 3 inputs. Once input "D5" had been removed the next highest output code would be for input "D3" ("011"), and so on.

Encoder Applications

Keyboard Encoders

Priority encoders can be used to reduce the number of wires needed in circuits or applications that has multiple inputs. For example, assume that a microcomputer needs to read the 104 keys of a standard QWERTY keyboard where only one key would be pressed or HIGH at any one time. One way would be to connect all 104 wires from the keys directly to the computer but this would be impractical for a small home PC, but another better way would be to use an encoder. The 104 individual buttons or keys could be encoded into a standard ASCII code of only 7-bits (0 to 127 decimal) to represent each key or character and then inputted as a much smaller 7-bit B.C.D code directly to the computer. Keypad encoders such as the 74C923 20-key encoder are available.

Positional Encoders

Another more common application is in magnetic positional control as used on ships or robots etc. Here the angular or rotary position of a compass is converted into a digital code by an encoder and inputted to the systems computer to provide navigational data and an example of a simple 8 position to 3-bit output compass encoder is shown below.

Compass Encoder


Compass Direction Binary Output
Q0Q1Q2
North000
North-East001
East010
South-East011
South100
South-West101
West110
North-West111

Interrupt Requests

Other applications for Priority Encoders may include detecting interrupts in microprocessor applications. Here the microprocessor uses interrupts to allow peripheral devices such as the disk drive, scanner, mouse, or printer etc, to communicate with it, but the microprocessor can only "talk" to one peripheral device at a time. The processor uses "Interrupt Requests" or "IRQ" signals to assign priority to the devices to ensure that the most important peripheral device is serviced first. The order of importance of the devices will depend upon their connection to the priority encoder.

Because implementing such a system using priority encoders such as the standard 74LS148 priority encoder IC involves additional logic circuits, purpose built integrated circuits such as the 8259 Programmable Priority Interrupt Controller is available.

IRQ NumberTypical Use Description
IRQ 0System timerInternal System Timer.
IRQ 1KeyboardKeyboard Controller.
IRQ 3COM2 & COM4Second and Fourth Serial Port.
IRQ 4COM1 & COM3First and Third Serial Port.
IRQ 5SoundSound Card.
IRQ 6Floppy diskFloppy Disk Controller.
IRQ 7Parallel portParallel Printer.
IRQ 12MousePS/2 Mouse.
IRQ 14Primary IDEPrimary Hard Disk Controller.
IRQ 15Secondary IDESecondary Hard Disk Controller.

Goto Page:  1 2 3 4 5 6 7 8

 External Links about Logic Encoders  
Digital Combinational Logic - Very Good Tutorial about Encoders.
 ASIC-World
Decoders, Muxes & Intro. into Sequential Circuits - Very Good Lecture Notes in pdf Format.
 Mike Feeley - University of British Columbia
A Hierarchical Priority Encoder - Tutorial about Decoding the 1st & 2nd Priority Information.
 Electronics for U
74F148 Datasheet - Datasheet for 74F148 8-input Priority Encoder.
 NXP Philips

Link to us : 
Add this Tutorial about Priority Encoders to your Favourites

Advertisement


Page Designed and Written by Wayne Storr.   Last updated  ,
Copyright © 1998 − 2010, Electronics-Tutorials.ws, All Right Reserved.