> > addlw 256-hival > > addlw (hival-loval)+1 > > btfsc status,cf > > goto inrange > > Now try w = 75, hival = 100, loval = 50 > > 75 + (256 - 100) = 231 > 231 + (100 - 50 +1) = 252 > which does not generate a carry. > > In both cases the starting value is in range. Did I miss something? What's 231+(100-50 +1) ?