你那程序,与也罢,或也罢(你用“||"或常数?????!!!!)都不行的,不好用的!你试试这个:
#include <reg52.h>
#include <intrins.h>
typedef unsigned int u16;
typedef unsigned char u8;
void delay(u16 num)
{
u16 x,y;
for(x=num; x>0; x--)
for(y=110; y>0; y--);
}
void main(void)
{
u8 temp_val;
temp_val=0x01;
while(1)
{
temp_val = _crol_(temp_val,1); //左移
// temp_val = _cror_(temp_val,1); //右移
P1= temp_val ;
delay(5000);
}
}
|