EDA实训指导书(2)

1970-01-01 08:00

电子设计自动化技术实训 CSH

If num6(3downto 0)=”0101”then Num6(3downto0)<=”0000”;

End if ;end if; end if; end if; end if;end if;end if; End if;end if; End process;

Process(cp3)——显示控制。 Begin

If(cp3’event and cp3=’1’)then If(numlet(2downto0)=”000”)then

Num<=numl;selsig(6downto1)<=”111110”;end if; If(numlet(2downto0)=”001”)then

Num<=num2;selsig(6downto1)<=”111101”;end if; If(numlet(2downto0)=”010”then

Num<=num3;selsig(6downto1)<=”111011”;end if; If(numlet(2downto 0)=”100”;then

Num<=num4;selsig(6downto1)<=”110111”;end if; If(numlet(2downto0)=”100” then

Num<=num5;selsig(6downto1)<=”101111”;end if; Numlet(2downto 0)<=numlet(2downto 0)+1; If(numlet(2downto0)=”101”then

Numlet(2downto 0)<=”000”;num<=num6; Selsig(6downto1)<=”011111”;end if; End if;

If(num(3downto0)=”0000”)then Segsig(7downto 0)<=”01111111”;end if; End if;

If(num(3downto0)=”0001”)then Segsig(7downto0)<=”00001101”;end if; If(num(3downto0)=”0010”)then Segsig(7downto 0)<=”10011111”;end if; If(num(3downto0)=”0100”)then Segsig(7downto0)<=”10011111”;end if; If(num(3downto0)=”0100”)then Segsig(7downto0)<=”11001101”;end if; If(num(3downto)=”0101”)then

Segsig(7downto0)<=”11011011”;end if; If(num(3downto0)=”0110”)then Segsig(7downto0)<=”11111011”;end if; If(num(3downto0)=”0111”;)then Segsig(7downto0)<=”00001111”;end if;

6

电子设计自动化技术实训 CSH

If(num(3downto0)=”1000”)then Segsig(7downto0)<=”11111111”;end if; If(num(3downto0)=”1001”)then Segsig(7downto0)<=”11011111”;end if; End process; Sel<=selsig;

Seg(7downto0)<=segsig(7downto0); End behave;

7

五、 程序说明

1、 此程序包括分频、计数控制、显示控制部分。

2、 开机显示00.00.00,用户可随时计时、暂停、清零,最大计时可到59分59.99

秒。

3、 计数时钟为100HZ。

4、 采用时分复用的方法控制4个数码管的显示,可节约资源。

课题2 8×8光点阵逐点扫描显示装置

一、 设计任务要求

1. 使用8×8矩阵显示屏设计一个扫描控制电路。 2. 光点从屏左上角像素点开始逐点扫描,终止与右下角像素点,然后周而复始的运行下

去。

3. 扫描一桢所需时间为13S。

二、可选器件

EPM130208-2、8X8矩阵显示屏、电阻。 三、 设计总体框图

8X8发光点阵逐点扫描显示装置总体框图如图2所示。

时钟分频列控制

输 入 电 路 电 路

行控制

电 路

8X8矩阵显示图2 8X8发光点阵逐点扫描显示装置总体框图

电子设计自动化技术实训 CSH 8

四、 参考源程序 library ieee;

use ieee.std_logic_1164.all; use ieee.std_logicsigned.all; entity zlx2 is port(

clk:in std_logic;

q:out std_logic_vector(21 downto0);——路输出。 T:out std_logic_vector(0to7); ——列选通。 Y:out std_logic_vector(0to7); ——行选通。 Ebd zkx2l

Architecture a of zlx2 is

Signal b:std_logic_vector(21downto 0):=”0000000000000000000000”; Signal a:std_logic_vector(0to 2); Signal e:std_logic_vector(0to2); Signal c:std_logic_vector(0to7); Signal d:std_logic_vector(0to7); Begin

Process (clk) ——分频电路。 Begin

If(clk’event and clk =’1’)then B(21downto 0)<=b(21downto)+1; End if;

Q<=b; ——输出扫描频率。 End process;

Process ——以下两个进程控制行、列选通线实现点扫描。 Begin A(0)<=b(16); A(1)<=b(17); A(2)<=b(18);

If a=”000”then c<=”10000000”; Elsif a=”001”then c<=”01000000”; Elsif a=”010”then c<=”00100000”; Elsif a=”011”then c<=”00010000”; Elsif a=”100”then c<=”00001000”; Elseif a=”101”then c<=”00000100”; Elseif a=”110”then c<=”00000010”; Elseif a=”111”then c<=00000001”; End if; Y<=c;

电子设计自动化技术实训 CSH

End process; Process Begin E(0)<=b(19); E(1)<=b(20); E(2)<=b(21);

If e=”000”then d<=”01111111”; Elsif e=”001”then d<=”10111111”; Elsif e=”010”then d<=”11011111”; Elsif e=”011”then d<=”11101111”; Elsif e=”100”then d<=”11110111”; Elsif e=”101”then d<=”11111011”; Elsif e=”110”then d<=”11111101”; Elsif e=”111”then d<=”11111110”; End if; T<=d; End process; End a;

9

五、 说明

1. 程序主要由分频电路和扫描控制电路组成。

2. 扫描控制电路可用3线-8线译码器的设计思路来实现。

课题3 彩灯闪烁装置

一、 设计任务及要求

1. 2. 3. 4.

使用8X8矩阵显示屏设计一个彩灯闪烁装置。

第一侦以1个光点为1个像素点从屏左上角开始逐点扫描,终止于右下角。 第二侦以2个光点为1个像素从左上角开始逐点扫描,终止于右下角。 第三侦重复第一侦,第四侦重复第二侦,周而复始的运行下去。

二、 可选器件

EPM130208-2、8X8矩阵显示屏、电阻。

电子设计自动化技术实训 CSH 10

三、 设计总体框图

彩灯闪烁装置总体框图如图3所示。

时钟输入 分频

电路

列控制电路 行控制电路 控制 奇 偶 侦 8X8矩 阵显示屏 图3 彩灯闪烁装置总体框图

四、 源程序

library ieee;

use ieee.std_logic_1164.all;

use ieee.std_logic_signed.all;---for+operation. Entity scan2 is

Port(cp1:in std_logic;——输入时钟20MHZ。

Ho:out std_logic_vector(7downto0);——行控制信号。 Vo:out std_logic_vector(7downto0);——列控制信号。 End scan2;

Architecture scanpixel of scan2 is

Signal count1:std_logic_vector(2downto0):=”000”;——扫描哪一个点的计数器。 Signal cuont2:std_logic_vector(3downto0):=”0000”;——扫描哪一个行的计数器。 Signal v:std_logic_vector(7downto0):=”10000000”;

Signal h:std_logic_vector(7downto0):=”10000000”;——输出信号. Signal cp2:std_logic; Signal cp:std_logic;

Signal cnt:std_logic_vector(15downto0):=”0000000000000000”

Signal cnt2:std_logic_vector(5downto0):=”000000”;——分频用的计数器。 Begin Process(cp1) Begin

If (cp1’eventand cp1=’1’)then Cnt<=cnt+1; End if; Cp2<=cnt(15); End process; Process(cp2) Begin

If(cp2’event and cp2=’1’)then Cnt2<=cnt2+1;


EDA实训指导书(2).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:新人教版小学四年级上册《梯形的认识》教学设计

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: