




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、LED数码管显示的VHDL设计桂林师范高等专科学校羊日飞LED数码管显示实例运行环境n红色飓风二代XILINX FPGA开发板 RC2-3S400 LED数码管的板级硬件电路n四位8段式共阴数码管1位2位3位4位位线位线段线段线LED数码管的板级硬件电路nLED数码管位线驱动电路qSEG_LED_S0、 SEG_LED_S1、 SEG_LED_S2 SEG_LED_S3 接FPGA相应引脚LED数码管的板级硬件电路n8段式共阴数码管的段码一、LED数码管的静态显示LED数码管的静态显示n四位数码管显示相同的字符n依次显示从0F的各个字符,每隔1s显示一个字符。 四位数码管器件内部复用了每位数码
2、管的8条数据线(a,b,c,d,e,f,g,dp) 若同时将四位数码管的位线(共阴公共端)接到低电平,则相当于同时选中数码管的4个位。 此时若段线输入某个段码,则四位数码管显示段码对应的同一字符。LED数码管静态显示的芯片级设计框图时钟源50MHz分频器计数器数码管驱动四位LED数码管FPGA1/50000000分频输出时钟信号的频率是1Hz,周期为1s。16进制计数器即有16种状态,每经过1s计数值加“1”,也即跳到下一个状态。段码译码器将16种状态码转换为相应的8位二进制LED数码管段码段码。1/50000000分频器(Divider)entity clkdiv is port( rese
3、t: in std_logic;clkin: in std_logic;clkout: buffer std_logic );end clkdiv;实体1/50000000分频器(Divider)architecture clkdiv_stru of clkdiv is signal count: integer range 0 to 25000000:=0;begin process( reset , clkin) begin if reset=0 then count=0; q=0; elsif clkinevent and clkin=1 then if count=25000000 t
4、hen count=0; clkout= not clkout; else count=count+1; end if; end if; end process; end clkdiv_stru;结构体16进制计数器entity counter is port( reset: in std_logic; clock: in std_logic; countout: out std_logic_vector(3 downto 0) );end counter;architecture counter_stru of counter is signal count: std_logic_vecto
5、r(3 downto 0);begin process( reset , clock) begin if reset=0 then count=“0000”; elsif clockevent and clock=1 then if count=“1111” then count=“0000”; else count=count+ “0001” ; end if; end if; end process; countout Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y , clkin= , clkout=
6、 ); counter_m:counter port map( reset= , clock= ,countout= ); decoderledout_m:decoderledout port map( state= , Y= ); ledbits=“1111”;end led8seg_stru;三个子模三个子模块的元件块的元件声明声明resetmclki_clkreseti_clki_statei_stateledsegsLED数码管显示的VHDL代码综合结果(顶层)LED数码管显示的VHDL代码综合结果(子模块)二、LED数码管的动态显示LED数码管的动态显示n四位数码管显示不同的字符,比
7、如“1234”n实现原理:n由于四位数码管器件内部复用了每位数码管的8条数据线(a,b,c,d,e,f,g,dp),所以若要四位数码管显示不同的字符,则一位显示时(占用了段线)其它三位应该不能显示。(通过控制位线实现)LED数码管的动态显示n实现原理:n由于人眼的视觉暂留效应,当循环时间很短时,人眼看到的效果如下图所示:n动态刷新时间:q电视的场频:50Hz,即每20ms更新一幅画面q刷新频率太慢则会有闪烁现象q刷新频率太快则则亮度不够q一般在几ms左右作业:LED数码管动态显示n四位数码管显示不同的字符,比如“1234”修改分频器architecture clkdiv_stru of clk
8、div is signal count: integer range 0 to 25000000:=0;begin process( reset , clkin) begin if reset=0 then count=0; q=0; elsif clkinevent and clkin=1 then if count=25000000 then count=0; clkout= not clkout; else count=count+1; end if; end if; end process; end clkdiv_stru;结构体architecture clkdiv_stru of
9、clkdiv is signal count: integer range 0 to 50000:=0;begin process( reset , clkin) begin if reset=0 then count=0; q=0; elsif clkinevent and clkin=1 then if count=49999 then count=0; clkout= not clkout; else count=count+1; end if; end if; end process; end clkdiv_stru;修改计数器architecture counter_stru of
10、counter is signal count: std_logic_vector(3 downto 0);begin process( reset , clock) begin if reset=0 then count=“0000”; elsif clockevent and clock=1 then if count=“1111” then count=“0000”; else count=count+ “0001” ; end if; end if; end process; countout=count;end counter_stru;architecture counter_st
11、ru of counter is signal count: std_logic_vector(3 downto 0);begin process( reset , clock) begin if reset=0 then count=“0000”; elsif clockevent and clock=1 then if count=“0011” then count=“0000”; else count=count+ “0001” ; end if; end if; end process; countout Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y = “00111111”; ledbits Y = “00000110”; ledbits Y = “
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025至2030中国男士衬衣行业发展分析及竞争格局与发展趋势预测报告
- 2025至2030中国生姜产品行业市场占有率及投资前景评估规划报告
- 2025至2030中国甑炭行业需求动态及发展前景研究报告
- 点菜技巧培训
- 新人法律培训
- 商业成功背后的学生动机分析
- 校园智慧体育设施的建设现状及挑战
- 情绪智力在教育心理学中的核心地位
- 医疗行业中的科技应用与师资培训模式研究
- 商业环境下的教育创新与青少年运动培训的融合研究
- 智慧农业项目建设方案
- 人工智能模拟题
- 2024年下半年江苏南通启东市部分事业单位选调工作人员14人易考易错模拟试题(共500题)试卷后附参考答案
- 教师资格考试小学美术面试试题及答案指导(2025年)
- 住家保姆合同协议书模板
- AI如何赋能艺术教育-笔记
- DB11T 485-2020 集中空调通风系统卫生管理规范
- 《人力资源管理》全套教学课件
- Unit 6 Craftsmanship Reading 教案-2023-2024学年中职英语高教版(2023修订版)基础模块2
- 2023-2024学年山东省菏泽市东明县八年级(下)期末数学试卷(含答案)
- 初高中物理衔接讲座(初高中物理对比)
评论
0/150
提交评论