Less than an hour response time from the guy who wrote it... I can't think of a better justification for selecting a product. --- James Newton mailto:jamesnewton@geocities.com 1-619-652-0593 http://techref.massmind.org NEW! FINALLY A REAL NAME! Members can add private/public comments/pages ($0 TANSTAAFL web hosting) -----Original Message----- From: pic microcontroller discussion list [mailto:PICLIST@MITVMA.MIT.EDU]On Behalf Of Clyde Smith-Stubbs Sent: Wednesday, March 22, 2000 02:55 To: PICLIST@MITVMA.MIT.EDU Subject: Re: 16-bit arithmetic in C On Wed, Mar 22, 2000 at 02:38:16AM , Michael Rigby-Jones wrote: > It certainly would make a neat macro if it worked. However, I've just tried > it on V7.85, compiling for a 16F877 with maximum optimisation and it got > it's knickers in a twist: You didn't show your C code, but here's what I tried: ;x.c: 7: count = (CCPR1H << 8) + CCPR1L; movf 22,w ;volatile movwf _count+1 movf 21,w ;volatile movwf _count Looks fine to me. Of course, the other (better) way to do it, which works since CCPR1L and CCPR1H are adjacent and in the right order, is this static unsigned int CCPR1 @ 0x15; Now you can just use it directly. Regards, Clyde PS - Mick, I don't think Clive James reads the PIClist. -- Clyde Smith-Stubbs | HI-TECH Software Email: clyde@htsoft.com | Phone Fax WWW: http://www.htsoft.com/ | USA: (408) 490 2885 (408) 490 2885 PGP: finger clyde@htsoft.com | AUS: +61 7 3355 8333 +61 7 3355 8334 --------------------------------------------------------------------------- HI-TECH C: compiling the real world.