TI论坛
直播中

欧竞仲

7年用户 189经验值
私信 关注
[问答]

汇编B指令问题

  EALLOW
  MOVW  DP,#_EPwm1Regs.TBSTS
  MOV  AL,@_EPwm1Regs.TBSTS
  ANDB  AL,#0x1     ; Check TBCNT1 Direction
  B  Dwn_Cnt,EQ    ; If equal to 0 (Counting Down)  注释是不是写错了?
EQ = 1,而NEQ = 0
                                                                         keep on studying

回帖(3)

欧竞仲

2020-6-1 16:40:00
求帮忙确认一下
                                                                        keep on studying
举报

徐小婷

2020-6-1 16:58:50
SPRU430F应用文档第161页开始,EQ是指Zflag =1,NEQ是指Zflag =0, 
After the shift, the Z flag is set if the ACC value is zero, else Z is cleared. Even if the T register specifies a shift of 0, the content of the ACC register is still tested for the zero condition and Z is affected.
Z位的定义,B指令的含义:
Conditional branch. If the specified condition is true, then branch by adding the signed
16-bit constant value to the current PC value; otherwise continue execution without
branching:
If (COND = true) PC = PC + signed 16-bit offset;
If (COND = false) PC = PC + 2;
所以如果此时ACC = 0,那就跳转Dwn_Cnt,如果不等于0,就继续往下走
举报

徐小婷

2020-6-1 17:26:38
仔细看刚刚贴出来的这句话:
After the shift, the Z flag is set if the ACC value is zero, else Z is cleared. Even if the T register specifies a shift of 0, the content of the ACC register is still tested for the zero condition and Z is affected.
是如果ACC =0 就跳转
举报

更多回帖

发帖
×
20
完善资料,
赚取积分