苗壮-数电实验-vhdl双色点阵设计_第1页
苗壮-数电实验-vhdl双色点阵设计_第2页
苗壮-数电实验-vhdl双色点阵设计_第3页
苗壮-数电实验-vhdl双色点阵设计_第4页
苗壮-数电实验-vhdl双色点阵设计_第5页
已阅读5页,还剩24页未读 继续免费阅读

下载本文档

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

文档简介

1、数字电路综合实验报告题目:双色点阵设计实验班级:2011211208姓名:苗壮 学号:2011210889实验要求1固定红色显示一个汉子或图形,显示亮度 4级可调,用一个 btn按钮实现亮度调节,亮度变化视觉效果要尽量明显。2用从红到绿8级渐变色显示一个固定汉字或图形。3.分别用单字循环显示,左右滚动显示,上下滚动显示三种显 示方式单色显示四个汉字或图形,显示过程中,显示方式用一个 btn按钮进行切换。4显示的图形或汉字要饱满美观。提高要求:1滚动显示过程中实现四种显示颜色的自动变换,颜色变 化效果要尽量明显。2自拟其它功能。系统设计1设计思路a. 因为双色点阵要求几种状态同时发生,因此设置一

2、个 传输文字信息的形参sh1sh8,和颜色控制的参量 g1g8,r1r8使文字能同时的发生所需状态,b. 同时因亮度需要调节占空比,8种颜色也需要调节占 空比。因此亮度调节和8种颜色模块单独整合入显示模块 中,用于最后刷新输入row变量和red, green变量。C.文字滚动模块因为实验板的逻辑单元限制,每个动画 改为10帧左右,包括跳动,左右滚动,上下滚动,和静态 四种模块,需要设置一个cou nt计数器,来实现帧的跳转。d.最后,把按键防抖程序集合进程序内容里,进行仿真, 下载测试。2总体框图输入butt on按键防抖btn1btn4按键模块(控制器)Clk_1(100hz)c_mode,

3、b_mode,m_mode输入clk显示模块 case 1 choose color分频模块clkout(5000hz)case 2:choose moveCase 3:choose bright3.模块设计A) .Process elk:产生所需的时钟模块。输出 Clk_1,clkout;B) .Process bu14防止按键抖动模块。输出 bu1bu4;C) .Process c_mode,b_mode,m_mode对应改变颜色,改变亮度 和改变滚动方式的模块,输出 g1g8,r1r8,sh1sh8D) .Process show刷新双色点阵模块,根据不同的 mode输出不同的点阵信息以

4、做到同时三模块完全独立,可以同时发生改变。OILS - on2alkregr esn.7.G.2.1.0A iA I当button_1第一次上升 沿输出红色的信号占空 比变大,此时为 50%的 亮度,三仿真波 形及波形 分析.7rTtTTT_ -LTTT i r训Ee 1丨| EiTF i iJT7Lr rrr rr-it rLTVLtlsr orn_TL_r mrO_TT_T n r r廉.oi1ii1当button_1改变为50%亮度时,再改变button_3,改变颜色 为绿色,再次点击 button_1时,亮度变为memam lqj jawtr1Ju1 I1L:LTLJU

5、L1_11T厂LLnnm_uliLnilr总体仿真图此时为橙色显示,75%,占空比再次变高。此时第三次点击 button_1,同时点击button_2改变移动方 式为滚动显示,因为仿真时间有限看不到第二帧的“壮”这 个字的信号输入,同时因为第三次点击button 1,改变为8种颜色显示方式,此时如图中red和green信号的占空比完全互补,说明此时为 8 色显示状态。H 1-1I R40.540.00.0L_TL_r-LJLTn TLJJ L_TL_O|LTULfOtToiwjnio跳动显示,亮度为四源程序:-author miao zhua ng-url www.mizy.i nfo-tim

