ImageVerifierCode 换一换
格式:DOCX , 页数:17 ,大小:270.39KB ,
资源ID:13132780      下载积分:5 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bingdoc.com/d-13132780.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(pld高级工技师参考学习笔记中级程序.docx)为本站会员(b****6)主动上传,冰点文库仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰点文库(发送邮件至service@bingdoc.com或直接QQ联系客服),我们立即给予删除!

pld高级工技师参考学习笔记中级程序.docx

1、pld高级工技师参考学习笔记中级程序max+plus 秒表电路设计程序:cnt10.vhd程序library ieee;-打开 ieee库use ieee.std_logic_1164.all;-调用std_logic_1164程序包use ieee.std_logic_unsigned.all; -调用程序包(无符号重载函数)entity cnt10 is-实体port ( -端口 clk,ena,rst:in std_logic; -时钟、起停、清零(标准逻辑位类型)q:out std_logic_vector (3 downto 0);-q3.0标准逻辑位向量类型 cout:out st

2、d_logic -进位标志位);end cnt10;architecture one of cnt10 is -结构体signal cqi:std_logic_vector (3 downto 0);-定义中间信号beginprocess(clk,ena,rst)-进程(敏感变量)beginif (rst=1) then -清零 cqi=”0000”; -输出为零 cout=0; -进位零elsif (clkevent and clk=1) then -当时钟上升沿来临时 if ena=1 then -启动 if cqi=”1001” then -判断计数是否为9,到9回0并进位。 cqi=”

3、0000”; cout=1; else -计数不为9,cqi的值加一,无进位。 cqi=cqi+1; cout=0;end if;end if;end if;q=cqi; -将中间信号的输出值赋值给q。end process; -结束进程end one; -结束结构体程序:Cnt6.vhd程序library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity cnt6 isport ( clk,ena,rst:in std_logic; q:out std_logic_vector (3 downto

4、0); cout:out std_logic);end cnt6;architecture one of cnt6 issignal cqi:std_logic_vector (3 downto 0);beginprocess(clk,ena,rst)beginif (rst=1) then cqi=”0000”; cout=0;elsif (clkevent and clk=1) then if ena=1 then if cqi=”0101” then-判断计数是否为5,到5回0并进位。 cqi=”0000”; cout=1; else cqi=cqi+1; cout=0;end if;e

5、nd if;end if;q=cqi;end process;end one;max+plus 频率计电路设计程序:cnt10.vhd程序library ieee;-打开 ieee库use ieee.std_logic_1164.all;-调用std_logic_1164程序包use ieee.std_logic_unsigned.all; -调用程序包(无符号重载函数)entity cnt10 is-实体port ( -端口 clk,ena,rst:in std_logic; -时钟、起停、清零(标准逻辑位类型)q:out std_logic_vector (3 downto 0);-q3.

6、0标准逻辑位向量类型 cout:out std_logic -进位标志位);end cnt10;architecture one of cnt10 is -结构体signal cqi:std_logic_vector (3 downto 0);-定义中间信号beginprocess(clk,ena,rst)-进程(敏感变量)beginif (rst=1) then -清零 cqi=”0000”; -输出为零 cout=0; -进位零elsif (clkevent and clk=1) then -当时钟上升沿来临时 if ena=1 then -启动 if cqi=”1001” then -判

7、断计数是否为9,到9回0并进位。 cqi=”0000”; cout=1; else -计数不为9,cqi的值加一,无进位。 cqi=cqi+1; cout=0;end if;end if;end if;q=cqi; -将中间信号的输出值赋值给q。end process; -结束进程end one; -结束结构体程序:tesctl.vhd程序library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity tesctl isport ( clkk:in std_logic; -1Hz cnt_en:ou

8、t std_logic; -计数器时钟起停 cnt_rst:out std_logic; -计数器清零 load: out std_logic输出锁存信号);end tesctl;architecture one of tesctl issignal div2clk:std_logic; -定义中间信号div2clkbeginprocess(clkk)beginif (clkkevent and clkk=1) then1Hz时钟2分频div2clk=not div2clk;end if;end process;process(clkk,div2clk)beginif (clkk=0 and

9、div2clk=0) then cnt_rst=1; -产生计数器清零信号else cnt_rst=0;end if;load=not div2clk; cnt_en=div2clk;end process;end one;程序:reg4b.vhd程序library ieee;use ieee.std_logic_1164.all;entity reg4b isport ( load:in std_logic; -锁存信号 din:in std_logic_vector(3 downto 0); -cout端输出的信号 dout: out std_logic_vector(3 downto 0

10、) 输出);end reg4b;architecture one of reg4b isbeginprocess(load)beginif (loadevent and load=1) thenload信号上升沿来临时dout=din; -din的值赋给dout作为输出end if;end process;end one;max+plus ADC0809电路设计程序:adc.vhd程序library ieee;-打开 ieee库use ieee.std_logic_1164.all;-调用std_logic_1164程序包entity adc is-实体port ( -端口 din:in st

11、d_logic_vector(7 downto 0); -0809的8位输出数据clk:in std_logic; -状态机时钟(标准逻辑位类型)q:out std_logic_vector (7 downto 0);-q7.08位输出数据 eoc: in std_logic转换结束标志信号 clock: out std_logicACD0809时钟 start: out std_logic启动ADC0809oe:out std_logic -输出允许控制信号);end adc;architecture one of adc is -结构体type st_type is(st0,st1,st2

12、,st3,st4); -定义状态的子类型signal lock:std_logic;-定义中间信号数据输出锁存时钟信号signal current_state,next_state:st_stype:=st0;-定义两状态beginclock=clk; -将状态机时钟赋给adc0809-process(clk)-进程(敏感变量)beginif (clkevent and clk=1) then -当时钟上升沿来临时 current_state=next_state;end if;end process;-process(lock)-进程(敏感变量)beginif (lockevent and

13、lock=1) then -当lock信号上升沿来临时 q -0809初始化start=0;oe=0;lock=0;next_state -启动采样start=1;oe=0;lock=0;next_state start=0;oe=0;lock=0;if eoc=1 then -eoc=1表明转换结束,调至下一个状态next_state=st3;else next_state -开启oe输出转换好的数据start=0;oe=1;lock=0;next_state -锁存信号start=0;oe=1;lock=1;next_state start=0;oe=0;lock=0;next_state

