|
|
#include <reg51.h>
#define uchar unsigned char
uchar count;
sbit k=P3^2;
void main(void)
{EA=1;
IT0=1;
EX0=1;
TMOD=0x01;
TH0=0X3C;
TL0=0XB0;
ET0=1;
TR0=1;
P1=0x0F;
while(1)
;}
void INTO()interrupt 0
{
uchar i;
while(1)
{
P1=0x0f;
for(i=0;i<8;i++)
{P1>>=1;}
}
}
void timer0() interrupt 1
{
TH0=0X3C;
TL0=0XB0;
count++;
if(k==0)
{
if(count==20)
{
count=0;
P1=~P1;}
}
else
{if(count==20)
{
count=0;
P1>>1;}}}
這個程序燒錄進去失敗了,哪里有問題呀? |
|