This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Division

Hi, I'm Juan Manuel, I'm using the ADuC7026 with Keil:

IDE-Version:

µVision3 V3.23
Copyright (c) Keil Elektronik GmbH / Keil Software, Inc. 1995 - 2005

Tool Version Numbers:
Toolchain Path: C:\Keil\ARM\BIN\
C Compiler: CA.Exe V2.42
Assembler: AA.Exe V2.40b
Linker/Locator: LA.Exe V2.42
Librarian: LIBA.Exe V4.26
Hex Converter: OHA.Exe V2.10
CPU DLL: SARM.DLL V1.29
Dialog DLL: DARMAD.DLL V1.05b
Target DLL: BIN\UL2ARM.DLL V1.14a
Dialog DLL: TARMAD.DLL V1.05b

I'm trying to make a division between, for example A (an integer) and 316.5, but I have a problem. I compile it and everything is Ok, but when I debug it, and reachs the line that make the division it open the disassembly panel y and does nothing.

int main (void)
{

 int res, a=4095,
 float b=316.5;

 res= a/b;       //First I'd tried with /

 res= div(a,b);  // Then with div() function


 while(1)
 {
 }

}

Disassembly panel show this

                 ?C?CASTF?T:
0x000801C0  4778      BX        PC
0x000801C2  46C0      NOP

Is it possible to make the division I'm trying? What's the mistake?

I would be very grateful for any help!

Thanks

JuanMa

Parents
  • The result of the division is not used anywhere in your program, so the compiler must have optimized it away. What you see in the disassembler is the while(1) loop.
    You could try lowering optimization level. Or actually use the result in the program, say as an argument to printf.

Reply
  • The result of the division is not used anywhere in your program, so the compiler must have optimized it away. What you see in the disassembler is the while(1) loop.
    You could try lowering optimization level. Or actually use the result in the program, say as an argument to printf.

Children