宏:
PWMDRV_LLC_ComplPairDB .macro n
_PWMDRV_LLC_ComplPairDB_Duty:n: .usect "PWMDRV_LLC_ComplPairDB_Section",2,1,1 ; input terminal for PWM duty percentage
_PWMDRV_LLC_ComplPairDB_Period:n: .usect "PWMDRV_LLC_ComplPairDB_Section",2,1,1 ; input terminal for PWM period value
MOVW DP, #_PWMDRV_LLC_ComplPairDB_Duty:n:
MOVL XAR0, @_PWMDRV_LLC_ComplPairDB_Duty:n:
MOVL XAR1, @_PWMDRV_LLC_ComplPairDB_Period:n:
MOVL ACC, *XAR1
SFR ACC, #14 ; MOVW DP, #_EPwm:n:Regs.TBPRD
MOV @_EPwm:n:Regs.TBPRD, AL
MOVL XT, @_EPwm:n:Regs.TBPRD
QMPYL ACC, XT, *XAR0
SFR ACC, #8
MOVW DP, #_EPwm:n:Regs.CMPA
MOV @_EPwm:n:Regs.CMPA.half.CMPA, AL
.endm
调用宏的汇编程序:(
汇编程序)
.cdecls C,LIST,"DSP2833x_Device.h"
.include "PWMDRV_LLC_ComplPairDB.asm"
_PWM_ISR:
.if(INCR_BUILD = 2)
PWMDRV_LLC_ComplPairDB 1;
宏调用
.endif
如果只执行“
汇编程序”,得到的结果和将“
汇编程序”中的宏调用指令用具体的宏汇编代替后的结果,两者不一致,不知道为什么!!!
请给予解答!谢谢!
宏:
PWMDRV_LLC_ComplPairDB .macro n
_PWMDRV_LLC_ComplPairDB_Duty:n: .usect "PWMDRV_LLC_ComplPairDB_Section",2,1,1 ; input terminal for PWM duty percentage
_PWMDRV_LLC_ComplPairDB_Period:n: .usect "PWMDRV_LLC_ComplPairDB_Section",2,1,1 ; input terminal for PWM period value
MOVW DP, #_PWMDRV_LLC_ComplPairDB_Duty:n:
MOVL XAR0, @_PWMDRV_LLC_ComplPairDB_Duty:n:
MOVL XAR1, @_PWMDRV_LLC_ComplPairDB_Period:n:
MOVL ACC, *XAR1
SFR ACC, #14 ; MOVW DP, #_EPwm:n:Regs.TBPRD
MOV @_EPwm:n:Regs.TBPRD, AL
MOVL XT, @_EPwm:n:Regs.TBPRD
QMPYL ACC, XT, *XAR0
SFR ACC, #8
MOVW DP, #_EPwm:n:Regs.CMPA
MOV @_EPwm:n:Regs.CMPA.half.CMPA, AL
.endm
调用宏的汇编程序:(
汇编程序)
.cdecls C,LIST,"DSP2833x_Device.h"
.include "PWMDRV_LLC_ComplPairDB.asm"
_PWM_ISR:
.if(INCR_BUILD = 2)
PWMDRV_LLC_ComplPairDB 1;
宏调用
.endif
如果只执行“
汇编程序”,得到的结果和将“
汇编程序”中的宏调用指令用具体的宏汇编代替后的结果,两者不一致,不知道为什么!!!
请给予解答!谢谢!
举报