配色: 字号:
4
2013-11-29 | 阅:  转:  |  分享 
  
Tutorial:4of8

---SelectaTutorialPage---

GoReset

TheDigitalEncoder

Unlikeamultiplexerthatselectsoneindividualdatainputlineandthensends

thatdatatoasingleoutputlineorswitch,aDigitalEncodermorecommonly

calledaBinaryEncodertakesALLitsdatainputsoneatatimeandthen

convertsthemintoasingleencodedoutput.Sowecansaythatabinaryencoder,

isamulti-inputcombinationallogiccircuitthatconvertsthelogiclevel"1"

dataatitsinputsintoanequivalentbinarycodeatitsoutput.

Generally,digitalencodersproduceoutputsof2-bit,3-bitor4-bitcodes

dependinguponthenumberofdatainputlines.An"n-bit"binaryencoder

has2inputlinesandn-bitoutputlineswithcommontypesthatinclude4-to-2,8-

to-3and16-to-4lineconfigurations.Theoutputlinesofadigitalencoder

generatethebinaryequivalentoftheinputlinewhosevalueisequalto"1"and

areavailabletoencodeeitheradecimalorhexadecimalinputpatterntotypically

abinaryorB.C.D.outputcode.

4-to-2BitBinaryEncoder

Oneofthemaindisadvantagesofstandarddigitalencodersisthattheycan

generatethewrongoutputcodewhenthereismorethanoneinputpresentatlogic

level"1".Forexample,ifwemakeinputsDandDHIGHatlogic"1"bothatthe

sametime,theresultingoutputisneitherat"01"orat"10"butwillbeat"11"

whichisanoutputbinarynumberthatisdifferenttotheactualinputpresent.

Also,anoutputcodeofalllogic"0"scanbegeneratedwhenallofitsinputsare

at"0"ORwheninputDisequaltoone.

Onesimplewaytoovercomethisproblemisto"Prioritise"thelevelofeachinput

pinandiftherewasmorethanoneinputatlogiclevel"1"theactualoutputcode

wouldonlycorrespondtotheinputwiththehighestdesignatedpriority.Thenthis

typeofdigitalencoderisknowncommonlyasaPriorityEncoderorP-

encoderforshort.

PriorityEncoder

ThePriorityEncodersolvestheproblemsmentionedabovebyallocatinga

priorityleveltoeachinput.Thepriorityencodersoutputcorrespondstothe

currentlyactiveinputwhichhasthehighestpriority.Sowhenaninputwitha

n

12

0

higherpriorityispresent,allotherinputswithalowerprioritywillbe

ignored.Thepriorityencodercomesinmanydifferentformswithanexampleofan8-inputpriorityencoderalongwithitstruthtableshownbelow.

8-to-3BitPriorityEncoder

PriorityencodersareavailableinstandardICformandtheTTL74LS148isan8-

to-3bitpriorityencoderwhichhaseightactiveLOW(logic"0")inputsand

providesa3-bitcodeofthehighestrankedinputatitsoutput.Priorityencoders

outputthehighestorderinputfirstforexample,ifinputlines"D2","D3"and

"D5"areappliedsimultaneouslytheoutputcodewouldbeforinput"D5"("101")as

thishasthehighestorderoutofthe3inputs.Onceinput"D5"hadbeenremoved

thenexthighestoutputcodewouldbeforinput"D3"("011"),andsoon.

Thetruthtablefora8-to-3bitpriorityencoderisgivenas:

DigitalInputsBinaryOutput

DDDDDDDDQQQ

00000001000

0000001X001

000001XX010

00001XXX011

0001XXXX100

001XXXXX101

01XXXXXX110

1XXXXXXX111

Fromthistruthtable,theBooleanexpressionfortheencoderabovewith

inputsDtoDandoutputsQ,Q,Qisgivenas:

OutputQ

76543210210

07012

0

OutputQ

OutputQ

ThenthefinalBooleanexpressionforthepriorityencoderincludingthezero

inputsisdefinedas:

Inpracticethesezeroinputswouldbeignoredallowingtheimplementationofthe

finalBooleanexpressionfortheoutputsofthe8-to-3priorityencoderaboveto

beconstructedusingindividualORgatesasfollows.

DigitalEncoderusingLogicGates

1

2

EncoderApplications

KeyboardEncoder

Priorityencoderscanbeusedtoreducethenumberofwiresneededinaparticular