6、e 2013.10.21-version 1.0.3LIBRARY IEEE;USE IEEE. STD_LOGIC_1164.ALL;USE IEEE.STD_LOGIC_UNSIGNED.ALL;nnLrL_rLL_n_n n nnnnnn25%.0j_ni_rn_ni_nn_rlnimn nrL_TL_TL_nosKE)ri_.nrnnrnn n rv_nrL_HLrnHLTLrnENTITY miao ISPORT(button_1, button_2,button_3 : IN STD_LOGIC;-4 butt onelk:INSTD_LOGIC;-f portrow:OUTSTD

7、_LOGIC_VECTOR(7dow nto 0) ;-LEDportred:OUTSTD_LOGIC_VECTOR(7dow nto 0) ;-LEDportgree n:OUTSTD_LOGIC_VECTOR(7dow nto 0) );-LEDportEND miao;ARCHITECTURE mai n OF miao ISSIGNAL elk_1,elkout : STD_LOGIC;-eut f to 3SIGNAL temp:INTEGER RANGE 0 TO 10 :=0;SIGNAL tempi:INTEGER RANGE 0 TO 100000:=0;SIGNAL tem

8、p2:INTEGER RANGE 0 TO 500000:=0;SIGNAL eou nt:INTEGER RANGE 0 TO 1200 :=0;SIGNAL fresh :INTEGER RANGE 1 TO 8:=1;-freshcoun terSIGNAL b_mode,m_mode : STD_LOGIC_VECTOR (1 DOWNTO 0) :=00;SIGNAL e_mode: STD_LOGIC_VECTOR (1 DOWNTO 0) :=00;SIGNAL bu_1,bu_2,bu_3 : STD_LOGIC;SIGNAL resetmp1,resetmp2 : STD_L

9、OGIC;-butt on-tempSIGNAL resetmp3,resetmp4 : STD_LOGIC;SIGNAL resetmp5,resetmp6 : STD_LOGIC;SIGNAL M,r2,r3,r4,r5,r6,r7,r8,g1,g2,g3,g4,g5,g6,g7,g8: STD_LOGIC_VECTOR (7DOWNTO 0);SIGNALz1,z2,z3,z4,z5,z6,z7,z8, n0,m1,m2,m3,m4,m5,m6,m7,m8STD_LOGIC_VECTOR (7 DOWNTO 0);SIGNAL sh1,sh2,sh3,sh4,sh5,sh6,sh7,sh

10、8 : STD_LOGIC_VECTOR (7 DOWNTO0);-show ehar on the seree nBEGIN-n0 = n ulln 0=00000000;-miao ziZ1=00101000;Z2=11111110;Z3=00101000;Z4=01111100;Z5=01010100;Z6=01111100;Z7=01010100;Z8=01111100;-zhua ng zim1=00100100;m2=10100100;m3=01111111;m4=00100100;m5=01100100;m6=10100100;m7=00101110;m8=00100000;-分

11、频器p:PROCESS (elk)BEGINIF clkeve nt AND clk=1 THENIF temp1=10000 THEN-5000temp1=0;ELSEtemp1=temp1+1;END IF;-5000HZ maikuan-100hz defe nd 20msIF temp15000 THEN clkout =1;ELSEclkout =0;END IF;IF temp2=500000 THEN temp2=0;ELSEtemp2=temp2+1;END IF;IF temp2250000 THEN-100hzclk_1=1;ELSEclk_1=0;END IF;END I

12、F;END PROCESS p;for press more the n 20ms-butt on_1 bright outb1:process (butt on _1,clk_1)BEGINIF clk_1eve nt and clk_1=1 the n resetmp2= resetmp1;resetmp1= butt on_1;END IF;END PROCESS b1;bu_1= resetmpl AND (NOT resetmp2);-butt on_2 color out b2:process (button_2,clk_1)BEGINIF clk_1eve nt AND clk_

13、1=1 the n resetmp4= resetmp3;resetmp3= butt on_2;END IF;END PROCESS b2;bu_2=resetmp3 AND (NOT resetmp4) AND button_2; -butt on_3 move outb3:process (button_3,clk_1)BEGINIF clk_1eve nt AND clk_1=1 the n resetmp6= resetmp5; resetmp5= butt on_3;END IF;END PROCESS b3;bu_3 b_mode b_mode b_mode b_mode m_m

