#include "reg52.h"
#include "intrins.h"
typedef unsigned int ui;
typedef unsigned char uc;
#define led P2 //×¢Ò⣡£¡²»¼Ó";"
void delay(ui k)
{
ui i,j;
for(i=0;i<k;i++)
for(j=0;j<500;j++);
}
void main()
{
ui i=0;
led=0xfe;
delay(500);
while(1)
{
for(i=0;i<7;i++)
{
led=_crol_(led,1);
delay(500);
}
for(i=0;i<7;i++)
{
led=_cror_(led,1);
delay(500);
}
}
}
此单片机为共阳极