quieries related to math handling in micro controllers

hello folks.. I'm doing a project related to 8051 micro controller, it is required t handle floating point numbers to a great precision. is there any way with which this can be done easily with 8051 or is ther any mathematical controller that can do a better job? please let me know..

regards, yasha...

Reply to
yasha
Loading thread data ...

Floating-point numbers of any precision are just bits. An algorithm to manipulate them can be implemented on any architecture. However if your application requires lots of floating-point, given no further information, 8051 would seem to be an appallingly bad choice.

Reply to
larwe

Precision or dynamic range. Floating point numbers will give dynamic range but the same number of bits in a fixed point number will give more precision.

Regards,

-- Walter Banks Byte Craft Limited Tel. (519) 888-6911

formatting link
snipped-for-privacy@bytecraft.com

Reply to
Walter Banks

An 8051 is about the most inefficient processor you could think of for doing floating point. But if you are happy with extremely slow performance, then it will do the job - after all, pocket calculators have been made with 4-bit microcontrollers. If you are happy with speeds measured in flops, your 8051 will be fine. If you want speeds in kiloflops, get a proper microcontroller. If you want speeds in megaflops, get a processor with hardware floating point support.

Reply to
David Brown

Some questions:

- Why the 8051? How easy would it be for you to choose another device?

- What is the quantitative meaning of "great precision"?

- How many floating point operations do you need to perform each second? And how much other stuff does your micro need to do at the same time?

Reply to
Mike Silva

If the standard 4-byte float is sufficient for the "great precision", then you can use the floating point library which is supplied with just about any C compiler for x51.

If you have several kilobytes of ROM space and you don't mind few hundred CPU cycles per one floating point operation, the x51 would do.

Vladimir Vassilevsky DSP and Mixed Signal Design Consultant

formatting link

Reply to
Vladimir Vassilevsky

Any reasonable micro can do it to whatever precision you like (limited only by available RAM to store the numbers). Some of the operations are going to scale in required time by the number of bits squared, so if you need 64 or 128 bit mantissas you're going to wait a bit for the results, but it can be made to work.

Best regards, Spehro Pefhany

--
"it's the network..."                          "The Journey is the reward"
speff@interlog.com             Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog  Info for designers:  http://www.speff.com
Reply to
Spehro Pefhany

There are many 8051 derivatives. Many different speed of execution.

Do you already have your hardware ??

This site gives a few timings of their floating point operations.

formatting link

Using their chart, any speed up by using a faster 8051 processor can be calculated.

Have you spec'd out how fast you need float operations ?

You did do a design spec, didn't you ??

donald

Reply to
donald

formatting link

Has lots of link about floating point speed.

Reply to
donald

Some rehashing here:

What is "great precision"? Your "great precision" may be my "lousy precision", or visa-versa. If you need 32-bit floating point, then just about any C toolchain will give it to you. If you need 64-bit floating point, then you should be able to get that, too (but I'd check to see if 'double' is supported -- it should be, but it may have been left by the wayside). If you need more precision than 64 bits you'll probably have to find a numerical library that'll work, or write your own -- although you may luck out and find a toolchain that supports a 128-bit "long double".

What are your speed requirements? As mentioned, an 8051 is a slow old thing, even when it's being clocked fast. The more precision you implement, the slower it'll go.

It's not clear what you mean by "mathematical processor". If you're looking for a coprocessor to use with your 8051, I don't think anyone makes those any more -- there are too many good processors, and it's too easy to whip one up on an FPGA if you just _have_ to have a coprocessor. If you're looking for a processor that's faster at math than an 8051, then look at just about anything that's not an 8051.

--
Tim Wescott
Control systems and communications consulting
http://www.wescottdesign.com

Need to learn how to apply control theory in your embedded system?
"Applied Control Theory for Embedded Systems" by Tim Wescott
Elsevier/Newnes, http://www.wescottdesign.com/actfes/actfes.html
Reply to
Tim Wescott

While ago, in the course of PIC/AVR flame war, we tried the generic C implementation of the FFT as the floating point benchmark. IIRC the PIC16 appeared to be somewhat 20% slower then the AVR if compared to the same instruction rate. In the other words, the difference was not very significant. Probably the x51 would achieve the similar results if the instruction rate is the same.

Vladimir Vassilevsky DSP and Mixed Signal Design Consultant

formatting link

Reply to
Vladimir Vassilevsky

There's the uM-FPU from that supports single precision (32-bit IEEE 754). Some benchmarks at

Doesn't save orders of magnitude in time. Of course, that depends on the native processor's speed; an AVR at 16 MHz is probably a bit zippier than most members of the 8051 family. The code space savings may be the more significant in small micros, regardless of any speed differences.

--
Rich Webb     Norfolk, VA
Reply to
Rich Webb

Doing from scratch probably. I have a 8051 sbc from the magazine Elektor (European) that comes as kit, or loose board, with, guess what, a BASIC compiler. So some one has done all the work, and in principle it need not be replicated.

A diligent search of the Internet is bound to dig up something.

Albert

--

--
Albert van der Horst, UTRECHT,THE NETHERLANDS
Economic growth -- like all pyramid schemes -- ultimately falters.
albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst
Reply to
Albert van der Horst

Of course ten minutes' search could find a library in any language of choice that will do the required operations on an 8051. My point was that if you know your application requires floating-point, it is a cruel and unusual decision to select 8051 as your platform.

Reply to
larwe

32 bit Floating point package for 8051 Reference :- 1)
formatting link
2)
formatting link

Karthik Balaguru

Reply to
karthikbalaguru

Easily??? I'm not so sure. I've written super math packages for

8051. Lots of testing required. Get a good C compiler and see if the double implementation is good enough for you.

There are/were floating point math coprocessors but precision was about the same as double in C if I remember correctly.

Do you need all the functions in a FP math package or just a few? If just a few consider BCD. There are some BCD C libraries in the C users group I believe.

Interesting that no one has answered your question directly.

Keep us posted

Reply to
GMM50

I am doing a project related to nylon. It's required to handle rope of great length. Can this be done with nylon rope or or there some other kind of long rope that will do a better job?

Best regards, Spehro Pefhany

--
"it's the network..."                          "The Journey is the reward"
speff@interlog.com             Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog  Info for designers:  http://www.speff.com
Reply to
Spehro Pefhany

If you use a 32 bit integer to represent lengths in mm, then you can represent a maximum length of 4294967 meters, with a precision of

1mm. Most 8051 C compilers should be able to handle 32 bit integers. If you are using fairly short lenghts, but want better precision, then use lengths of micro meters. This will still give you a maximum length of 4294 meters.

Regards Anton Erasmus

Reply to
Anton Erasmus

Eh? 2^32-1 = 4294967295

+/- 0.5mm

Best regards, Spehro Pefhany

--
"it's the network..."                          "The Journey is the reward"
speff@interlog.com             Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog  Info for designers:  http://www.speff.com
Reply to
Spehro Pefhany

Yes that is in millimeters. Divide by 1000 to get meters, which gives

4294967 meters.

I did not say accuracy of 1mm. One can have an accuracy of +- 1m, and still have a precision of 1mm. It is of course silly to do this, but unfortunately it is quite a common tendency to equate accuracy and precision.

[Snipped]

Regards Anton Erasmus

Reply to
Anton Erasmus

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.