EmbeddedRelated.com
Forums
Memfault Beyond the Launch

Floating Point numbers, Assembler

Started by makonmk December 27, 2005
Hi
I need simple,ready to compile, example with 'add' 'mul'
'sub' in
Assembler, for two or more floating, signed numbers. I use msp430f149.
I'd like convert float result to binary. Will I use only CNV_FL_BIN??

If anubody have this example please send mi to my e-mail makon@mako...






Beginning Microcontrollers with the MSP430

needy people should ask the Goverment for help :)
Alex



----- Original Message ----- 
From: "makonmk" <makon@mako...>
To: <msp430@msp4...>
Sent: Tuesday, December 27, 2005 2:36 AM
Subject: [msp430] Floating Point numbers, Assembler


> Hi
> I need simple,ready to compile, example with 'add'
'mul' 'sub' in
> Assembler, for two or more floating, signed numbers. I use msp430f149.
> I'd like convert float result to binary. Will I use only CNV_FL_BIN??
> 
> If anubody have this example please send mi to my e-mail makon@mako...
> 
> 
> 
> 
> 
> 
> 
> 
> .
> 
>  
> Yahoo! Groups Links
> 
> 
> 
>  
> 
> 
> 

 > I need simple,ready to compile, example with 'add'
'mul' 'sub' in
 > Assembler, for two or more floating, signed numbers. I use msp430f149.
 > I'd like convert float result to binary. Will I use only CNV_FL_BIN??

Most development tools comes with a set of floating-point 
implementations, you're better off using the one that is provided by 
your tool than to write your own.

However, the actual floating-point routines are considered "internal",

which means that you shouldn't call them directly from assembler. 
However, you can define a set of stub functions in C and call them, e.g.

// In C:

double add_double(double x, double y)
{
   return x + y;
}

// In assembler
      EXTERN add_double

      // Pass parameters to the C function (note: calling-convention
      // could vary between tools).
      MOV #xxx, R8
      ....
      MOV #zzz, R15
      CALL add_double


      -- Anders Lindgren, IAR Systems


-- 
Disclaimer: Opinions expressed in this posting are strictly my own and
not necessarily those of my employer.


Memfault Beyond the Launch