14、ode m_mode m_mode m_mode c_mode c_mode c_mode=00;-ora ngeend case;END IF;END process col;show LEDshow:process (clkout)BEGINIF (clkouteve nt and clkout=1)then -bright modeif temp=10 the nif fresh=8 the n fresh=1;elsefresh=fresh+1; end if;END if;IF temp=10 thentempsh1=z1;sh2=z2;sh3=z3;sh4=z4;sh5=z5;sh

15、6=z6;sh7=z7;sh8-逐字显示if cou nt2500 thensh1=z1;sh2=z2;sh3=z3;sh4=z4;sh5=z5;sh6=z6;sh7=z7;sh8=z8;ELSesh1=m1;sh2=m2;sh3=m3;sh4=m4;sh5=m5;sh6=m6;sh7=m7;sh8=5000 thencoun t=0;ELSEcoun t- to left-横向动画if cou nt200 thensh1=z1;sh2=z2;sh3=z3;sh4=z4;sh5=z5;sh6=z6;sh7=z7;sh8=z8;ELSif cou nt4OO THENsh1=01010000;s

16、h2=11111101;sh3=01010000;sh4=11111000;sh5=10101000;sh6=11111001;sh7=10101000;sh8=11111000;ELSIF cou nt600 THENsh1=10100000;sh2=11111010;sh3=10100001;sh4=11110000;sh5=01010001;sh6=11110010;sh7=01010000;sh8=11110000;Elsif cou nt800 THENsh1=O1OOOOO1;sh2=11110101;sh3=01000011;sh4=111OOOO1;sh5=10100011;s

17、h6=11100101;sh7=10100001;sh8=11100001;ELSIF coun t1000 THENsh1=1OOOOO1O;sh2=11101010;sh3=10000111;sh4=11OOOO1O;sh5=01000110;sh6=11001010;sh7=01000010;sh8=11000010;ELSIF coun t1200 THENsh1=OOOOO1OO;sh2=11010100;sh3=00001111;sh4=1OOOO1OO;sh5=10001100;sh6=10010100;sh7=10000101;sh8=10000100;ELSIF coun t

18、1400 THENsh1=OOOO1OO1;sh2=10101001;sh3=00011111;sh4=OOOO1OO1;sh5=00011001;sh6=00101001;sh7=00001011;sh8=00001000;ELSIF coun t1600 THENsh1=OOO1OO1O;sh2=01010010;sh3=00111111;sh4=00010010;sh5=00110010;sh6=01010010;sh7=00010111;sh8=00010000;ELSesh1=00100100;sh2=10100100;sh3=01111111;sh4=00100100;sh5=01

19、100100;sh6=10100100;sh7=00101110;sh8=1800 thencoun t=0;ELSEcoun t-纵向的动画if cou nt200 thensh1=z1;sh2=z2;sh3=z3;sh4=z4;sh5=z5;sh6=z6;sh7=z7;sh8=z8;ELSif cou nt4OO THENsh1=z2;sh2=z3;sh3=z4;sh4=z5;sh5=z6;sh6=z7;sh7=z8;sh8=nO;ELSIF coun t600 THENsh1=z3;sh2=z4;sh3=z5;sh4=z6;sh5=z7;sh6=z8;sh7=nO; sh8=m1;Els

20、if cou nt800 THENsh1=z4;sh2=z5;sh3=z6;sh4=z7;sh5=z8;sh6=nO;sh7=m1;sh8=m2;ELSIF coun t1000 THENsh1=z5;sh2=z6;sh3=z7;sh4=z8;sh5=n0;sh6=m1;sh7=m2;sh8=m3;ELSIF coun t1200 THENsh1=z6;sh2=z7;sh3=z8;sh4 =n0;sh5=m1;sh6=m2;sh7=m3;sh8=m4;ELSIF coun t1400 THENsh1=z7;sh2=z8;sh3=n0;sh4=m1;sh5=m2;sh6=m3;sh7=m4;sh

