【正文】
recent years, with the rapid development of science and technology, the application of SCM in constant development, and promote the traditional control detection technology is updated. Microcontroller as a core ponent to use.The modern age is an era of automation, traffic light control and many other sectors of the equipment are closely related with the puter. A good traffic control system, will give road congestion, illegal control give technical innovation, along with the large scale integrated circuit and the rapid development of puter technology, as well as a technology in the control of the application. Equipment had very great progress, is the modern science and technology development direction.This design uses a single chip system and an external device, is used in singlechip assembly language to write procedures. The single chip microputer based on AT89S52, have good circuit diagram, program design using the software is written in KEIL4, using USB procedures to generate 16 hex file downloaded to a singlechip inside and then run.This article mainly from the application of SCM to realize the crossroads traffic lights management, to control the vehicle past the normal traffic.Key words:Single chip microputer。 《單片機(jī)技術(shù)》課程設(shè)計(jì)說(shuō)明書 交 通 燈 系 、 部: 電氣與信息工程系 學(xué)生姓名: 指導(dǎo)教師: 職稱 副教授 專 業(yè): 電子信息工程 班 級(jí): 完成時(shí)間: 2011年12月26日 摘 要近年來(lái),隨著科技的飛速發(fā)展,單片機(jī)的應(yīng)用在不斷的深入,同時(shí)帶動(dòng)傳統(tǒng)控制檢測(cè)技術(shù)日益更新。本文主要從單片機(jī)的應(yīng)用上來(lái)實(shí)現(xiàn)十字路口交通燈的管理,用以控制過(guò)往車輛的正常通行。 方案概述本設(shè)計(jì)采用的是單片機(jī)以及其外部設(shè)備組成硬件電路,其中包括單片機(jī)、數(shù)碼管顯示器。只有當(dāng)單片機(jī)有了這些電路才會(huì)工作。 所做實(shí)物圖所做實(shí)物圖如圖2所示 圖2 所做實(shí)物圖3 課題軟件系統(tǒng)設(shè)計(jì) 單片機(jī)資源使用情況⑴、P3口為二極管的控制端⑵、P0口用作地址/數(shù)據(jù)總線⑶、P2口用作地址/數(shù)據(jù)總線⑷、既在AT89S52的P3口用來(lái)接八個(gè)發(fā)光二極管的陰極,控制其亮與滅,P0口和P2口外接由8個(gè)LED數(shù)碼管構(gòu)成的顯示器,用P0口作LED的段碼輸出口(~~dp),P2口作LED的位控輸出線,P2口外接四個(gè)個(gè)按鍵A、B、C、D(、)用于調(diào)整顯示接口電路。 程序流程框圖 主程序的流程框圖主程序流程框圖如圖3所示 圖3 程序流程框圖 鍵掃子程序流程框圖鍵掃子程序流程框圖如圖4所示 圖4 鍵掃子程序流程框圖 顯示子程序流程框圖顯示子程序流程框圖如圖5所示 圖5 顯示子程序流程框圖 延時(shí)程序流程框圖延時(shí)程序流程框圖如圖6所示 圖6 延時(shí)程序流程框圖 程序清單/***************主程序****************************************/ORG 0000HLJMP MAIN ORG 0030HMAIN: MOV SP, 60H MOV PSW, 00H LOOP: MOV 7CH, 16MOV 7DH, 16 MOV 7EH, 16 MOV 7FH, 17 LOOP1: LCALL KEY MOV R0, 20H CJNE R0, 01H, KEY1 LJMP JIACHEDAOKEY1: CJNE R0, 02H, KEY2 LJMP YICHEDAOKEY2: LCALL DIR LJMP LOOP1TAB:DB 0C0H,0F9H,0A4H,0B0H,99H,92H,82H,0F8H,80H ,90H DB 88H,83H,0C6H,0A1H,86H,8EH,0FFH,0CH 。雖然大部分都是借鑒的,只是照著描描但自己還是用心去弄懂了。王老師一次次給我們指出原理圖的錯(cuò)誤,讓我們反反復(fù)復(fù)地修改再重新繪制。附錄Ⅰ附錄Ⅱ 附錄Ⅱ圖7 初始狀態(tài)是顯示P. 附錄Ⅱ圖8 甲車道綠燈通行實(shí)拍圖 附錄Ⅱ圖9 乙車道綠燈通行實(shí)拍圖 附錄Ⅱ圖10 緊急車輛通行實(shí)拍圖33