|
sbit b0 =P2^3;
sbit b1 =P2^4;
sbit b2 =P2^5;
sbit b3 =P0^4;
sbit b4 =P0^5;
sbit b5 =P0^3;
sbit b6 =P0^2;
uchar get_p2(void)
{
uchar ss=0;
if (b6==0)
ss|=0x40;
if (b5==0)
ss|=0x20;
if (b4==0)
ss|=0x10;
if (b3==0)
ss|=0x08;
if (b2==0)
ss|=0x04;
if (b1==0)
ss|=0x02;
if (b0==0)
ss|=0x01;
return ss;
}
------------------------------------------------------------------------------------------------
两者竟然不一样, 前者才可以,,后者虽不报错,但不能读端口。
------------------------------------------------------------------------------------------------
#define pin0 P2^3
#define pin1 P2^4
#define pin2 P2^5
#define pin3 P0^4
#define pin4 P0^5
#define pin5 P0^3
#define pin6 P0^2
#define low_data ((pin0?0:1)|(pin1?0:0x02)|(pin2?0:0x04)|(pin3?0:0x08)|(pin4?0:0x10)|(pin5?0:0x20)|(pin6?0:0x40)&0x7F) |
|