How to write a program to show a value in register(R4=10bit) in MSP430G2553 by ASM language, because in the instruction of msp430 no command MUL and DIV,
Help me please!
Thanks!
Thuan
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.
How to write a program to show a value in register(R4=10bit) in MSP430G2553 by ASM language, because in the instruction of msp430 no command MUL and DIV,
Help me please!
Thanks!
Thuan
More efficient is a shift-and-add operation, as it only has as many shifsts and a no more but probably less additions that the smaller operands width. (on MSPs with hardware multiplier, just use this one)Andy Neil said:Multiplication is just repeated addition
The difficult part is the division. However, replacing a division by a multiplication and a shift is much, MUCH faster, with acceptable precision.
If really a division is needed: the MSPGCC project has the default multiplication and division function in the default GCCLIB, which is available as source code. The functions are written in MSP assembly language
**Attention** This is a public forum