Other Parts Discussed in Thread: C2000WARE-DIGITALPOWER-SDK, TIDM-02000
Hi all
Can i know how to convert following assembly code to C readable code which found in the SPRABU2 document. .
This assembly implementation is very hard to understand. Its not readable at all.
Please Help me.
;------------------------------------------------------------------------------ ;Macro Name: mSlope_Com ;Description: The slope compensation of the PCMC ;Parameter: ; n: The comparator number ; _Ref: The reference current Q24 ; _Com_Ratio: The slope compensation ratio ;------------------------------------------------------------------------------ mSlope_Com .macro n,_Ref,_Com_Ratio ;========================= ; Set up address pointers SPRABU2 MOVL XAR0,#_Ref ; Net pointer for InA (XAR0) MOVL XAR1,#_Comp:n:Regs.RAMPMAXREF_SHDW ; pointer to Comparator Ramp Max Ref (XAR1) MOVL XAR2,#_Comp:n:Regs.DACVAL ; pointer to Comparator Ramp Dac Val (XAR2) MOVL XAR3,#_Comp:n:Regs.RAMPDECVAL_SHDW; Output for DACn MOVL XT,*XAR0 MOVW DP,#_Com_Ratio QMPYL ACC,XT,@_Com_Ratio ;ACC = upper16(Q24*Q24) = Q16 MOVL *XAR3,ACC ;_Comp:n:Regs.RAMPDECVAL_SHDW = ACC MOVL ACC,*XAR0 ; Q24 SFR ACC,#8 ; Q16 because Maximum RAMPMAXREF = 0xFFFF MOV *XAR1,AL ; Output value to RAMPMAXREF LSR AL, #6 ; Q10 to be written to DACVAL MOV *XAR2,AL ; Output value to DACVAL .endm
Thank you