在“#define led P0”可用前,一定需要 #include 一個定義了IO口的頭文件,例如你 #include "stc15fxx.h" 之后就可以直接 #define led P0了,要注意沒有分號。
在stc15fxx.h 里會有如下:
#define _P0 0x80
SFR(P0, 0x80); //1111,1111 端口0
SBIT(P00, _P0, 0);
SBIT(P01, _P0, 1);
SBIT(P02, _P0, 2);
SBIT(P03, _P0, 3);
SBIT(P04, _P0, 4);
SBIT(P05, _P0, 5);
SBIT(P06, _P0, 6);
SBIT(P07, _P0, 7); |