Keil Logo

A51: CREATING FLOATING-POINT CONSTANTS


Information in this article applies to:

  • C51 Version 5.50a
  • C51 Version 6.10a

QUESTION

Is there any method of specifying a floating point number in the A51 Assembler so that it will be stored in 4 byte IEEE floating point format within the code?

ANSWER

There is no easy way in the assembler to declare floating point numbers. However, it is easy to declare them in a C module, then compile and create an assembler source file. For example, the following C file:

#pragma SRC
code float j [] = { 1.1, 2.2, 3.3 };

Generates the following .SRC file when compiled:

NAME    J

?CO?J                SEGMENT CODE
        PUBLIC  j

        RSEG  ?CO?J
j:
        DB      03FH,08CH,0CCH,0CDH     ; 1.100000
        DB      040H,00CH,0CCH,0CDH     ; 2.200000
        DB      040H,053H,033H,033H     ; 3.300000

; code float j [] = { 1.1, 2.2, 3.3 };

You may either include this file in your assembler files or use it as an external table.

MORE INFORMATION

SEE ALSO

Last Reviewed: Friday, July 15, 2005


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.