|
#include<reg51.h>
#define uchar unsigned char
#define uint unsigned int
sbit RED_A=P0^0;
sbit YELLOW_A=P0^1;
sbit GREEN_A=P0^2;
sbit RED_B=P0^3;
sbit YELLOW_B=P0^4;
sbit GREEN_B=P0^5;
uchar Time_Count=0;
Flash_Count=0;
Operation_Type=1;
void To_int()interrupt 1
{
TH0=-50000/256;
TL0=-50000%256;
switch(Operation_Type)
{
case 1;
RED_A=0;YELLOW_A=0;GREEN_A=l;
RED_B=l;YELLOW_B=0;GREEN_B=0;
if(++Time_Count!=100)
retun;
Time_ Count=0;
Operation_Type=2;
break;
case 2:
if(++Time_Count!=8)retun;
Time_Count=0;
YELLOW_A=!YELLOW_A;
GREEN_A=0;
if(++Flash_Count!=10)
retun;
Flash_ Count=0;
Operation_Type=3;
break;
void main()
{
TMOD=0x01;
IE=0x82;
TR0=l;
while(1);
}
放一下我的程序
|
-
-
新建文件夹.zip
20.65 KB, 下载次数: 6, 下载积分: 黑币 -5
hex文件。.c文件
|