EmbeddedRelated.com
Forums

quieries related to math handling in micro controllers

Started by yasha February 29, 2008

Tim Wescott wrote:


> 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.
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 http://www.abvolt.com
On Fri, 29 Feb 2008 10:25:00 -0600, Tim Wescott <tim@seemywebsite.com>
wrote:

>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's the uM-FPU from <http://www.micromegacorp.com/index.html> that supports single precision (32-bit IEEE 754). Some benchmarks at <http://www.micromegacorp.com/downloads/documentation/AN041-Comparing%20WinAVR.pdf> 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
In article <cc5c59e3-7d64-4704-9da2-4b08dfaab77a@e23g2000prf.googlegroups.com>,
larwe  <zwsdotcom@gmail.com> wrote:
>On Feb 29, 7:28=A0am, "yasha" <yasha...@gmail.com> wrote: > >> I'm doing a project related to 8051 micro controller, it is required to >> handle floating point numbers to a great precision. >> is there any way with which this can be done easily with 8051 or is there > >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.
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
On Mar 1, 7:08=A0am, Albert van der Horst <alb...@spenarnc.xs4all.nl>
wrote:

> >your application requires lots of floating-point, given no further > >information, 8051 would seem to be an appallingly bad choice. > > 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
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.
On Feb 29, 5:28=A0pm, "yasha" <yasha...@gmail.com> wrote:
> hello folks.. > I'm doing a project related to 8051 micro controller, it is required to > handle floating point numbers to a great precision. > is there any way with which this can be done easily with 8051 or is there > any mathematical controller that can do a better job? > please let me know.. >
32 bit Floating point package for 8051 Reference :- 1) http://www.8052.com/users/Jerson/Float51.asm 2) http://www.8052.com/codelib/float51.asm Karthik Balaguru
On Feb 29, 5:28 am, "yasha" <yasha...@gmail.com> wrote:
> hello folks.. > I'm doing a project related to 8051 micro controller, it is required to > handle floating point numbers to a great precision. > is there any way with which this can be done easily with 8051 or is there > any mathematical controller that can do a better job? > please let me know.. > > regards, > yasha...
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
On Sat, 1 Mar 2008 13:01:39 -0800 (PST), the renowned GMM50
<gfm5050@gmail.com> wrote:

>On Feb 29, 5:28 am, "yasha" <yasha...@gmail.com> wrote: >> hello folks.. >> I'm doing a project related to 8051 micro controller, it is required to >> handle floating point numbers to a great precision. >> is there any way with which this can be done easily with 8051 or is there >> any mathematical controller that can do a better job? >> please let me know.. >> >> regards, >> yasha... > >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?
>Keep us posted
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
On Sat, 01 Mar 2008 18:27:15 -0500, Spehro Pefhany
<speffSNIP@interlogDOTyou.knowwhat> wrote:

>On Sat, 1 Mar 2008 13:01:39 -0800 (PST), the renowned GMM50 ><gfm5050@gmail.com> wrote: > >>On Feb 29, 5:28 am, "yasha" <yasha...@gmail.com> wrote: >>> hello folks.. >>> I'm doing a project related to 8051 micro controller, it is required to >>> handle floating point numbers to a great precision. >>> is there any way with which this can be done easily with 8051 or is there >>> any mathematical controller that can do a better job? >>> please let me know.. >>> >>> regards, >>> yasha... >> >>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? >
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
On Sun, 02 Mar 2008 19:49:46 +0200, the renowned Anton Erasmus
<nobody@spam.prevent.net> wrote:

>On Sat, 01 Mar 2008 18:27:15 -0500, Spehro Pefhany ><speffSNIP@interlogDOTyou.knowwhat> wrote: > >>On Sat, 1 Mar 2008 13:01:39 -0800 (PST), the renowned GMM50 >><gfm5050@gmail.com> wrote: >> >>>On Feb 29, 5:28 am, "yasha" <yasha...@gmail.com> wrote: >>>> hello folks.. >>>> I'm doing a project related to 8051 micro controller, it is required to >>>> handle floating point numbers to a great precision. >>>> is there any way with which this can be done easily with 8051 or is there >>>> any mathematical controller that can do a better job? >>>> please let me know.. >>>> >>>> regards, >>>> yasha... >>> >>>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? >> > >If you use a 32 bit integer to represent lengths in mm, then you can >represent a maximum length of 4294967 meters
Eh? 2^32-1 = 4294967295
>with a precision of 1mm.
+/- 0.5mm
>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 >
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
On Sun, 02 Mar 2008 13:44:12 -0500, Spehro Pefhany
<speffSNIP@interlogDOTyou.knowwhat> wrote:

>On Sun, 02 Mar 2008 19:49:46 +0200, the renowned Anton Erasmus ><nobody@spam.prevent.net> wrote: > >>On Sat, 01 Mar 2008 18:27:15 -0500, Spehro Pefhany >><speffSNIP@interlogDOTyou.knowwhat> wrote: >> >>>On Sat, 1 Mar 2008 13:01:39 -0800 (PST), the renowned GMM50 >>><gfm5050@gmail.com> wrote: >>> >>>>On Feb 29, 5:28 am, "yasha" <yasha...@gmail.com> wrote: >>>>> hello folks.. >>>>> I'm doing a project related to 8051 micro controller, it is required to >>>>> handle floating point numbers to a great precision. >>>>> is there any way with which this can be done easily with 8051 or is there >>>>> any mathematical controller that can do a better job? >>>>> please let me know.. >>>>> >>>>> regards, >>>>> yasha... >>>> >>>>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? >>> >> >>If you use a 32 bit integer to represent lengths in mm, then you can >>represent a maximum length of 4294967 meters > > >Eh? 2^32-1 = 4294967295
Yes that is in millimeters. Divide by 1000 to get meters, which gives 4294967 meters.
> >>with a precision of 1mm. > >+/- 0.5mm
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