下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
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 decoder
2、(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 a
3、ddr=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 (presen
4、t_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 (po
5、sedge 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,din
6、,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: decode
7、rout=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=8b0
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2026年精神病学多物质滥用诊断考模拟题及答案详解
- 2026年药店员工招工模拟题及答案详解
- 2026年竞聘性格模拟题及答案详解
- 2026年历史双语模拟试卷(含答案)
- 2026年教师扫帚模拟题及答案详解
- 2026年推销技术模拟试卷(含答案)
- 2026年急诊医学主治医师考试模拟题及答案详解
- 2026年中国烟草模拟试卷型(含答案)
- 河北建设集团股份有限公司右卫分公司介绍企业发展分析报告模板
- 企业文化建设管理办法
- 2026人教PEP版五年级英语上册 Unit2 My Feelings 知识清单
- 4D性格测试题(完整版+通俗答案解析)
- 2026秋季新教材湘美版小学美术四年级上册(全册)教学设计(附目录)
- 26苏教版四上数学必背知识点(全册)
- 2025年日照信息科技中考考试试题及答案
- 新版教科版四年级上册科学(课件)第2单元 5 口腔里的消化
- 苏教版2026-2027四年级数学上册教学计划及进度
- 2026年硬质合金混合料制备工专项题库(附答案与解释)
- 老年人误吸的预防护理课件
- 2026年上海市中考语文试卷附答案
- 2026高考语文真题全国Ⅰ卷满分范文拆解《不再做纠结的布里丹之驴》
评论
0/150
提交评论