Discrete Value is a Signed Integer


#1

I’m new to the Opto22 world and in trying to familiarize myself with how it works I had a question. When using PAC Display I set up a simple switch that toggles back and forth. I assigned a numeric variable to the resulting value. When the switch is off, the variable is set to 0 but when it’s on the value is set to -1. I know I can use the Absolute function to remove the sign but why doesn’t it just give me a 1?

Thanks in advance.


#2

Good news, this is a configurable setting. The default is -1 but you can change it to +1 in PAC Display Config, select Configure > Runtime… then you’ll see a checkbox for “Send +1 for Discrete Integer Writes.”

Ta-da! As far as “why” the default is -1, that’s another story, and I have a whole post on “what is ‘true’?” but I suspect that’s more info that you really want…


#3

You’re the best, Mary! Thank you! The more I work with the SNAP-PAC system, the more I like it and your support is terrific.

Actually that’s not more info than I want. :-} Post the link, if you would. I’d like to take a look at it.

Dave


#4

Below find link to that “what’s true” post I mentioned, but reading over it now I realize I didn’t talk about why. (Short answer: -1 was “true” back w/our older products, and we like to make your transitions to new hardware as easy as possible, even though we’re becoming even more “positive” as we mature…)
:wink:
Anyway, thanks for the kind words!!! Here’s the TMI, since you asked…


#5

Interesting. Some good tips there. In my case I’m writing to a modbus device which needs either a 1 or a 0 turn turn a valve on and off. It ignores everything else.

Dave