EDA数字电压表设计_第1页
EDA数字电压表设计_第2页
EDA数字电压表设计_第3页
全文预览已结束

下载本文档

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

文档简介

1、.数字电压表源程序:module shuzidianya(ale,start,oe,addr,seg,d,eoc,clk,clk1k);output ale,start,oe; /通道锁存,转换开始,输出允许output2:0 addr; /通道选择output7:0 seg; /数码管段选input7:0 d; /转换结果输入input eoc,clk,clk1k; /转换结束wire7:0 q;wire3:0 dec_in;adcint(ale,start,oe,addr,q,d,clk,eoc);segscan segscan(dec_in,q,clk1k);decoder decode

2、r(seg,dec_in);endmodule/ADC0809控制模块module adcint(ale,start,oe,addr,q,d,clk,eoc);output ale,start,oe;output2:0 addr;output7:0 q;input7:0 d;input clk,eoc;reg ale,start,oe;reg7:0 q;reg lock;reg4:0 present_state,next_state;parameter st0=5b00001, st1=5b00010, st2=5b00100, st3=5b01000, st4=5b10000;assign

3、addr=3b000;always (posedge clk)begin present_state=next_state;endalways (present_state or eoc)begin case(present_state)st0:next_state=st1;st1:next_state=st2;st2: begin if(eoc) next_state=st3; else next_state=st2; endst3:next_state=st4;st4:next_state=st0;default:next_state=st0;endcaseendalways (prese

4、nt_state) begin case(present_state) st0:begin ale=0;start=0;lock=0;oe=0;end st1:begin ale=1;start=1;lock=0;oe=0;end st2:begin ale=0;start=0;lock=0;oe=0;end st3:begin ale=0;start=0;lock=0;oe=1;end st4:begin ale=0;start=0;lock=1;oe=1;end default begin ale=0;start=0;lock=0;oe=0;end endcase endalways (p

5、osedge lock)begin q=d; endendmodulemodule weisaomiao(clk,sel1);input clk;output 1:0sel1;reg 1:0sel1;always (posedge clk )beginsel1=sel1+1; endendmodulemodule suocun( qo, din, load );output7:0 qo;input7:0 din;input load;reg7:0 qo;always ( posedge load )beginqo = din;endendmodulemodule segscan(dout,di

6、n,sel);output3:0 dout;input 7:0 din;input sel;reg3:0 dout;always (sel or din)begin if (sel) dout=din3:0; else dout=din7:4;endendmodule/显示译码模块module decoder(decoderout,dec_in);output7:0 decoderout;input3:0 dec_in;reg7:0 decoderout;always (dec_in)begin case(dec_in)4h0: decoderout=8b00111111;4h1: decod

7、erout=8b00000110;4h2: decoderout=8b01011011;4h3: decoderout=8b01001111;4h4: decoderout=8b01100110;4h5: decoderout=8b01101101;4h6: decoderout=8b01111101;4h7: decoderout=8b00000111;4h8: decoderout=8b01111111;4h9: decoderout=8b01101111;4ha: decoderout=8b01110111;4hb: decoderout=8b01111100;4hc: decoderout=8b001

温馨提示

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

评论

0/150

提交评论