Bob J. gmail.com> writes: > Silly question: > > Two variables, A containing -1 and b containing 1: > rega = b'11111111' > regb = b'00000001' > > rega is a signed integer, regb is unsigned. > > How do I do a comparision using cpfslt on these two? Do I just complement > rega then do the comparison? I don't believe this is correct, but maybe I > am not thinking it all the way through. rega obviously can be a positive > integer also so that would throw that out. So thinking aloud there, do I > check the sign bit then complement if its negative, then do the comparision? You must convert both to the same type, and it must be a type that computes correctly on binary (2's complement) substraction, i.e. not packed bcd or anything like that. The representation for a binary unsigned number lower than 128 is the same as a binary signed number larger than -1 and smaller than 128. So they are the same type and you just substract I think. The condition is regb < 128. If cpfslt is the macro shown here: http://www.staton.us/electronics/rc_servo/tmp1820c.asm then somthing like this should work: movlw rega cpfslt regb Peter P. -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist