Truncated match.
PICList
Thread
'Math, part II'
2000\02\01@011715
by
Phu T. Van

Thanks for all your help. I think part (most/all?) of my dilema lies in
the fact that I'm using the PIC, smallish in both memory and raw
processing power. But I'm also lacking a very fundamental thing : the
knowledge of how to do elementary math with the PIC's very limited
insruction set, specifically its bitwise operations.
How do you, for example :
Multiple/divide ?
Calculate exponents ?
Anything taught in Elementary Algebra ?
Is it futile to hope that previous PIC gurus had written concise,
dummyoriented tutorials on how to do these operations ? Obviously
someone has had to multiply and divide with a PIC once in their life. It
frustrates me slightly that I can't do these basic things, even though
it appears to me that PIC programs follow the formula :
code,code,code,miracle,code.
Thanks again.
Phu T. Van
P.S. : I've dug up some information on the CORDIC algorithm. Is there
any way to implement it (painlessly, if possible) on the 16F84 ? The
page claimed it was successfully used on the Basic Stamp II, which is I
think more powerful than the PIC.
2000\02\01@013801
by
Dennis Gearon
There's some kind of math that starts with the name "Discrete.....", and
I hear it's really good for us programmers. I'll eventually take it.


Time Spent With Your Dog(Kid) is Time Well Spent

Sincerely, Dennis Gearon
2000\02\01@041254
by
James Harris

You might want to try something like microEngineering
Labs' PIC Basic or something similar (if there is
anything similar).
PIC Basic can take code written for the Basic Stamp I
and compile it for a PIC, it is very easy to get to
grips with as the language is effectively PBASIC.
Hope this helps!
 "Phu T. Van" <spam_OUTtuxTakeThisOuTL7.NET> wrote:
{Quote hidden}> Thanks for all your help. I think part (most/all?)
> of my dilema lies in
> the fact that I'm using the PIC, smallish in both
> memory and raw
> processing power. But I'm also lacking a very
> fundamental thing : the
> knowledge of how to do elementary math with the
> PIC's very limited
> insruction set, specifically its bitwise
> operations.
> How do you, for example :
> Multiple/divide ?
> Calculate exponents ?
> Anything taught in Elementary Algebra ?
>
> Is it futile to hope that previous PIC gurus had
> written concise,
> dummyoriented tutorials on how to do these
> operations ? Obviously
> someone has had to multiply and divide with a PIC
> once in their life. It
> frustrates me slightly that I can't do these basic
> things, even though
> it appears to me that PIC programs follow the
> formula :
> code,code,code,miracle,code.
>
> Thanks again.
> Phu T. Van
> P.S. : I've dug up some information on the CORDIC
> algorithm. Is there
> any way to implement it (painlessly, if possible) on
> the 16F84 ? The
> page claimed it was successfully used on the Basic
> Stamp II, which is I
> think more powerful than the PIC.
>
__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com
2000\02\01@054133
by
Roland Andrag
Get hold of the microchip Embedded control handbook  it contains a couple
of application notes (like AN526  PIC16C5X / PIC16Cxxx Math utility
routines and AN544  Math utility routines PIC17Cxx) with code for
multiply/divide, numerical integration/differentiation and square root.
The application notes can also be found as .pdf files on the microchip
website.
Cheers
Roland
{Original Message removed}
2000\02\01@061805
by
paulb
Phu T. Van wrote:
> The page claimed it was successfully used on the Basic Stamp II, which
> is I think more powerful than the PIC.
That's a rather convoluted statement there. It equates to the novel
proposal that the (original) IBM PC is more powerful than an Intel 8088
chip. ;)
Perhaps if you have the Stamp code, you should examine the exposition
at http://www.dontronics.com/convert.html or perhaps a demo version of
PicBasic as someone else suggested, could convert it to Assembler for
you.

Cheers,
Paul B.
2000\02\01@100713
by
Terry A. Steen
I am forced to agree.. I used the apnotes math package , it worked great.
You will want to change all the EQUs to cblocks before you use it.
Terry
At 12:38 PM 2/1/2000 +0200, Roland Andrag wrote:
{Quote hidden}>Get hold of the microchip Embedded control handbook  it contains a couple
>of application notes (like AN526  PIC16C5X / PIC16Cxxx Math utility
>routines and AN544  Math utility routines PIC17Cxx) with code for
>multiply/divide, numerical integration/differentiation and square root.
>
>The application notes can also be found as .pdf files on the microchip
>website.
>
>Cheers
> Roland
>
>{Original Message removed}
2000\02\01@103152
by
wagner

