欢迎来到天天文库
浏览记录
ID:9853409
大小:394.50 KB
页数:11页
时间:2018-05-12
《带时间显示的交通灯课程设计》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、综合成绩优秀()良好()优秀()良好()不及格()教师(签名)批改日期2011年月日PLC课程设计报告院系电子与电气工程学院专业电气工程及其自动化班级电气3081学号课题名称:带时间显示的交通灯课题分值:10分一、控制要求:信号灯守两个启动按钮控制,当SB1按下后,信号灯系统执行夜间工作模式,两车道黄灯以2秒为周期不停闪烁。当SB2按下后,信号等系统执行白天模式,具体要求如下。南北红灯维持25秒,在南北红灯亮的同时东西绿灯也亮,并维持20秒。到20秒时,东西绿灯也亮,闪亮3秒后熄灭。在东西绿灯熄灭时,东西黄灯亮,并维持2秒。到2秒后,东西黄灯熄灭,东西红灯亮,同时南北
2、红灯熄灭,绿灯亮。东西红灯维持30秒。南北绿灯维持25秒,然后闪亮3秒后熄灭,这时南北红灯亮,东西绿灯亮。周而复始。按下停止按钮SB3后,全部灯熄灭。白天工作方式必须完成两种时间显示模式:1)两个LED组合显示南北红灯倒计时时间(东西红灯时间不显示)。2)分别用一个LED显示东西、南北红灯倒计时时间(自行将工作周期压缩至个位数)。二、控制系统设计分析输入输出点统计序号元器件用途1I0.1SB12I1.1SB23I0.2总停开关5I0.3模式转换开关6Q4.0南北绿灯7Q4.1南北黄灯8Q4.2南北红灯9Q4.3东西绿灯10Q4.4东西黄灯11Q4.5东西红灯12Q5.
3、0数码管G14Q5.1数码管F15Q5.2数码管E16Q5.3数码管D17Q5.4数码管C18Q5.5数码管B19Q5.6数码管A20Q125.0东西夜间黄灯21Q125.1南北夜间黄灯三PLC系统硬件配置槽号12345模块选择PS3075ACPU314-2DPSM321DC24V16点SM322DO24V16点I/O点范围六、PLC程序设计libraryieee;useieee.std_logic_1164.all;useieee.std_logic_unsigned.all;entitysheji3isport(clk,ck:instd_logic;sel:ins
4、td_logic_vector(1downto0);sm:outstd_logic_vector(6downto0);duan:outstd_logic_vector(5downto0));endsheji3;architectureartofsheji3issignalcnt:std_logic_vector(3downto0);signaltemp:integerrange0to5;signalx:std_logic_vector(3downto0);signaly:std_logic_vector(3downto0)beginp1:process(clk)beg
5、inif(clk'eventandclk='1')thencaseseliswhen"00"=>if(cnt>="0100")thencnt<="0000";elsecnt<=cnt+1;endif;when"01"=>if(cnt=>"1000"orcnt="0001"orcnt="0011"orcnt="0101"orcnt="0111")thencnt<="0000";elsecnt<=cnt+2;endif;when"10"=>if(cnt>="1001"orcnt="0000"orcnt="0010"orcnt="0100"orcnt="0110"orcnt
6、="1000")thencnt<="0001";elsecnt<=cnt+2;endif;when"11"=>if(cnt>"0101"orcnt="0001"orcnt="0000")thencnt<="0101";elsecnt<=cnt-1;endif;whenothers=>cnt<="1111";endcase;y<=cnt;endif;endprocessp1;p2:process(ck)beginif(ck'eventandck='1')thencasetempiswhen0=>duan<="";x<=y;when1=>duan<="";x<=y;whe
7、n2=>duan<="";x<=y;when3=>duan<="";x<="00"&sel;when4=>duan<="";x<="00"&sel;whenothers=>duan<="";x<="00"&sel;endcase;temp<=temp+1;endif;endprocessp2;p3:process(x)begincasexiswhen"0000"=>sm<="";when"0001"=>sm<="";when"0010"=>sm<="";when"0011"=>sm<="";when"0100"=>sm<="";when"0101"=
此文档下载收益归作者所有