RE: 16-bit arithmetic in C

Sorry about the name cock-up Clyde.  How embarrasing.

OK, I've just tried this code:
#include <pic.h>

unsigned int count;

void main( )
{
        count = (CCPR1H << 8) + CCPR1L;
}

Compiled through MPLAB which produces the following command line:
C:\HT-PIC\BIN\PICC.EXE -Gmicrochip -O -Zg9 -D24 -16F877 -C -IC:\HT-PIC\INCLUDE -ASMLIST C:\HT-PIC\PROJECTS\MISC\TEST.C

This gives me:

        movf    22,w    ;volatile
        movwf   btemp+1
        clrf    btemp
        movf    21,w    ;volatile
        addwf   btemp,w
        movwf   _count
        movf    btemp+1,w
        btfsc   3,0
        incf    btemp+1,w
        movwf   _count+1

I was sure I must be doing something screwy here, so I have re-installed V8.75 just to make sure I had the right version and the results are the same.

Your idea of using it directly is superb, I just wouldn't have thought of that.  However it obviously only works in the minority of cases, a more general solution is needed for most jobs.

Regards

Mike Rigby-Jones