Reporting the facts is not a simple task, and sometimes people doesn't
get it easily or nicely.
Elementary school teachers show day by day examples about how to do math
operations, kids are enforced to learn as soon as possible how to do
math. The same math principles are used later on using a pencil, pen,
calculator or even in a computer language.
There is no "magic" or "miracle" in coding, what happens is that it
takes time to learn. To produce a blinking LED routine can take weeks
for someone who never did it, by the other side, to write a complex math
formula in assembler can take few hours for an experienced programmer.
All it means is experience, and it should not be confused with using
other's people expertise.
I already saw few examples in my students, when they copy someone else's
code and they learn a lot with it, but normally it doesn't happen, since
they still needing to do it again and again. The point here is "show me
how to land in mars and I would do it nicely" does not deserve any
merit, but "show me how to walk, and I will run" does it.
I see a common problem in programming; People wants to produce a large
program at once, as for example the novice software writer for the
"blinking LED", suddenly wakes up at morning and decides to produce a
complex math routine, and it needs to be done today, if not he will get
very frustrated. Everyone should see its own limits as an "opportunity"
to learn more, not as an enclosure.
There is no magic, multiplication in *any* processor is done by
following the same rules you use when doing with a paper and pencil,
except if has internal mul function, and even so, it does the same way
internally.
You are wrong when you say that you "can't do these things", for sure
you CAN do, you just "don't know how to do it" yet, and this takes time
to learn, as everything else in life.
Also remember that there are other microcontrollers at the market, some
of them save you lots of time because they have other internal
functions, as for example, "why spent time to write code to simulate an
UART, if chips with internal UART are available at the same price?", the
answer is "knowledge, hobby, passion".
If you don't have time, if the chip has not the required power, not fast
enough, don't have the required functions or capabilities, you have few
time to decide what to do, and the answer would always be; Choose a
better chip, or hire somebody to do it for you.
The learning process involves to see beyond the horizon, take a look at
Motorola, Atmel, Philips and other manufacturers.
Wagner.
"Phu T. Van" wrote:
{Quote hidden}> Is it futile to hope that previous PIC gurus had written concise,
> dummyoriented tutorials on how to do these operations ? Obviously
> someone has had to multiply and divide with a PIC once in their life. It
> frustrates me slightly that I can't do these basic things, even though
> it appears to me that PIC programs follow the formula :
> code,code,code,miracle,code.
>
> Thanks again.
> Phu T. Van
> P.S. : I've dug up some information on the CORDIC algorithm. Is there
> any way to implement it (painlessly, if possible) on the 16F84 ? The
> page claimed it was successfully used on the Basic Stamp II, which is I
> think more powerful than the PIC.
2000\02\01@111527
by
Scott Dattalo

On Mon, 31 Jan 2000, Phu T. Van wrote:
> Thanks for all your help. I think part (most/all?) of my dilema lies in
> the fact that I'm using the PIC, smallish in both memory and raw
> processing power. But I'm also lacking a very fundamental thing : the
> knowledge of how to do elementary math with the PIC's very limited
> insruction set, specifically its bitwise operations.
> How do you, for example :
> Multiple/divide ?
For 12 and 14 bit cores, you're confined to shiftandadd algorithms for
multiplications. For the 16 bit cores, there's a hardware multiply. But it
only multiplies 8bit numbers to produce a 16bit result. For division, all
pics are limited to shift and subtract. If you're dividing by a constant,
then you may take the appropriate scaled reciprocal and multiply instead.
Another trick I often employ for division is:
N N / / e \ / e \2 / e \3 \
 =  *  1   +    + ... 
v + e v \ \ v / \ v / \ v / /
The trick is that you can split denominator into a sum. One of those
numbers is easy to divide into N (e.g. a power of two). The other is
multiplied. If e is large compared to v, then the series converges
rapidly.
> Calculate exponents ?
I like Feynmann's method.
> Anything taught in Elementary Algebra ?
Hmmm. I'm not sure what you mean here. I'd suggest lurking on this list,
wade through all the bull shit, and save those gems that pop up from time
to time.
> P.S. : I've dug up some information on the CORDIC algorithm. Is there
> any way to implement it (painlessly, if possible) on the 16F84 ? The
> page claimed it was successfully used on the Basic Stamp II, which is I
> think more powerful than the PIC.
A completely painless way to implement CORDIC algorithms on a pic is to
not. Pics are far better with look up tables. And almost every problem
that involves math and the pic can be restructured to use tables. If you
don't think so, then ask a question on the list and you'll get an answer
showing you how.
If you find your self doing a whole lot of simple algebra with a pic, then
I'd suggest investing in a C compiler.
Scott
2000\02\01@114156
by
Alan King

