>I have a need for a 16 bit counter which is decremented in my interrupt >service routine which is called every 10ms. It should be easy, I know, but >I cannot see the simple solution. I have written a test routine as follows:- Try this one: decloop: MOVWF lo_byte ; Get the low byte BTFSC STATUS,Z ; Check to see if its zero DECF hi_byte ; Its zero, decrement high byte. DECF lo_byte ; Decrement the low byte BTFSS hi_byte,7 ; Check for underflow GOTO decloop ; NOT done, keep on going. finished: ... ; do finish processing here. Some things to note: 1) The MOVWF instruction sets the zero bit. No need to do anything else. 2) The code works by testing the value in the low byte on entry, if its zero, then the high byte should be decremented as well, otherwise it skips the decrement high byte instruction. 3) The end of the loop is detected by an underflow of the counter, this is cheap to do (one instruction) but limits the counter to 15 bit values. If you really need 16 bits, change the sequence BTFSS hi_byte,7 ; check for underflow GOTO decloop ; NOT done, keep on going to be MOVF lo_byte,W ; move low byte into W IORWF hi_byte,W ; Or in the high byte BTFSS STATUS,Z ; Check the zero flag GOTO decloop ; continue (non-zero) It adds two instructions but that gives you a full 16 bits of resolution. Hope this helps, --Chuck