?? text1.c
字號:
#include<reg52.h>
#include<stdio.h>
#include<intrins.h>
sbit Sred_Egeeen=P1^1;
sbit Syellow_Eyellow=P1^2;
sbit Sgreen_Ered=P1^3;//定義南北、東西向端口
void delay(unsigned char k);//函數(shù)聲明
unsigned char count;//定義全局變量
void time0_int(void) interrupt 1
{
count=count+1;
}
void main(void)
{
TMOD=0X00;//工作方式0 8.192ms
TH0=0X00;
TL0=0X00;
EA=1;
ET0=1;
TR0=1;
while(1)
{
count=0;
Sred_Egeeen=0;
Syellow_Eyellow=1;
Sgreen_Ered=1;
do{;}
while(count<=250);//南北紅燈,東西綠燈
Sred_Egeeen=1;
Syellow_Eyellow=0;
Sgreen_Ered=1;
count=0;
do{;}
while(count<=40);//黃燈切換
Sred_Egeeen=1;
Syellow_Eyellow=1;
Sgreen_Ered=0;
count=0;
do{;}
while(count<=250);//南北綠燈,東西紅燈*/
power=1;
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -