This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

汇编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

  • 求帮忙确认一下

  •  是不是要改一下:B  Dwn_Cnt, NEQ    ; If equal to 0,计数器减模式

  • 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,就继续往下走

  • 这个跟ACC没有关系吧,EQ是指Zflag =1,

    B Dwn_Cnt,EQ 这句话不是应该这样解释:如果相等就跳转到Dwn_Cnt,否则继续往下走?

  • 仔细看刚刚贴出来的这句话:

    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 就跳转