¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Analog Comparison for signed integer?


 

I was trying to use everyone's favorite symbol, Analog Comparison (Full Set), to tell me when an analog signal was either positive, negative, or zero, but then I realized it is treating analogs as unsigned values. Needless to say, I was never getting an indication that the value was negative.

Is there a combination of symbols I could use instead for getting the results I'm looking for? I actually only need to know when the value is >= 0, or < 0.

TIA


 

Where are you getting the values from, self generated or from a device/feedback? And what is the range of values you're comparing?

--- In Crestron@..., "floyd1212" <floyd1212@...> wrote:

I was trying to use everyone's favorite symbol, Analog Comparison (Full Set), to tell me when an analog signal was either positive, negative, or zero, but then I realized it is treating analogs as unsigned values. Needless to say, I was never getting an indication that the value was negative.

Is there a combination of symbols I could use instead for getting the results I'm looking for? I actually only need to know when the value is >= 0, or < 0.

TIA


 

my values are generated with an INIT, and can range from -2d to 32d.

I just gave it some more thought, and I'm thinking I can compare my value to 32,768, instead of zero, and when my value is > 32,768 it is "negative", and when it is <= 32,768 it is either "positive" or 0d. Right?

--- In Crestron@..., "matt_rasmussen_2000" <mjrtoo@...> wrote:

Where are you getting the values from, self generated or from a device/feedback? And what is the range of values you're comparing?

--- In Crestron@..., "floyd1212" <floyd1212@> wrote:

I was trying to use everyone's favorite symbol, Analog Comparison (Full Set), to tell me when an analog signal was either positive, negative, or zero, but then I realized it is treating analogs as unsigned values. Needless to say, I was never getting an indication that the value was negative.

Is there a combination of symbols I could use instead for getting the results I'm looking for? I actually only need to know when the value is >= 0, or < 0.

TIA


 

There you go

--- In Crestron@..., "floyd1212" <floyd1212@...> wrote:

my values are generated with an INIT, and can range from -2d to 32d.

I just gave it some more thought, and I'm thinking I can compare my value to 32,768, instead of zero, and when my value is > 32,768 it is "negative", and when it is <= 32,768 it is either "positive" or 0d. Right?



--- In Crestron@..., "matt_rasmussen_2000" <mjrtoo@> wrote:

Where are you getting the values from, self generated or from a device/feedback? And what is the range of values you're comparing?

--- In Crestron@..., "floyd1212" <floyd1212@> wrote:

I was trying to use everyone's favorite symbol, Analog Comparison (Full Set), to tell me when an analog signal was either positive, negative, or zero, but then I realized it is treating analogs as unsigned values. Needless to say, I was never getting an indication that the value was negative.

Is there a combination of symbols I could use instead for getting the results I'm looking for? I actually only need to know when the value is >= 0, or < 0.

TIA


 

Although, take a look at the help file, I dont remember if the acomp has a signed/unsigned parameter.

--- In Crestron@..., "floyd1212" <floyd1212@...> wrote:

my values are generated with an INIT, and can range from -2d to 32d.

I just gave it some more thought, and I'm thinking I can compare my value to 32,768, instead of zero, and when my value is > 32,768 it is "negative", and when it is <= 32,768 it is either "positive" or 0d. Right?



--- In Crestron@..., "matt_rasmussen_2000" <mjrtoo@> wrote:

Where are you getting the values from, self generated or from a device/feedback? And what is the range of values you're comparing?

--- In Crestron@..., "floyd1212" <floyd1212@> wrote:

I was trying to use everyone's favorite symbol, Analog Comparison (Full Set), to tell me when an analog signal was either positive, negative, or zero, but then I realized it is treating analogs as unsigned values. Needless to say, I was never getting an indication that the value was negative.

Is there a combination of symbols I could use instead for getting the results I'm looking for? I actually only need to know when the value is >= 0, or < 0.

TIA


Chip
 

You could also use an ATOD symbol. Negative numbers are the only ones that have the highest bit set.

- Chip

--- In Crestron@..., "floyd1212" <floyd1212@...> wrote:

my values are generated with an INIT, and can range from -2d to 32d.

I just gave it some more thought, and I'm thinking I can compare my value to 32,768, instead of zero, and when my value is > 32,768 it is "negative", and when it is <= 32,768 it is either "positive" or 0d. Right?



--- In Crestron@..., "matt_rasmussen_2000" <mjrtoo@> wrote:

Where are you getting the values from, self generated or from a device/feedback? And what is the range of values you're comparing?

--- In Crestron@..., "floyd1212" <floyd1212@> wrote:

I was trying to use everyone's favorite symbol, Analog Comparison (Full Set), to tell me when an analog signal was either positive, negative, or zero, but then I realized it is treating analogs as unsigned values. Needless to say, I was never getting an indication that the value was negative.

Is there a combination of symbols I could use instead for getting the results I'm looking for? I actually only need to know when the value is >= 0, or < 0.

TIA