编码器和译码器3.3.1编码器(Encoder)编码:用文字、符号或者数字表示特定对象的过程(用二进制代码表示不同事物)二进制编码器二—十进制编码器分类:普通编码器优先编码器2n→n10→4或Y1I1编码器Y2YmI2In代码输出信息输入编码器框图一、二进制编码器用n位二进制代码对N=2n个信号进行编码的电路1.3位二进制编码器(8线-3线)编码表函数式Y2=I4+I5+I6+I7Y1=I2+I3+I6+I7Y0=I1+I3+I5+I7输入输出I0I7是一组互相排斥的输入变量,任何时刻只能有一个端输入有效信号。输入输出000001010011100101110111Y2Y1Y0I0I1I2I3I4I5I6I73位二进制编码器I0I1I6I7Y2Y1Y0I2I4I5I3函数式逻辑图—用或门实现—用与非门实现76542IIIIY76321IIIIY75310IIIIY7654IIII7632IIII7531IIIIY0Y1Y2≥1≥1≥1I7I6I5I4I3I2I1I0&&&Y0Y1Y24567IIII23II01II优先编码:允许几个信号同时输入,但只对优先级别最高的进行编码。优先顺序:I7I0编码表输入输出I7I6I5I4I3I2I1I0Y2Y1Y0111101110001101000110000001011000001010000000100100000001000函数式2.3位二进制优先编码器45672IIIIY245345671IIIIIIIIY12463465670IIIIIIIIIIY输入输出为原变量逻辑图输入输出为反变量Y2Y1Y0≥1≥1≥1&&1111111111117I6I5I4I3I2I1I0I1112Y1Y0YI7I6I5I4I3I2I1I0用4位二进制代码对0~9十个信号进行编码的电路1.8421BCD编码器2.8421BCD优先编码器3.集成10线-4线优先编码器(7414774LS147)三、几种常用编码1.二-十进制编码8421码余3码2421码5211码余3循环码右移循环码循环码(反射码或格雷码)ISO码ANSCII(ASCII)码二、二-十进制编码器2.其他二-十进制编码器I0I2I4I6I8I1I3I5I7I9Y0Y1Y2Y33.3.2译码器(Decoder)编码的逆过程,将二进制代码翻译为原来的含义一、二进制译码器(BinaryDecoder)输入n位二进制代码如:2线—4线译码器3线—8线译码器4线—16线译码器A0Y0A1An-1Y1Ym-1二进制译码器……输出m个信号m=2n1.3位二进制译码器(3线–8线)真值表函数式0127AAAY0120AAAY0121AAAY0122AAAY0123AAAY0124AAAY0125AAAY0126AAAYA0Y0A1A2Y1Y73位二进制译码器…012AAA01234567YYYYYYYY00000001000000100000010000001000000100000010000001000000100000000000010100111001011101113线-8线译码器逻辑图000—输出低电平有效工作原理:11111101&Y7&Y6&Y5&Y4&Y3&Y2&Y1&Y0A2A2A1A1A0A0111111A2A1A0001111101110101011111101111101111100111110111011111111011011011111111011111112.集成3线–8线译码器--74LS138引脚排列图功能示意图321SSS、、输入选通控制端1S0321SS或芯片禁止工作01321SSS且芯片正常工作VCC地1324567816151413121110974LS138Y0Y1Y2Y3Y4Y5Y6A0A1A2S3S2S1Y774LS138Y0Y1Y2Y3Y4Y5Y6A0A1A2S3S2S1Y0Y1Y2Y3Y4Y5Y6Y7A0A1A2STBSTCSTAY73.二进制译码器的级联两片3线–8线4线-16线Y0Y7Y8Y1574LS138Y0Y1Y2Y3Y4Y5Y6A0A1A2STBSTCSTA高位Y7A0A1A2A374LS138Y0Y1Y2Y3Y4Y5Y6A0A1A2STBSTCSTA低位Y710工作禁止有输出无输出1禁止工作无输出有输出07815三片3线-8线5线-24线34AA(1)(2)(3)输出工禁禁70~YY禁工禁158~YY禁禁工2316~YY00011011禁禁禁全为174LS138(1)Y0Y1Y2Y3Y4Y5Y6A0A1A2STBSTCSTAY0Y7Y774LS138(3)Y0Y1Y2Y3Y4Y5Y6A0A1A2STBSTCSTAY16Y7Y2374LS138(2)Y0Y1Y2Y3Y4Y5Y6A0A1A2STBSTCSTAY8Y7Y15A0A1A2A3A4………………1功能特点:输出端提供全部最小项电路特点:与门(原变量输出)与非门(反变量输出)4.二进制译码器的主要特点二、二-十进制译码器(Binary-CodedDecimalDecoder)将BCD码翻译成对应的十个输出信号集成4线–10线译码器:744274LS42半导体显示(LED)液晶显示(LCD)共阳极每字段是一只发光二极管三、显示译码器数码显示器aebcfgdabcdefgR+5VYaA3A2A1A0+VCC+VCC显示译码器共阳YbYcYdYeYfYg00000000001000100101001111001001000110100010101100000110100110001001000100000—低电平驱动011100011111000000000010010000100共阴极abcdefgR+5VYaA3A2A1A0+VCC显示译码器共阴YbYcYdYeYfYg—高电平驱动00001111110000100100110000110110100110100010101100111100010011111001011001110110111011111111000011111111111011aebcfgd驱动共阴极数码管的电路—输出高电平有效YaYbYcYdYeYfYgA3A2A1A0≥1≥11≥1≥1≥1≥1≥1≥1≥1≥1≥1≥1≥1≥1≥1≥1≥1≥1≥1111驱动共阳极数码管的电路A3A2A1A0YaYbYcYdYeYfYg—输出低电平有效&&1&&&&&&&&&&&&&&&&&111&1