circuitsorapplicationthathavemultipleinputs.Forexample,assumethata

microcomputerneedstoreadthe104keysofastandardQWERTYkeyboardwhereonly

onekeywouldbepressedeither"HIGH"or"LOW"atanyonetime.Onewaywouldbe

toconnectall104wiresfromthekeysdirectlytothecomputerbutthiswouldbe

impracticalforasmallhomePC,butanotherbetterwaywouldbetouseapriority

encoder.

The104individualbuttonsorkeyscouldbeencodedintoastandardASCIIcodeof

only7-bits(0to127decimal)torepresenteachkeyorcharacterofthekeyboard

andtheninputtedasamuchsmaller7-bitB.C.Dcodedirectlytothecomputer.

Keypadencoderssuchasthe74C92320-keyencoderareavailabletodojustthat.

PositionalEncoders

Anothermorecommonapplicationisinmagneticpositionalcontrolasusedonships

navigationorforroboticarmpositioningetc.Hereforexample,theangularor

rotarypositionofacompassisconvertedintoadigitalcodebya74LS1488-to-3

linepriorityencoderandinputtedtothesystemscomputertoprovidenavigational

dataandanexampleofasimple8positionto3-bitoutputcompassencoderis

shownbelow.Magnetsandreedswitchescouldbeusedateachcompasspointto

indicatetheneedlesangularposition.

PriorityEncoderNavigation



CompassDirectionBinaryOutputQQQ

North000

North-East001

East010

South-East011

South100

South-West101

West110

North-West111

InterruptRequests

OtherapplicationsespeciallyforPriorityEncodersmayincludedetecting

interruptsinmicroprocessorapplications.Herethemicroprocessorusesinterrupts

toallowperipheraldevicessuchasthediskdrive,scanner,mouse,orprinter

etc,tocommunicatewithit,butthemicroprocessorcanonly"talk"toone

peripheraldeviceatatime.Theprocessoruses"InterruptRequests"or"IRQ"

signalstoassignprioritytothedevicestoensurethatthemostimportant

peripheraldeviceisservicedfirst.Theorderofimportanceofthedeviceswill

dependupontheirconnectiontothepriorityencoder.

IRQNumberTypicalUseDescription

IRQ0SystemtimerInternalSystemTimer.

IRQ1KeyboardKeyboardController.

IRQ3COM2&COM4SecondandFourthSerialPort.

IRQ4COM1&COM3FirstandThirdSerialPort.

IRQ5SoundSoundCard.

IRQ6FloppydiskFloppyDiskController.

IRQ7ParallelportParallelPrinter.

IRQ12MousePS/2Mouse.

IRQ14PrimaryIDEPrimaryHardDiskController.

IRQ15SecondaryIDESecondaryHardDiskController.

Becauseimplementingsuchasystemusingpriorityencoderssuchasthestandard

74LS148priorityencoderICinvolvesadditionallogiccircuits,purposebuilt

integratedcircuitssuchasthe8259ProgrammablePriorityInterruptControlleris

available.

DigitalEncoderSummary

Thentosummarise,theDigitalEncoderisacombinationalcircuitthatgenerates

aspecificcodeatitsoutputssuchasbinaryorBCDinresponsetooneormore

activeinputs.Therearetwomaintypesofdigitalencoder.TheBinary

EncoderandthePriorityEncoder.

TheBinaryEncoderconvertsoneof2inputsintoann-bitoutput.Thenabinary

encoderhasfeweroutputbitsthantheinputcode.Binaryencodersareusefulfor

compressingdataandcanbeconstructedfromsimpleANDorORgates.Oneofthe

maindisadvantagesofastandardbinaryencoderisthatitwouldproduceanerror

012

n

atitsoutputsifmorethanoneinputwereactiveatthesametime.Toovercomethisproblempriorityencodersweredeveloped.

ThePriorityEncoderisanothertypeofcombinationalcircuitsimilartoa

binaryencoder,exceptthatitgeneratesanoutputcodebasedonthehighest

prioritisedinput.Priorityencodersareusedextensivelyindigitalandcomputer

systemsasmicroprocessorinterruptcontrollerswheretheydetectthehighest

priorityinput.

Inthenexttutorialaboutcombinationallogicdevices,wewilllookat

complementaryfunctionoftheencodercalledaDecoderwhichconvertann-

bitinputcodetooneofits2outputlines.n

献花(0)
+1
(本文系Transistor2...首藏)