A brief recap: Eric Smith posted the following bit of code which tests whether the value in W is in the range [loval-hival], inclusive: > addlw 256-hival > addlw (hival-loval)+1 > btfsc status,cf > goto inrange Adrian Kennard then posted a response which used twice as many lines of code to do exactly the same thing. Eric responded as follows: > If either of you had bothered to actually try my code, you would > have found that it works correctly, except that the 256 should > have been 255. This minor error resulted in the whole range being > offset by 1. At this point, Adrian still didn't get it. He wrote: > OK, post the correct code. > > You code may have an out by one error, but it must also be mising a > skip after the first addlw, otherwise the carry is entirely based on > the second addlw, overwriting the first addlw. Some examples might > be a good idea. Adrian: Before you embarrass yourself further, please take a moment to, as Eric suggested, "bother to actually try the code". It works perfectly. -Andy Andrew Warren - fastfwd@ix.netcom.com Fast Forward Engineering, Vista, California http://www.geopages.com/SiliconValley/2499