Re: Floating point calculations on 16 uC



On 28 Aug, in article
<1125220291.973553.315000@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
dbahlmann@xxxxxxxxx "db" wrote:

>Hi,
>
>I'm doing floating point calculations on a Fujitsu MB90F474 16bit uC.
>All float calculations are done in the main loop context. Sometimes the
>result returns a garbage value. This seems to happen only when
>interrupts are enabled. Note that there are no globals or shared data
>involved.

Look at your map file to see where the last local variables are before
the bottom of your stack. It sounds like the stack is overwriting the
variables as your stack is not large enough. If possible write some
known values after the last variables (like hex 01, 02, 03, 04, 05, 06...)
into the stack area. Then see what ones are still there when interupts
are enabled.

I suspect that local variables for your floating point routines are what
are being corrupted.

>If anyone has had similar problems please let me know. Any advice when
>using floating point calculations would be appreciated.

I don't think it is floating point related, but stack related due to too
small a stack size for your application.

--
Paul Carpenter | paul@xxxxxxxxxxxxxxxxxxxxxxxxxxx
<http://www.pcserviceselectronics.co.uk/> PC Services
<http://www.gnuh8.org.uk/> GNU H8 & mailing list info
<http://www.badweb.org.uk/> For those web sites you hate

.



Relevant Pages

  • Re: Floating point calculations on 16 uC
    ... >> All float calculations are done in the main loop context. ... >> using floating point calculations would be appreciated. ... There is one rather ugly variant of stack overflow that I ran across many ... These sections often have notes on interactions with interrupts ...
    (comp.arch.embedded)
  • Re: Errors cancel sometimes
    ... I thought that it was remarkable, so I'm remarking on it. ... Goldberg's "What Every Computer Scientist Should Know About Floating ... elements of accurate numerical calculations on a computer as well. ... I'd be happy to have any pointers to more modern works that cover the ...
    (comp.programming)
  • Re: TDD: Test-Driven Design or Test-Driven Development?
    ... design idea, and conflating it. ... > requires one to implement floating point calculations. ... This decision may affect how the calculations are coded. ... Please describe the Test Driven Development process that you think we are ...
    (comp.object)
  • Re: Program Computes incorrectly under VPC.
    ... >>owners of this software that it should not be used for floating point math. ... > NONE of the spreadsheets in the world today have EVER ... > calculations, ... > percentage of algorithms will fail in VPC. ...
    (microsoft.public.mac.virtualpc)
  • Re: IEEE Decimal Float on Itanium
    ... I'm guessing you're contemplating some specific application here, and probably something involving PL/I. ... Currency calculations. ... switched a billing and management system from its floating point implementation over to integer calculations eons back. ...
    (comp.os.vms)