piclist 1995\12\08\091739a >
Thread: Negative numbers?
www.piclist.com/techref/index.htm?key=negative+numbers
flavicon
face BY : 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?
>

Hi Steve,

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.

Bye
 Markus
<9512081416.AA25537@MIT.EDU>

See also: www.piclist.com/techref/index.htm?key=negative+numbers
Reply You must be a member of the piclist mailing list (not only a www.piclist.com member) to post to the piclist. This form requires JavaScript and a browser/email client that can handle form mailto: posts.
Subject (change) Negative numbers?

month overview.

new search...