All the PIC's have 8 bit ALU's. So the maximum number you can handle in any *one* operation is 255. To perform 16 bit and above operations, you simply have to work on the numbers a byte at a time. Numbers larger than 8 bits are stored in successive memory locations.
There are hundreds of examples of 16 bit math operations on the web. Myke Predko has a nice page at http://www.myke.com/PICMicro/16bit.htm
Regards
Mike Rigby-Jones
-----Original Message-----
From: Lorick [SMTP:lorick@AIR.ON.CA]
Sent: Thursday, February 03, 2000 8:41 AM
To: PICLIST@MITVMA.MIT.EDU
Subject: General calculation type question
Well I just flipped through the pages of the 16F876 data sheet and didn't
find anything to give insight into this (maybe because it's late and my eyes
hurt) but this should be a question that someone can easily answer.
What is the data path size of the ALU? ie how many bits at a time can be
used in calculations?
With 8 bits I can calculate using decimal numbers up to 255, but what
happens when I want to multiply 255 by 255 (square a number) which is
somewhere over decimal 65000 I think, however many bits that would
take....can I do that with no worries? I don't really need any final
results larger than decimal 255 I think, after all my calculations are done,
so I'm ok for moving 8 bits to the output ports in the end, but what I'm
doing is having 2 separate numbers each between 0 and 255 decimal, and I
want to add, multiply , subtract, and divide with them where I'll need
numbers up around 65000 decimal and eventually those numbers reduce back
down below 255 and I get my analysis final result.
So if I have 16 bits available for math operations in the PIC, I can use up
to decimal 65535 (or is that 65536?) either way my intermediate numbers fall
within 16 bits and I'm hoping I can do this.