Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

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

Status
Not open for further replies.

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.
 
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

  • FP52.ASM
    38.6 KB · Views: 513
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.
 
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
 
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).
 
  • Like
Reactions: 3v0
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top