21、8=m5;ELSIF coun t1600 THENsh1=z8;sh2=nO;sh3=m1;sh4=m2;sh5=m3;sh6=m4;sh7=m5;sh8=m6;ELSIF coun t1800 THENsh1=n0;sh2=m1;sh3=m2;sh4=m3;sh5=m4;sh6=m5;sh7=m6;sh8=m7;ELSEsh1=m1;sh2=m2;sh3=m3;sh4=m4;sh5=m5;sh6=m6;sh7=m7;sh8=2000 THEN-10 帧coun t=0;elsecoun t r1=sh1;r2=sh2;r3=sh3;r4=sh4;r5=sh5;r6=sh6;r7=sh7;r

22、8=sh8;g1=n0;g2=n0;g3=nO;g4=nO;g5=nO;g6=nO;g7=nO;g8 r1=nO;r2=nO;r3=nO; r4=nO;r5=nO;r6=nO;r7=nO;r8=nO;g1=sh1;g2=sh2;g3=sh3;g4=sh4;g5=sh5;g6=sh6;g7=sh7;g8r1=sh1; r2=sh2; r3=sh3; r4=sh4; r5=sh5; r6=sh6; r7=sh7; r8=sh8;g1=sh1;g2=sh2;g3=sh3;g4=sh4;g5=sh5;g6=sh6;g7=sh7;g8=sh8;END CASE;ELSEtemp-25% b temp=2

23、-当temp大于n以后,设置red和green的输出为0case fresh iswhen 1 =for i in 0 to 7 loopif sh1(i)=1 and temp=2 the n red(i)=r1(i);gree n(i)=g1(i);ELSEred(i)=0;gree n( i)=0: END if;END loop;rowfor i in 0 to 7 loopif sh2(i)=1 and temp=2 then red(i)=r2(i);gree n( i)=g2(i);ELSEred(i)=0;gree n( i)=0: END if;END loop;rowfor

24、 i in 0 to 7 loopif sh3(i)=1 and temp=2 then red(i)=r3(i);gree n(i)=g3(i);ELSEred(i)=0;gree n( i)=0; END if;END loop;rowfor i in 0 to 7 loopif sh4(i)=1 and temp=2 the n red(i)=r4(i);gree n(i)=g4(i);ELSEred(i)=0;gree n( i)=0; END if;END loop;rowfor i in 0 to 7 loopif sh5(i)=1 and temp=2 then red(i)=r

25、5(i);gree n( i)=g5(i);ELSEred(i)=O;gree n( i)=0: END if;END loop; rowfor i in 0 to 7 loopif sh6(i)=1 and temp=2 then red(i)=r6(i);gree n(i)=g6(i);ELSEred(i)=0;gree n( i)=0: END if;END loop; rowfor i in 0 to 7 loopif sh7(i)=1 and temp=2 then red(i)=r7(i);gree n(i)=g7(i);ELSEred(i)=0;gree n( i)=0; END

26、 if;END loop; rowfor i in 0 to 7 loopif sh8(i)=1 and temp=2 then red(i)=r8(i);gree n(i)=g8(i);ELSEred(i)=0;gree n( i)=0; END if;END loop; row-50% b temp=5case fresh iswhen 1 =for i in 0 to 7 loopif sh1(i)=1 and temp=5 the n red(i)=r1(i);gree n(i)=g1(i);ELSEred(i)=0;gree n( i)=0; END if;END loop;rowf

27、or i in 0 to 7 loopif sh2(i)=1 and temp=5 then red(i)=r2(i);gree n( i)=g2(i);ELSEred(i)=0;gree n( i)=0: END if;END loop;rowfor i in 0 to 7 loopif sh3(i)=1 and temp=5 the n red(i)=r3(i);gree n(i)=g3(i);ELSEred(i)=0;gree n( i)=0: END if;END loop;rowfor i in 0 to 7 loopif sh4(i)=1 and temp=5 the n red(

28、i)=r4(i);gree n(i)=g4(i);ELSEred(i)=0;gree n( i)=0; END if;END loop;rowfor i in 0 to 7 loopif sh5(i)=1 and temp=5 the n red(i)=r5(i);gree n( i)=g5(i);ELSEred(i)=0;gree n( i)=0; END if;END loop;rowfor i in 0 to 7 loopif sh6(i)=1 and temp=5 then red(i)=r6(i);gree n(i)=g6(i);ELSEred(i)=0;gree n( i)=0;E