P.S. : I've dug up some information on the CORDIC algorithm. Is there
any way to implement it (painlessly, if possible) on the 16F84 ? The
page claimed it was successfully used on the Basic Stamp II, which is I
think more powerful than the PIC.
First off, you're confusing your lack of knowledge about how to do it in
PIC assembly (or other language) with a limitation of the PIC. The basic
stamp 2 is done with the scenix processor, which is a fast PIC for the most
part. It IS coded like a PIC internally though, so of course it can be done
on a PIC. And most of it's speed (it's only advantage over any other PIC)
is wasted doing the Basic interpreting. Someone else has done some of the
work for you by doing the math routines for you for Basic, but the only
reason you would see that as being more 'powerful' is because you don't know
how to do it in assembly. A limit of you, not the PIC.
Considering how many good websites there are out there, you can't have
looked hard, so it's a bit difficult to see how you're frustrated already at
not knowing how and finding examples..
www.geocities.com/SiliconValley/Way/5807/dat.html
Go down to the applications section, there is even cordic info in the
communications section..
Alan
"Phu T. Van" wrote:
{Quote hidden}> Thanks for all your help. I think part (most/all?) of my dilema lies in
> the fact that I'm using the PIC, smallish in both memory and raw
> processing power. But I'm also lacking a very fundamental thing : the
> knowledge of how to do elementary math with the PIC's very limited
> insruction set, specifically its bitwise operations.
> How do you, for example :
> Multiple/divide ?
> Calculate exponents ?
> Anything taught in Elementary Algebra ?
>
> Is it futile to hope that previous PIC gurus had written concise,
> dummyoriented tutorials on how to do these operations ? Obviously
> someone has had to multiply and divide with a PIC once in their life. It
> frustrates me slightly that I can't do these basic things, even though
> it appears to me that PIC programs follow the formula :
> code,code,code,miracle,code.
>
> Thanks again.
> Phu T. Van
> P.S. : I've dug up some information on the CORDIC algorithm. Is there
> any way to implement it (painlessly, if possible) on the 16F84 ? The
> page claimed it was successfully used on the Basic Stamp II, which is I
> think more powerful than the PIC.
2000\02\01@115841
by
Bill Pierce

<xflowed>Look at the Dontronics site for the the PIC sourcebook. It's free and
includes a bunch of examples.
http://www.dontronics.com/see.html
There are examples for elementary muliplication and division, look under the
sections "Let x1 = y / z" and "Let x1 = y * z". The examples are in asm.
Bill
{Quote hidden}>From: "Phu T. Van" <
.....tuxKILLspam@spam@L7.NET>
>ReplyTo: pic microcontroller discussion list <
PICLISTKILLspamMITVMA.MIT.EDU>
>To:
.....PICLISTKILLspam.....MITVMA.MIT.EDU
>Subject: Math, part II
>Date: Mon, 31 Jan 2000 22:03:19 0800
>
>Thanks for all your help. I think part (most/all?) of my dilema lies in
>the fact that I'm using the PIC, smallish in both memory and raw
>processing power. But I'm also lacking a very fundamental thing : the
>knowledge of how to do elementary math with the PIC's very limited
>insruction set, specifically its bitwise operations.
>How do you, for example :
>Multiple/divide ?
>Calculate exponents ?
>Anything taught in Elementary Algebra ?
>
>Is it futile to hope that previous PIC gurus had written concise,
>dummyoriented tutorials on how to do these operations ? Obviously
>someone has had to multiply and divide with a PIC once in their life. It
>frustrates me slightly that I can't do these basic things, even though
>it appears to me that PIC programs follow the formula :
>code,code,code,miracle,code.
>
>Thanks again.
>Phu T. Van
>P.S. : I've dug up some information on the CORDIC algorithm. Is there
>any way to implement it (painlessly, if possible) on the 16F84 ? The
>page claimed it was successfully used on the Basic Stamp II, which is I
>think more powerful than the PIC.
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
</xflowed>
2000\02\01@162654
by
hgraf
> There's some kind of math that starts with the name "Discrete.....", and
> I hear it's really good for us programmers. I'll eventually take it.
Well I'm taking a course called "Discrete Mathematics" and I must say it
has NO resemblance to ANY other math course I have EVER taken! As for
programming, hmmm.... not really, alot of the stuff that pertains to
programming in this course so far was covered in an earlier course I took
(Digital Systems). Mind you I am not even half way through, perhaps more is
coming. TTYL
More... (looser matching)
 Last day of these posts
 In 2000
, 2001 only
 Today
 New search...