《EDA技术(机械)实验报告--三层电梯控制器.docx》由会员分享,可在线阅读,更多相关《EDA技术(机械)实验报告--三层电梯控制器.docx(7页珍藏版)》请在第一文库网上搜索。
1、实验报告(计算机类)开课学院及实验室:实验时间:年月日学生姓名学号成绩学生所在学院年级/专业/班课程名称EDA技术(机械)课程代码实验项目名称三层电梯控制器项目代码指导教师项目学分一、实验目的1 .了解VHD1语言编程方法,学会熟练运用quartus软件2 .了解三层电梯运作原理3 .了解如何使用VHD1设计一个三层电梯控制器二、内容与设计思想1 .电梯控制器是控制电梯按顾客的要求自动上下的装置2 .设计一个三层电梯控制器:(1)每层电梯入口设有上下请求开关,电梯内设有乘客到达层次的停站请求开关。(2)设有电梯所处位置及运作模式(上、下)指示装置。(3)电梯每秒升(降)一层楼。(4)电梯到达有
2、停站请求的楼层后,经1秒电梯门打开,开门指示灯亮,开门4秒后,电梯门关闭(开门指示灯灭),电梯继续运行,直到执行完最后一个指令后停在当前层。(5)能记忆电梯内外的所有请求信号,并按照电梯运行规则秩序响应,每个指令保留至执行后消除。(6)电梯运行规则是:当电梯处于上升模式时,至响应比电梯所在位置高的上楼请求信号,由下而上逐个执行,直到最后一个上楼请求执行完毕,如更高层有下楼请求,则直接升到有下楼请求的最高层接客,然后进入下降模式。当电梯处于下降模式时,与上升相反。(7)电梯初始状态为一层开门。三、使用环境winXP或Win7Quartusii编程环境四、核心代码及调试过程三层电梯控制器一Very
3、hardd模块Iibraryieee;useieee.std_Iogic_1164.aII;entityveryharddisport(up1,up2,cIk,down2,down3,k1,k2,k3:instd_1ogic;site:outstd_Iogic_vector(3downto1);a1,a2,a3:outstd_1ogic;mode,door:outstd_1ogic);endveryhardd;architectureVeryharC1arCofveryharddistypestate_typeis(d,c2,c3,kai);beginprocess(cIk)variabIeu
4、pI,downI,tingI,cengI:std_Iogic_vector(3downto1);variabIemo,x,y,z:std_1ogic;variabIecnt1,cnt2:integer;variabIestate:state_type;beginifcIk,eventandCIk=1thenifUP1=0thenup1(1)-,;endif;ifup2=0thenup1(2):=r;endif;ifdown3=0,thendownI(3):=r;endif;ifdown2=0,thendownI(2):=;endif;ifk1=,0,thenting(1):=r;endif;i
5、fk2=,0,thenting(2):=1;endif;ifk3=,0,thenting(3):=r;endif;ifcnt1ceng1:=0011;mo:=0;ifupIA000orceng1=,000,orting1=,000thenz:=r;endif;ifz=0thendoor=1eIsedoorceng1:=010;ifmo=,0,thenifting1(2)=,orup1(2)=,thenstate:=kai;ting1(2):=0;up1(2):=0;eIsifdownI(3)=,orting1(3)=,orx=thenstate:=c3;x=0;eIsifdownI(2)=,o
6、rup1(1)=,orting1(1),1,thenmo:=r;endif;eIseiftingI(2)=,1,ordownI(2)=,1,thenstate:=kai;ting1(2):=0;downI(2):=0;eIsifup1(1)=,orting1(1),ory=thenstate:=c1;y:=0;eIsifupI(2)=,ordownI(3)=,orting1(3)=,thenmo:=,O;endif;endif;whenc3=ceng1:=100;mo:=1;ifting1(3)=ordownI(3)=thenstate:=kai;ting1(3):=0;downI(3):=0
7、;eIsifdownI(2)=orting1(2)=,thenstate:=c2;eIsifup1(D-1,orting1(1)=1,thenstate:=c2;y-,1,;eIsifup1(2)=,thenstate:=c2;mo,0,;endif;whenkai=door;ifcnt23thenCnt2:=Cnt2+1;eIsedoor=,0,;Cnt2:=0;ifceng1=1,001,thenstate:=c1;eIsifceng1=,010thenstate:=c2;eIsestate:=c3;endif;endendcase;cnt1:=0;endif;endif;site=cen
8、gI;a1=ting1(1);a2=tingI(2);a3qqqnuII;endcase;endif;endprocess;endseg_arc;1r=DIAN模块Iibraryieee;useieee.std_Iogic_1164.aII;useieee.std_Iogic_unsigned.a11;entitydianisport(cIk,mode:instd_1ogic;seI:outstd_Iogic_vector(3downtoO);q:outstd_Iogic_vector(Oto15);3C1kq6.0J-I31sttenddian;architecturedian_arcofd
9、ianisbeginprocess(cIk)variabIeseeI:std_Iogic_vector(3downtoO);beginifcIk,eventandC1k=1thenseeI:=see1+1;ifmode=O,thencaseseeIiswhen-0011,=qqq0011000000000000;when0110,=q0110000000000000;when-011,=qqqq,0011000000000000;when1011=qqqqq10000000000011000;when,0101,=q,0000000000001100;when,0110,=qqqq0000000000000110;when,1010,=qqq0000000000110000;whenothers=q0000000000000000,;endcase;e1kxse13.Dq015seI=seeI;endprocess;enddian_arc;总体框图:五、总结