LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Boolean Indicator shows -1 as True I.S.O 1

I connected several (400) boolean indicators to Datasocket on the front panel. When I receive data, 0 is treated as False (which is OK) and -1 is Treated as True. The same happens with controls. If I switch to True, it writes -1 to the Datasocket in stead of 1. My plc program cannot handle -1 as true. How do I get True = 1 in stead of True = -1. Using Labview 6.1
0 Kudos
Message 1 of 5
(2,994 Views)
Instead of transmitting a boolean, transmit analog values. Under Function Palette > Comparison use the Select function. Then Wire a 1 to the true and a 0 to the false.
0 Kudos
Message 2 of 5
(2,994 Views)
If I use Select, I'll have to use manual datasocket read and writes. I want to link the controls to datasocket on the front panel to Publish And Subscribe it. If I code this, when do I read and when do I write? And to do that for 400 controls? Isn't this a bug in Labview since -1 is supposed to be 32 x True?
0 Kudos
Message 3 of 5
(2,994 Views)
Output the Select result to an indicator, and select the indicator for
datasocket publishing - oz

tfd a écrit:

>If I use Select, I'll have to use manual datasocket read and writes.
>I want to link the controls to datasocket on the front panel to
>Publish And Subscribe it. If I code this, when do I read and when do I
>write? And to do that for 400 controls? Isn't this a bug in Labview
>since -1 is supposed to be 32 x True?
>
>
0 Kudos
Message 4 of 5
(2,994 Views)
> front panel. When I receive data, 0 is treated as False (which is OK)
> and -1 is Treated as True. The same happens with controls. If I
> switch to True, it writes -1 to the Datasocket in stead of 1. My plc
> program cannot handle -1 as true. How do I get True = 1 in stead of
> True = -1. Using Labview 6.1

LV stores Booleans in a byte, which can have 256 different values. 0 is
FALSE, and everything else is read as TRUE, same as C/c++ and many other
languages. If LV is producing a Boolean, it always produces 0 and 1,
and you shouldn't see it producing other values for Booleans.

I think the problem here is that the publisher of the value is
DataSocket rather than LV. Hopefully there is a way to control this,
but I'm not aware of it.

Greg McKaskle

0 Kudos
Message 5 of 5
(2,994 Views)