freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

智能交通燈設(shè)計-畢業(yè)論-資料下載頁

2025-06-06 03:10本頁面
  

【正文】 亮到 10s 以內(nèi),突然車輛增加,而此時南北方向車輛又不太多的時候,可以智能感應(yīng)車流量然后自動將綠燈多亮 10s。******************************************************************/ /************頭文件聲明 *************/ include//庫函數(shù) /************數(shù)據(jù)類型定義 *************/ define uint unsigned int //定義數(shù)據(jù)類型 define uchar unsigned char//定義數(shù)據(jù)類型 uchar shi,ge,count,NB_Time。DX_Time。 //定義各變量類型 /************引腳的定義 *************/ sbit KeyNB=P3^0。 sbit KeyDX=P3^1。 sbit KeyDXZEN=P3^5。 sbit KeyNBZEN=P3^4。 sbit s1=P2^4。 sbit s2=P2^5。 29 sbit w1=P2^6。 sbit w2=P2^7。 /************數(shù)碼管的段選 *************/ uchar code table[]={ 0xc0,0xf9,0xa4,0xb0,//0,1,2,3 0x99,0x92,0x83,0xf8,//4,5,6,7 0x80,0x98}。//8,9 /************函數(shù)的初始化 *************/ void init() //初始化 { count=0。// TMOD=0x01。// 00000001 方式 1,為 16 位定時器 /計數(shù)器 TH0=(6553650000)/256。 TL0=(6553650000)%256。//設(shè)置的時間為 20MS EA=1。//總中斷被打開 ET0=1。//允許 T0 溢出中斷 EX0=1。//外部中斷 0 打開 EX1=1。//外部中斷 1 打開 IT0=0。//外部中斷 0 為電平觸發(fā) IT1=0。//外部中斷 1 為電平觸發(fā) TR0=1。//啟動定時器 /計數(shù)器工作 PT0=1。//定時器 0 為最高優(yōu)先級 } /************延時子程序 *************/ void Delay(uchar a)//循環(huán) a 次 { uchar x。 x=a。 while(x){。} } 30 /************定時器初始化 *************/ void timer0() interrupt 1 //定時器初始化 { TH0=(6553650000)/256。 TL0=(6553650000)%256。 //50MS 一次 count++。 if(count==20) { NB_Time。 DX_Time。 count=0。 } } /************顯示函數(shù) *************/ void display() { uchar shi,ge。 shi=NB_Time/10。 ge=NB_Time%10。 P1=table[ge]。 w2=1。 Delay(200)。 w2=0。 P1=table[shi]。 w1=1。 Delay(200)。 w1=0。 shi=DX_Time/10。 ge=DX_Time%10。 31 P1=table[ge]。 s2=1。 Delay(200)。 s2=0。 P1=table[shi]。 s1=1。 Delay(200)。 s1=0。 } /************外部 0 中斷 *************/ void int0() interrupt 0 //緊急車輛來時,全亮紅燈。 { EX0=0。//外部中斷 0 關(guān)閉 NB_Time=5。 DX_Time=5。 while(NB_Time0) { P0=0xdb。//全黃燈警告,作為切換模式。 display()。 } NB_Time=20。 DX_Time=20。 while(NB_Time0) { P0=0xbd。//10111101 南北紅燈,東西紅燈。 display()。 } EX0=1。//外部中斷 1 打開 32 } /************外部中斷 1 函數(shù) *************/ void int1() interrupt 2//進入特殊狀態(tài) { EX1=0。//外部中斷 1 關(guān)閉 if(KeyNB==0)//判斷南北鍵是不是按了下來 { NB_Time=5。 DX_Time=5。 while(NB_Time0) { P0=0xdb。//全黃燈警告,作為切換模式。 display()。 } NB_Time=20。 DX_Time=20。 while(NB_Time0) { P0=0xb7。//10110111 當東西空閑沒有車的時候,按下南北鍵轉(zhuǎn)為南北綠燈,東西紅燈 display()。 } } if(KeyDX==0)//判斷東西按鍵是不是按了下來 { NB_Time=5。 DX_Time=5。 while(NB_Time0) 33 { P0=0xdb。//全黃燈警告,作為切換模式。 display()。 } NB_Time=20。 DX_Time=20。 while(NB_Time0) { P0=0xed。//11101101 當南北空閑沒有車的時候,按下東西鍵轉(zhuǎn)為東西綠燈,南北紅燈 display()。 } } if(KeyDXZEN==0)//判斷東西鍵是不是按了下來 { if(DX_Time=10) DX_Time=DX_Time+10。//如果東西車輛綠燈在 10s以內(nèi)突然車多了,那么這時再增加 10s 的通行時間 NB_Time=DX_Time。 while(NB_Time0) { P0=0xed。//10110111 東西綠東西紅 display()。 } } if(KeyNBZEN==0)//判斷南北鍵是不是按了下來 { 34 if(NB_Time=10) NB_Time=NB_Time+10。//如果南北車輛綠燈在 10s 以內(nèi)突然車多了,那么這時再增加 10s 的通行時間 //如果東西車輛綠燈在 10s 以內(nèi)突然車多了,那么這時再增加 10s 的通行時間 DX_Time=NB_Time。 while(NB_Time0) { P0=0xb7。//10110111 南北綠東西紅 display()。 } } EX1=1。//外部中斷打開 } /************進程函數(shù) *************/ void process()// { /************南北綠燈 東西紅燈 *************/ NB_Time=30。 DX_Time=50。 while(NB_Time0) { P0=0xb7。//10110111 display()。 } /************南北藍燈 東西紅燈 *************/ NB_Time=15。 DX_Time=20。 while(NB_Time0) { 35 P0=0xbe。//10111110 display()。 } /************南北黃 東西紅 *************/ NB_Time=5。 DX_Time=5。 while(NB_Time0) { P0=0xbb。//10111011 display()。 } /************南北紅東西綠 *************/ NB_Time=40。 DX_Time=20。 while(DX_Time0) { P0=0xed。//11101101 display()。 } /************南北紅 東西藍 *************/ NB_Time=20。 DX_Time=15。 while(DX_Time0) { P0=0x7d。//01111101 display()。 } /************南北紅 東西黃 *************/ NB_Time=5。 36 DX_Time=5。 while(DX_Time0) { P0=0xdd。//11011101 display()。 } } /************進入主函數(shù) *************/ void main() { while(1)//進入無限循環(huán) { init()。//函數(shù)初始化 process()。//進入進程函數(shù) } }
點擊復(fù)制文檔內(nèi)容
畢業(yè)設(shè)計相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1