Searching \ for '[PIC]: Hi-Tech C maths problem?' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: massmind.org/techref/microchip/math/index.htm?key=math
Search entire site for: 'Hi-Tech C maths problem?'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: Hi-Tech C maths problem?'
2000\11\17@064035 by JP.BROWN

flavicon
face
Hi Folks!, I am trying to use picclite to do a little maths on my pic i/o

I am using       #include <math.h>

then in main     float a, b=2, c=2; // simple test
                a=pow(b,c);        //

This compiles no trouble but when it links it produces lots of errors
similar to this:-

::Cant find 0x5B words(0x5B withtotal) for psect text0 in segment CODE

I am using a 16F84 and the default linker settings.

Anybody got any ideas what could be wrong?.
Is anyone successfully using maths functions on the 16F84?

Ta John

--
http://www.piclist.com hint: To leave the PICList
spam_OUTpiclist-unsubscribe-requestTakeThisOuTspammitvma.mit.edu


2000\11\17@110608 by JP.BROWN

flavicon
face
Thanks for that Andy, yes I tried compiling with some different maths
functions, the log(x) function uses 599 words and the sqrt(x) function
uses 573 words, I will have to think of something else, If I use any maths
functions using the 16F84 I won't have much room left for my program!.

On Fri, 17 Nov 2000, Andy Jancura wrote:

{Quote hidden}

         -----  John P. Brown      .....J.P.BrownKILLspamspam@spam@bradford.ac.uk ----
          \            --- Witty remark goes here ---         /
           --------------------------------------------------

--
http://www.piclist.com hint: To leave the PICList
piclist-unsubscribe-requestspamKILLspammitvma.mit.edu


2000\11\17@111229 by Scott Dattalo

face
flavicon
face
On Fri, 17 Nov 2000, JP.BROWN wrote:

> Thanks for that Andy, yes I tried compiling with some different maths
> functions, the log(x) function uses 599 words and the sqrt(x) function
> uses 573 words, I will have to think of something else, If I use any maths
> functions using the 16F84 I won't have much room left for my program!.

Well, you could use integer arithmetic instead of floating. What's the
application?

--
http://www.piclist.com hint: To leave the PICList
.....piclist-unsubscribe-requestKILLspamspam.....mitvma.mit.edu


2000\11\17@113304 by JP.BROWN

flavicon
face
Hi Scott, the application will be producing a linear o/p from a variety of
sensors such LDRs etc. I am considering using a lookup table to do the
job.

----- John

On Fri, 17 Nov 2000, Scott Dattalo wrote:

> On Fri, 17 Nov 2000, JP.BROWN wrote:
>
> > Thanks for that Andy, yes I tried compiling with some different maths
> > functions, the log(x) function uses 599 words and the sqrt(x) function
> > uses 573 words, I will have to think of something else, If I use any maths
> > functions using the 16F84 I won't have much room left for my program!.
>
> Well, you could use integer arithmetic instead of floating. What's the
> application?

--
http://www.piclist.com hint: To leave the PICList
EraseMEpiclist-unsubscribe-requestspam_OUTspamTakeThisOuTmitvma.mit.edu


2000\11\18@103538 by Nikolai Golovchenko

flavicon
face
J.P. Brown wrote:
> Thanks for that Andy, yes I tried compiling with some different maths
> functions, the log(x) function uses 599 words and the sqrt(x) function
> uses 573 words, I will have to think of something else, If I use any maths
> functions using the 16F84 I won't have much room left for my program!.

This is way too much even for floating point!

I know for sure sqrt(x) takes 87 instructions for 24 bit
float using PIC16 instruction set. You can easily include
that in assembly as a C function, only conversion between
Microchip and IEEE floating point representation would be
required (it's just three instructions either way). The
routine (and conversion) is at http://www.piclist.com BTW, it was
debugged recently.

And log(x) might take around 200 instructions if implemented
using the CORDIC method. If you can tolerate ~0.05% error it
can be even smaller and faster with a 16 entries table. For
example, take a look at "[PIC]: [MATH] x^y routine
implementation" thread in September.

Good luck,
Nikolai

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


More... (looser matching)
- Last day of these posts
- In 2000 , 2001 only
- Today
- New search...