Markus Imhof email (remove spam text)
>I need to check that a value, which will be a slightly variable code value,
>is between an upper and a lower threshold (or not).
>Here is my problem: How do I check for a <0 (negative) value in a PIC register?
>Does anybody know? Is it possible? If not what am I going to do?
That depends on the encoding of your numbers - but if you use plain vanilla
8-bit unsigned integers (or chars), you can't check for negative numbers,
since they don't exist. But (at least, IIRC), there's one bit in the PIC
registers which indicates whether an underflow/overflow has occured during
an add/subtract operation - so you might just check for that bit.
Or, use the parallax compiler - IIRC (and don't confuse it with AMD), it
provides compare functions.
See also: www.piclist.com/techref/index.htm?key=negative+numbers
You must be a member of the
piclist mailing list
(not only a www.piclist.com member) to post to the