29、ND if;END loop;rowfor i in 0 to 7 loopif sh7(i)=1 and temp=5 the n red(i)=r7(i);gree n( i)=g7(i);ELSEred(i)=0;gree n( i)=0:END if;END loop;rowfor i in 0 to 7 loopif sh8(i)=1 and temp=5 the n red(i)=r8(i);gree n(i)=g8(i);ELSE red(i)=0;gree n( i)=0:END if;END loop; row-75% bright temp=7case fresh iswh

30、en 1 =for i in 0 to 7 loopif sh1(i)=1 and temp=7 the n red(i)=r1(i);gree n(i)=g1(i);ELSEred(i)=0;gree n( i)=0;END if;END loop;rowfor i in 0 to 7 loopif sh2(i)=1 and temp=7 then red(i)=r2(i);gree n( i)=g2(i);ELSEred(i)=0;gree n( i)=0;END if;END loop;rowfor i in 0 to 7 loopif sh3(i)=1 and temp=7 then

31、red(i)=r3(i);gree n(i)=g3(i);ELSEred(i)=O;gree n( i)=0: END if;END loop;rowfor i in 0 to 7 loopif sh4(i)=1 and temp=7 the nred(i)=r4(i);gree n(i)=g4(i);ELSEred(i)=0;gree n( i)=0: END if;END loop;rowfor i in 0 to 7 loopif sh5(i)=1 and temp=7 the nred(i)=r5(i);gree n( i)=g5(i);ELSEred(i)=0;gree n( i)=

32、0; END if;END loop;rowfor i in 0 to 7 loopif sh6(i)=1 and temp=7 thenred(i)=r6(i);gree n(i)=g6(i); ELSEred(i)=0;gree n( i)=0; END if;END loop;rowfor i in 0 to 7 loopif sh7(i)=1 and temp=7 the nred(i)=r7(i);gree n( i)=g7(i);ELSEred(i)=0;gree n( i)=0; END if;END loop;rowfor i in 0 to 7 loopif sh8(i)=1

33、 and temp=7 the nred(i)=r8(i);gree n(i)=g8(i);ELSEred(i)=0;gree n( i)=0:END if;END loop;row-设置temp变量,10次后刷新row变量,n次后改变red和green变量,case fresh iswhen 1 =for i in 0 to 7 loopif sh1(i)=1 and temp=10 the nred(i)=1;gree n( i)=0:ELSEred(i)=0;gree n( i)=0:END if;END loop;rowfor i in 0 to 7 loopif sh2(i)=1 t

34、henif temp=8 the nred(i)=1;gree n( i)=0;ELSEred(i)=0;gree n( i)=1;END if;END if;END loop;rowfor i in 0 to 7 loopif sh3(i)=1 thenif temp=7 the nred(i)=1;gree n( i)=0;ELSEred(i)=0;gree n( i)=1;END if;END if;END loop;rowfor i in 0 to 7 loopif sh4(i)=1 thenif temp=5 the n red(i)=1;gree n( i)=0: ELSEred(i)=0;gree n( i)=1: END if;END if;END loop; rowfor i in 0 to 7 loopif sh5(i)=1 thenif temp=4 the n red(i)=1;gree n( i)=0: ELSEred(i)=0;gree n( i)=1: END if;END if;END loop; rowfor i in 0 to 7 loopif sh6(i)=1 thenif temp=2 the n red(i)=1;gree n( i)=0; ELSEred(i)=0;gree n( i)=

温馨提示

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

评论

0/150

提交评论