Re: Floating point calculations on 16 uC



In article <1125323242.505618.202750@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
cbarn24050@xxxxxxx says...
>
> 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.
> >
> > If anyone has had similar problems please let me know. Any advice when
> > using floating point calculations would be appreciated.
> >
> > Regards
> > Dieter
>
> You dont say what kind of garbage your getting. Stack overruns are easy
> to detect as it will trash your fixed variables starting from the
> highest 1 (check your map file). Sometimes you can have problems with
> far/near pointers. Compile useing the large model and see if your
> problem dissapears. If all else fails disable each interrupt
> individualy.

There is one rather ugly variant of stack overflow that I ran across many
moons ago (I've forgotten which compiler). That particular compiler used
space on the stack BEYOND the current stack pointer for floating point
storage, the net result of cource being that any interrupt was just about
assured of corrupting a floating point operation if it occurred during
the time that floating point calculation were down.

Thankfully I wasn't contemplating any floating point being used but
reading that ensured I din't even try.

Lesson learned, make sure you read your compiler manual. All of your
compiler manual.

If your compiler manual has a section of the floating point
implementation make sure you read it and understand what it's using for
storage. These sections often have notes on interactions with interrupts
and task switching.

Robert
.



Relevant Pages

  • Re: Floating point calculations on 16 uC
    ... >I'm doing floating point calculations on a Fujitsu MB90F474 16bit uC. ... It sounds like the stack is overwriting the ... I suspect that local variables for your floating point routines are what ...
    (comp.arch.embedded)
  • Re: Floating point calculations on 16 uC
    ... > I'm doing floating point calculations on a Fujitsu MB90F474 16bit uC. ... > interrupts are enabled. ... You dont say what kind of garbage your getting. ...
    (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)