> The basic comparison plan is always to subtract the numbers. So if we > are comparing A and B then we look at the result of A-B (and the STATUS > flags > C and Z) > > If A-B > 0 then A>B C=1 Z=0 > if A-B = 0 then A=B C=1 Z=1 > if A-B < 0 then A > So do the substraction, noting that on the PIC that SUBWF subtracts W > from F and not the other way around. I find it a bit error prone to figure out each time which way the sense of the subtract went, and then what the meaning of borrow is, and then keep in mind that the C flag is actually a not-borrow flag in that context. For this reason I have macros SKIP_WGT (Skip if W was Greater Than) and SKIP_WLE (Skip if W was Less than or Equal to). All you have to do is a SUBLW or SUBWF instruction followed by one of these macros. They alleviate the need for the mental gymnastics to get the sense of the C test right. I also have other macros that can be handy in this case, like SKIP_Z and SKIP_NZ. All these macros and lots more are in STD.INS.ASPIC at http://www.embedinc.com. ***************************************************************** Embed Inc, embedded system specialists in Littleton Massachusetts (978) 742-9014, http://www.embedinc.com -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads