版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
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-2026年心理素质提升与心理测评测试卷
- 2026年上海市人教版初中语文第12单元文言文阅读理解练习题
- 2025-2026年广东省人教版三年级语文下册第2单元课后练习题
- 山东航空乘客舱旅客引导服务模拟试卷及答案
- 《类脑计算 动态视觉传感器测试方法》GBZ 262-2026
- 山东航空乘客舱旅客情绪疏导模拟试卷及答案
- T/CHSA 022-2020牙体牙髓病诊疗中口腔放射学的应用指南
- 2026年古树名木保护考核考试试卷试题及答案
- 2026年河南省南阳市国家职业技能鉴定考评员业务知识考试复习试卷(含答案)
- 2026年机电一体化技术-考试题库(含答案)
- ISO 6682020 系列1货物集装箱 - 分类 尺寸和等级标准立项发展报告
- 心内科护理查房:先天性心脏病的护理要点
- 电除颤问答题
- 市政路面白改黑改造工程监理细则
- 第15课 规划与设计教学设计-2025-2026学年小学信息技术(信息科技)五年级第5册滇人版
- DBJ50T-542-2026 建筑机器人应用技术标准
- 1.2 1.2.1 命题与量词 课件-2026版高中数学人教B版必修第一册
- 2025版煤矿安全规程题库645道
- 农行笔试真题全套及答案
- 部编版初一语文七年级上册《咏雪》听评课记录(区公开课)
- 塑胶件培训课件
评论
0/150
提交评论