# Program in assembly language for 8051 microcontroller that can perform floating point calculation

#### 2_Learn

##### New Member
Hello, How I can make a program in assembly language for the 8051 microcontroller that can perform floating point calculations?.
Excuse my English, I 'm Hispanic and I found this excellent forum and want to see if any of you could help me with this problem.
I need a way to perform calculations with floating point numbers, for example for a data acquisition system .
How can I do this? and if there is more than one way to do it?
Beforehand I thank you for your help.

#### Ian Rogers

##### User Extraordinaire
Forum Supporter
There are pre-written floating point libraries... I use the one supplied with ISIS... Its a BCD library for easy usage..

BUT!!! I normally use fixed point arithmetic and just write a print function...

#### Attachments

• 38.6 KB Views: 106

#### 2_Learn

##### New Member
There are pre-written floating point libraries... I use the one supplied with ISIS... Its a BCD library for easy usage..

BUT!!! I normally use fixed point arithmetic and just write a print function...
Thanks to you, I will try to do with this.

##### New Member
FP52.asm when downloaded and compiled, gives compilation errors for following reasons :-
it can't find the label "sndchr" and "BADPRM".
the code with errors is as below

Code:
r5out:
push    acc        ; me
mov    a,r5        ; me
call    sndchr        ; me
pop    acc        ; me
ret            ; me
;
SQ_ERR:    JMP    BADPRM        ; me

#### Nigel Goodwin

##### Super Moderator
There are pre-written floating point libraries... I use the one supplied with ISIS... Its a BCD library for easy usage..

BUT!!! I normally use fixed point arithmetic and just write a print function...
I would agree, floating point is only 'required' VERY rarely, far better to use fixed point and add the decimal point in the print routines.

Using floating point takes lot's of memory, is extremely slow, and is also inaccurate (compared with fixed point).

3v0