EmbeddedRelated.com
Forums
Memfault Beyond the Launch

Dividing two registers in MSP430??

Started by chomiczuk81 April 23, 2005
Haw to divide two registers eg. R8/R7 in MSP430. Do I have to use only 
hardware multiplier.
To multiply you have to:
; 16x16 Unsigned Multiply
      MOV R5,&MPY              ; Load first operand into  appropriate 
register
      MOV R6,&OP2              ; Load 2nd operand Result is now available
But haw to divide these two registers?

Examples would be helpful. Great thanks in advance 


"chomiczuk81" <chomiczuk81@op.plx> wrote in message
news:d4dfdp$ej2$1@nemesis.news.tpi.pl...
> Haw to divide two registers eg. R8/R7 in MSP430. Do I have to use only > hardware multiplier. > To multiply you have to: > ; 16x16 Unsigned Multiply > MOV R5,&MPY ; Load first operand into appropriate > register > MOV R6,&OP2 ; Load 2nd operand Result is now available > But haw to divide these two registers? > > Examples would be helpful. Great thanks in advance > >
You need to re-learn long division. Google "MSP430 divide source" found this on the first of many pages of hits: http://www.web-ee.com/Schematics/Ultrasonic%20Range%20Finder%20II/slaa136a.p df It includes source code for a divide function. I haven't tested it. Good luck. -- Alf Katz alfkatz@remove.the.obviousieee.org

Memfault Beyond the Launch