#include<reg51.h>
#include<intrins.h>
#define uchar unsigned char
uchar keyval;
uchar led1=0xfe,led2=0x55,led3=0x0f;
sbit key=P1^0;
void t0isr() interrupt 1
{
TH0=(65536-60000)/256;
TL0=(65536-60000)%256;
switch(keyval)
{
case 1:
P0=led1;
led1=_crol_(led1,1)
break;
case 2:
P0=led2;
led2=~led2;
break;
case 3:
P0=led3;
led3=~led3;
break;
default:break;
}
}
main()
{
TMOD=0x01;
TH0=(65536-60000)/256;
TL0=(65536-60000)%256;
TR0=1;
ET0=1;
EA=1;
while(1)
{
if(key==0)
{
while(key==0);
keyval++;
keyval%=4;
}
}
}
追é®ææ³åä¸ä¸ªç¨åºï¼æä¸K1é®å¯å¨æ¨¡å¼1ï¼çº¢ç¯äº®5ç§åçï¼å»¶è¿1ç§ï¼ç»¿ç¯äº®5ç§çï¼å»¶æ¶1ç§åå°çº¢ç¯äº®ãããå¦æ¤å¾ªç¯ï¼æ¤æ¨¡å¼å·¥ä½10åéåæ¢
æK2é®å¯å¨æ¨¡å¼2ï¼ç»¿ç¯äº®1åéåç
(ç¨å®æ¶å¨T0å·¥ä½æ¹å¼1)