变量:
volatile bdata Hall_val,DRV_val;
sbit ha=Hall_val^2;
sbit hb=Hall_val^1;
sbit hc=Hall_val^0;
拼合:
ha=Ha;hb=Hb;hc=Hc
屏蔽未用的位:
Hall_val&=0x0f;
使用:
DRV_val=hal_drv[Hall_val];
结果,Hall_val的值总是0.
查汇编,发现不能理解
151: ha=Ha;hb=Hb;hc=Hc;
C:0x0389 A2B6 MOV C,Ha(0xB0.6)
C:0x038B 9212 MOV ha(0x22.2),C
C:0x038D A2B3 MOV C,Hb(0xB0.3)
C:0x038F 9211 MOV hb(0x22.1),C
C:0x0391 A2B2 MOV C,Hc(0xB0.2)
C:0x0393 9210 MOV hc(0x22.0),C
152: Hall_val&=0x0f;
C:0x0395 53230F ANL 0x23,#0x0F
C:0x0398 752200 MOV Hall_val(0x22),#0x00
153: DRV_val=hal_drv[Hall_val];
这个各位有什么经验分享指导一下吗? |