使用KEIL c;stm32f103编写如下代码:
#define MAX_LAMPNUM_IN_CTRLDEV 4
unsigned short CharPos,ChangePos,MeterNo;
unsigned char LampNum;
MeterNo = 1;
LampNum = 0;
CharPos = ((MeterNo - 1) * MAX_LAMPNUM_IN_CTRLDEV + LampNum - 1) / 8;
ChangePos = ((MeterNo - 1) * MAX_LAMPNUM_IN_CTRLDEV + LampNum - 1) % 8;
为什么最后计算记过CharPos = 0x0000,ChangePos = 0xffff
|