实验六七三八译码器及应用_第1页
实验六七三八译码器及应用_第2页
实验六七三八译码器及应用_第3页
实验六七三八译码器及应用_第4页
实验六七三八译码器及应用_第5页
已阅读5页,还剩10页未读 继续免费阅读

付费下载

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

实验原理译2n8421BCD210进制或16进制数的转换,可分为驱动LEDLCD两类。 3-8Vcc Vcc 3B A 1A 2Y

楼道灯控制器可用3-8译实现,如下:2.2实验原理共阳连接:8个LED正极连在一起,负极低电平时点亮(50MHz选选选选A~G,Y选选选选A~G,Y4选1选选选选Y选选4选1选选选选4LED041选选选选选Y41选选选选选Y

选选4选1选选选选选选选选选选modulemodulebasic_4to1_mux(inled0);inputwire[7:0]in;//输入端outputwireled0;//输出端always@(in[3:0],in[7:6])2'b00led0in[0002'b01led0in[1012'b10led0in[2102'b11led0in[311in[3]modulemodule yswitch(clk,digit_anode,//portdeclaration,anddefinevariable:disp_numassigndisp_num=16'b1010_1011_1100_1101;//显示"AbCd“dis yDIS Y_0(clk,disp_num,digit_anode,segment);endmodulemodule y(clk,disp_num,digit_anode,//portdeclaration,anddefinevariable:cnt,numalways@(posedgeclk)begin//incrementcase// yeachdigitaccordingto// y0~Faccrodingtomodule yswitch(clk,btn_in,digit_anode,//portdeclaration,anddefinevariable:initialdisp_num<=16'b1010_1011_1100_1101;//dis y"AbCd"always@(posedgebtn_in[0]disp_num30]<disp_num304'd1;//如果按键btn_in[0]被按下,则将对应的要显示的数值加1always@(posedgebtn_in[1]disp_num74]<disp_num744'd1;//如果按键btn_in[1]被按下,则将对应的要显示的数值加1always@(posedgebtn_in[2]disp_num[118]<disp_num[1184'd1;//如果按键btn_in[2]被按下,则将对应的要显示的数值加1always@(posedgebtn_in[3]disp_num[15:12]<disp_num[15:124'd1;//如果按键btn_in[3]被按下,则将对应的要显示的数值加1 yDIS Y_0(clkdisp_numdigit_anodesegment);//4个module y(clk,disp_num,digit_anode,//portdeclaration,anddefinevariable:cnt,numalways@(posedgeclk)begin//incrementcase// yeachdigitaccordingto// y0~Faccrodingtomodulemodule yswitch(clk,btn_in,digit_anode,//portdeclaration,anddefinevariable:disp_num,clk_1ms, (clk,disp_num,digit_anode,(clk,anti_jitterANTI_JETTER(clk,clk_1ms,btn_in,initialdisp_num<=//ydisp_num[3:0]<=disp_num[3:0]disp_num[4]<=disp_num[+++装有ISE的计算机系 1Spartan-III开发 1无装有ISE的计算机系 1Spartan-III开发 1无Spartan33-8modulemoduledecoder38(C,B,A,G,G2A,G2B,inputwireA,B,C,G,G2A,G2B; outputwire[7:0]Y;//输出端 node00(An,A),//1-2译node01(Bn,B),//1-2译node02(Cn,C),//1-2译node03(GnG)使能端构造andnode10(D0,Bn,An),//4个3输入与门,与两个1-2 node_1_1(D1,B_n,A),node12(D2, Anode13(D3, Anornode_1_4(EN,G_n,G2A,G2B);//使能端构造 node20(Y[0],EN,D0,Cn), node21(Y[1],EN,D1,Cnode_2_2(Y[2],EN,D2,node23(Y[3],EN,D3,Cnode24(Y[4],EN,D0,Cnode_2_5(Y[5],EN,D1,Cnode26(Y[6],EN,D2,Cnode27(Y[7],EN,D3,C输出用8个LED。NET”C”LOC=”K13”;//NET”C”LOC=”K13”;//输入端CNET”B”LOC=”K14”;//输入端BNET”A”LOC=”J13”;//输入端ANET”G”LOC=”H14”;//使能端G LOC=”P11”//LED灯 LOC=”P12”//LED灯 LOC=”N12”//LED灯 LOC=”P13”//LED灯 LOC=”N14”//LED灯 LOC=”L12”//LED灯 LOC=”P14”//LED LOC=”K12//LEDmodulemoduleregC;regB;regA;regG;regG2A;regwire[7:0]integer//InstantiatetheUnitUnderTest(UUT)decoder_3_8uut()//InitializeInputsC=0;B=A=G=G2A=G2BG2B=G=G2A=G2B=assignG=0;assignG2A=0;assignG2B=0;assignG=1;assignG2A=1;assignG2B=0;assignG=1;assignG2A=0;assignG2B=1;用3-8译实现楼道灯控制modulemoduletop(inputwireC,B,A,G,G2A,G2B,outputwireY);wire[7:0]decoderdecoder38INSTANCE(C,B,A,G,G2A,G2B,assignY=!(T[1]&T[2]&T[4]&输出用1个LED。 LOC=”K13”;// LOC=”K13”;//输入端C LOC=”K14”;//输入端B LOC=”J13”;//输入端A LOC=”H14”;//使能端G case47 y(inputinputwire[15:0]digit,//显示的数据outputreg3:0node4个数码管的位选outputreg[7:0]segment);//七段+小数点reg[3:0]code=4'b0;reg[15:0]count=always@(posedgeclkbegin上升沿触发case(count[15:14]);;;;;;;;;;;;;;;;node<=4'b1110;codenode<=4'b1110;code<=digit[3:0];node<=4'b1101;code<=digit[7:4];node<=4'b1011;code<=digit[11:8];node<=4'b0111;code<=digit[15:12];default:segment<=8'b countcount1module always@(posedgedisp_num[disp_num[+always@(posedgedisp_num[disp_num[+always@(posedge+modulepbdebounce(inputwireclk,inputmodulepbdebounce(inputwireclk,inputwirebutton,outputregreg[7:0]pbshift;wirepbshift[0]=button;//pbshift[0]赋值if(pbshift==0)moduletimer_1ms(inputmoduletimer_1ms(inputwireclk,outputregreg[15:0]cnt;initialbegincnt[15:0<=0;//设置初值clk_1ms<=0;//设置初值always@(posedgeclk)if(cnt>=25000beginelsebeginUFCNetNet"clk"loc=net"segment[0]"loc="E14";net"segment[1]"loc="G13";net"segment[2]"loc="N15";net"segment[3]"loc="P15";net"segment[4]"loc="R16";net"segment[5]"loc="F13";net"segment[6]"loc="N16";net"segment[7]"loc="P16";net"digit_anode[0]"loc="D14";net"digit_anode[1]"loc="G14";net"digit_anode[2]"loc="F14";net"digit_anode[3]"loc="E13“;net"btn_in[0]"loc="L14";net"btn_in[1]"loc="L13";net"btn_in[2]"loc="M14";net"btn_in[3]"loc

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论