penguinfly wrote: > Hi,Steven Johnson: > //// > I changed the type of varc to uint32_t, but it is also doing wrong. > did you test it ?
No, I didnt. Try typecasting varb, like this: varc = (unit32_t)(varb) * vara / 0x7000; If you only have 16 bit types, the result can only be 16 bits. (which is what you had before). If GCC isnt working out it needs 32bit precision, force it by type casting. Steven > > > */Steven Johnson <sjohn...@neurizon.net>/* 写道: > > 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免费邮箱百分百防垃圾信 > > 雅虎助手-搜索、杀毒、防骚扰 > > > > > ------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, > security? > Get stuff done quickly with pre-integrated technology to make your > job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache > Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > Mspgcc-users mailing list > Mspgcc-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/mspgcc-users > > > ------------------------------------------------------------------------ > 无限容量雅虎相册,原图等大下载,超快速度,赶快抢注! > <https://reg.cn.yahoo.com/cnreg/cnreg_first?id=78999&.prop=photo>