#include<stc15.h>
#include<intrins.h>
#define uchar unsigned char
#define uint  unsigned int
uchar x=0xfe;
sbit k1=P3^2;
void Delay1ms()		//@12.000MHz
{
	unsigned char i, j;

	i = 12;
	j = 169;
	do
	{
		while (--j);
	} while (--i);
}

void delay(uint ms)
{
	uint j;
	for(j=0;j<ms;j++)Delay1ms();
}
void main(void)
{
	while(1)
	{
		if(k1==0)
		{
			P1=x;
			x=_crol_(x,1);
			delay(1000);
		}
		else
		{
			P1=x;
			x=_cror_(x,1);
			delay(500);
		}
	}
}
