Hi

It is a bug in your code. You are assigning the result to a 16 bit
quantity, so it is doing the right job. Change the type of varc to uint32_t.

Steven

penguinfly wrote:

> Hi,everybody:
> Excuse me! English is not my first language. I'm chinese.
> It is hard to express my meanings clearly with my poor english.
> I lvoe the mspgcc, but there are some troubles When I useing
> 16-bit multiplication in f147 and fe427. The result of the 16-bit
> multiplication should be 32-bit, but the compiler only read
> the register 0x013a(RESLO). Is this a bug or something wrong
> when i useing the hardware multiplier?
> By the way, is it necessary to add "#define __msp430_have_fll"
> in msp430xE42x.h?
> (mspgcc-20060407,win2000/xp)
> mian.c:
> uint16_t vara,varb,varc;
> void dispLED(uint16_t);
> ...
> int main(void)
> {
> ...
> vara=0x6000;
> varb=0x5000;
> varc = varb * vara / 0x7000;
> dispLED(varc);
> ...
> }
>
> Part of the Assemble List:
> vara=0x6000;
>
> 81bc: b2 40 00 60 mov #24576, &0x020c ;#0x6000
> 81c0: 0c 02
> varb=0x5000;
>
> 81c2: b2 40 00 50 mov #20480, &0x0208 ;#0x5000
> 81c6: 08 02
> varc = varb * vara / 0x7000;
>
> 81c8: 02 12 push r2 ;
> 81ca: 32 c2 dint
> 81cc: 03 43 nop
> 81ce: b2 40 00 50 mov #20480, &0x0132 ;#0x5000
> 81d2: 32 01
> 81d4: b2 40 00 60 mov #24576, &0x0138 ;#0x6000
> 81d8: 38 01
> *81da: 1f 42 3a 01 mov &0x013a,r15 ;0x013a
> * 81de: 32 41 pop r2 ;
> 81e0: 0c 4f mov r15, r12 ;
> 81e2: 3a 40 00 70 mov #28672, r10 ;#0x7000
> 81e6: b0 12 dc 82 call #-32036 ;#0x82dc
> 81ea: 0f 4c mov r12, r15 ;
> 81ec: 82 4c 0a 02 mov r12, &0x020a ;
> dispLED(varc);
>
> 81f0: b0 12 7a 81 call #-32390 ;#0x817a
>
> ------------------------------------------------------------------------
> 雅虎1G免费邮箱百分百防垃圾信 <http://cn.mail.yahoo.com>
> 雅虎助手-搜索、杀毒、防骚扰 <http://cn.zs.yahoo.com> 



Reply via email to