Tony Nixon wrote: > Test if a value is in a certain range > > W = value > > addlw 255 - Hi > addlw (Hi - Lo) + 1 > > Carry is set if W is in range Lo - Hi That can't possibly work! There aren't enough instructions! And I refuse to try it out to see if it works, since I know I'm right! Sorry, I couldn't resist. That's the sort of feedback I got when I posted this method here years ago. I normally use a macro for this, so that I don't have to remember the details. On the 12-bit core, there is no addlw instruction, so doing the equivalent requires a temporary register and three more instructions: movwf temp movlw 255-Hi addwf temp movlw (hi-lo)+1 addwf temp,w Cheers, Eric