在 lnk_msp430c111.cmd 中添加 如下代码
SB_0 = 0x0000;
SB_1 = 0x0001;
SB_2 = 0x0002;
SB_3 = 0x0003;
SB_4 = 0x0004;
然后在main.c中添加
#include "msp430x11x1.h"
//在"msp430x11x1.h" 中包含:: #define SFR_16BIT(address) extern volatile unsigned int address
SFR_16BIT(SB_0);
SFR_16BIT(SB_1);
SFR_16BIT(SB_2);
SFR_16BIT(SB_3);
SFR_16BIT(SB_4);
void main() { //反汇编结果
int i; //SUB.W #2,SP
SB_0 = 0x01; //MOV.W #1,&0x0000
i = SB_0; //MOV.W &0x0000,0x0000(SP)
SB_1 = 0x02+SB_0; //MOV.W #2,R15 MOV.W R15,&0X0001
SB_2 = 0x03; //MOV.W #0x0003,&0x0002
....
}
我比较奇怪的是为什么SB_0 SB_1 SB_2会当作类似 int *来用呢?
文章评论(0条评论)
登录后参与讨论