AnsweredAssumed Answered

56800E Core - 56F8023 Assembly div and impy.l question

Question asked by sandrom on Feb 12, 2018
Latest reply on Feb 26, 2018 by sandrom

Hello all,

 

I'm analyzing for exercise this assembly piece of code, but I can't understand what it means...

 

bfset #0x10,OMR
move.w Var1,B1
move.w #23165,Y1
impy.l B1,Y1,A
move.w Var2,Y0
asl A
bfclr #1,SR
rep #0x000010
div Y0,A
move.w A0,X:Var3
bfclr #0x10,OMR

there is fractional arithmetic (I think 23165 is FRAC16(root(2)/2)), but I'm not sure).

Also the rep+div instructions and the 16-bit to 32-bit and backward operations are quite hard to understand for me.

Somebody can explain me in details the maths operations behind this code? Even in C code, no problem.

 

The scope of this calculation should be about Ripple elimination/rescaling of stator voltage in ACIM vector control (SVM) driving, but I'm not sure.

 

Thanks a lot in advance

Sandro

Outcomes