版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2024-2025学年广东省深圳市罗湖区教科版四年级上册期中考试科学试卷(含答案)
- 法律文书写作试题及答案
- 二建考试题真题及答案
- 小学五年级语文上册第六单元单元亲情素材收集课件
- 2026年湖北省妇幼保健院招聘79人备考题库含答案详解
- 深度解析(2026)《GBT 33974-2017热轧花纹钢板及钢带》(2026年)深度解析
- 中国金融电子化集团有限公司2026年度校园招聘备考题库及参考答案详解
- 2025年营口市中心医院公开招聘劳务派遣人员备考题库及一套答案详解
- 2026年贵州金控集团面向社会公开招聘急需紧缺人才备考题库附答案详解
- 2026年合肥产投康养集团有限公司及子公司社会招聘17人备考题库及答案详解(易错题)
- (新教材)2025年部编人教版三年级上册语文第七单元复习课件
- 后勤保障医院运维成本智能调控
- 循证护理在儿科护理中的实践与应用
- 少儿无人机课程培训
- 麻醉睡眠门诊科普
- 小学语文板书基本功培训
- 2025甘肃酒泉市公安局招聘留置看护岗位警务辅助人员30人(第三批)考试笔试参考题库附答案解析
- 测绘安全生产作业规范
- 安全生产先进评选方案
- 三一旋挖打斜桩施工方案
- 别墅物业费代缴合同协议2025年规定
评论
0/150
提交评论