14、=st0;end case;end process;end one;max+plus 交通灯电路设计程序:counter.vhd程序library ieee;-打开 ieee库use ieee.std_logic_1164.all;-调用std_logic_1164程序包use ieee.std_logic_unsigned.all;-调用程序包(无符号重载函数)entity counter is-实体port ( -端口 hold,reset,clk:in std_logic; -紧急信号、恢复、时钟counternum:buffer integer range 0 to 49 -双向输入)

15、;end counter;architecture one of counter is -结构体beginprocess(hold,reset,clk)-进程(敏感变量)beginif (reset=1) then -清零 counternum=0;elsif (clkevent and clk=0) then if hold=1 then counternum= counternum; else if counternum=49 then counternum=0;else counternum=20) then -当输入值大于20时,高位为2,低位为输入值减20 numa=2;numb=1

16、0) then -当输入值大于10时,高位为1,低位为输入值减10 numa=1;numb=numin-10;else numa=0;numb=numin;end if;end process;end one;程序:controller.vhd程序library ieee;-打开 ieee库use ieee.std_logic_1164.all;-调用std_logic_1164程序包entity controller is-实体port ( -端口 clk,hold,:in std_logic; countnum:in integer range 0 to 49; reda,greena,y

17、ellowa:out std_logic; -redb,greenb,yellowb:out std_logic;flash: out std_logic);end controller;architecture one of controller is -结构体beginprocess(clk)-进程(敏感变量)beginif (clkevent and clk=0) then -当时钟下降沿来临时 if hold=1 thenreda=1;greena=0;yellowa=0;redb=1;greenb=0;yellowb=0;flash=1;else flash=0;-if countn

18、um=19 then numa=20-countum;reda=0;greena=1;yellowa=0;elsif countnum=24 then numa=25-countum;reda=0;greena=0;yellowa=1;else numa=50-countum;reda=1;greena=0;yellowa=0;end if;-if countnum=24 then numb=25-countum;redb=1;greenb=0;yellowb=0;elsif countnum=44 then numb=45-countum;redb=0;greenb=1;yellowb=0;

19、else numb=50-countum;redb=0;greenb=0;yellowb=1;end if;end if;end if;end process;end one;PLD学习总结可编程逻辑器件(programmable logic device),简称PLD。通过系统的学习:能够了解Altera公司Max+plus 10.0软件平台的常用菜单及命令的使用,能够较熟练的掌握EDA6000集成软件的调试。1、软件的了解: 利用Max+plus 10.0软件,进行对PLD程序的编写,主要通过两种方式:图形输入;VHDL语言输入。能够掌握两种语言编写的方式。利用EDA6000集成调试软件,

20、对编写好的PLD软件进行调试仿真。2、硬件的了解:利用伟福EDA2000实验系统对PLD程序进行硬件仿真,能较为熟练的掌握硬件试验箱的连线及程序下载。3、实验内容: 1.利用图形输入法对38译码器进行波形的仿真,检查其波形的正确后,验证其逻辑功能。熟练掌握图形输入法的文件创建、文件名、器件选择、器件之间的连线、选择设计使用的器件,加入信号接点,编译设计项目,进行波形仿真,将信号锁定到芯片的管脚等。 2.利用VHDL语言(超高速硬件描述语言)进行对与门或门电路进行波形仿真,能够熟练理解程序的结构及其在Max+plus 10.0软件下的调试编译仿真。 3.通过VHDL语言编写半加器程序,输出生成的

21、新元件,利用生成的新元件实现全加器的功能仿真。 4.利用伟福EDA2000实验箱,创建模式,并连接数据通信线路,管脚设置,实现硬件电路的仿真。4、考核内容: 1.秒表利用VHDL语言编写CNT10及CNT6,生成新器件,连接器件之间的关系实现秒表电路的仿真。 2.四位十进制频率计利用VHDL语言编写CNT10、TESCTL及REG4B,生成新器件,连接器件之间的关系实现四位十进制频率计电路的仿真。 3.ADC0809控制器利用VHDL语言编写ADC.vhd实现adc电路的仿真。 4.交通灯控制器利用VHDL语言编写COUNTER、CONTROLLER及FENWEI,生成新器件,连接器件之间的关

22、系实现交通灯控制器电路的仿真。通过以上的学习能够初步了解PLD编程的应用,为即将学习的单片机做好一个铺垫。陆志刚2012.09.29项目:CNT10程序:Cnt10.vhdlibrary ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity cnt10 isport( clk,ena,rst:in std_logic; q:out std_logic_vector(3 downto 0); cout:out std_logic);end cnt10;architecture one of cnt10 issignal cqi:std_logic_vector(3 downto 0);beginprocess(clk,ena,rst)begin if(rst=1)thencqi=0000;cout=0;elsif(clkevent and clk=1)thenif ena=1thenif cqi=1001thencqi=0000;cout=1;elsecqi=cqi+1;cout=0;end if;end if;end if;q=cqi;end process;end one;波形图仿真EDA6000集成软件模式:生成CNT10新元件

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2