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

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.

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

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.

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

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

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

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

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.

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.

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.

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.

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

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.

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.

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.