#include < reg52.h >
#include <intrins.h>
sbit P00 = P0^0;
void delay(unsigned int ms)
{
unsigned char i;
while(ms--) for(i = 110; i-- ; i > 0);
}
void main()
{
unsigned char LED = 0xfe, COUN = 0;
while(1) {
P1 = LED;
P2 = COUN;
if (P00 == 1) {
delay(2);
if (P00 == 1) {
while (P00 == 1);
LED = _cror_(LED, 1);
COUN++;
} } } }
温馨提示:答案为网友推荐,仅供参考