|
发表于 2015-12-7 16:46:31
|
显示全部楼层
MODEBUS 定义BYTE传输,若BIT提取,也就是提取0或1.
省RAM的做法,你可以把每个BIT都定义好标志.
extern UC BitFlag4; //bit flag ram
#define F_BackLight (((bits*)&BitFlag4)->bit0) //=1 backlight on
#define F_BackupManu (((bits*)&BitFlag4)->bit1) //backup F_ManualAuto
#define F_ErrorMode (((bits*)&BitFlag4)->bit2) //error mode
#define F_500msChPump (((bits*)&BitFlag4)->bit3) //change pump timing toggle
#define F_KeyBuzzer (((bits*)&BitFlag4)->bit4) //press key have a buzzer
#define F_ErrorBuzzer (((bits*)&BitFlag4)->bit5) //error status buzzer
#define F_T30s (((bits*)&BitFlag4)->bit6) //timing keep pressure 30s
#define F_ScanBp (((bits*)&BitFlag4)->bit7) //backup scan 10ms
败家的做法,每个BIT独立占一个BYTE. |
|