Comparing a tag of bools to = zero

Softy

Member
Join Date
Oct 2010
Location
England
Posts
16
Hello all. I have various tags that are of a UDT type consisting of a number of bools. What's the easiest way to check to see that all these bools are off?

I.E. Tag name "Conv1_Faults" of UDT type ConveyorFaults

ConveyorFaults UDT layout;

Name Data Type Description
DI Bool Drive Isolator
OLoad Bool Overload
MCB Bool Motor Circuit Breaker
etc...

Now, I can't do a standard EQU because it needs a INT/DINT or the like. Some of these tags use UDTs that are 20+ bools long, so I am after something quicker (and better looking) than a row(s) of normally closed contacts. I'm sure it must be easy, but can't for the life of me see the wood for the trees at the moment on this one.

TIA
 
Unless the booleans are in an array or unless they are individual bits on a DINT then you can't mass compare them to a number. You will have to either check them individually or copy them into a DINT and then compare the DINT.

You could restructure your UDT to use a bit overlay. That way your booleans are named bits in a DINT. Bit overlays are a powerful feature for UTDs. However they have one big disadvantage: An overlay UDT cannot be edited in RSLogix 5000, it must be imported from an XML file. Here is an example of a bit overlay xml file that if imported to UDTs will create a UTD containing two integers named STATE and TRANS. STATE and TRANS can be treated as any other integer with math, compare, MOV, etc. But each bit also has a name, eg Tagname.State_1 is the same bit as Tagname.State.0. Check the AB KB for more information on overlays if you decide to use them.


Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<RSLogix5000Content SchemaRevision="1.0" SoftwareRevision="16.03"  TargetType="DataType" ContainsContext="true" Owner="Alaric"  ExportDate="Mon Jul 07 14:39:05 2008" ExportOptions="Context">
<Controller Use="Context" Name="C4_50266KN_PRESS">
<DataTypes Use="Context">
<DataType Use="Target" Name="STATE" Family="NoFamily" Class="User">
<Members>
<Member Name="STATE_NO" DataType="DINT" Dimension="0" Radix="Decimal" Hidden="false"/>
<Member Name="STATE" DataType="INT" Dimension="0" Radix="Decimal" Hidden="false"/>
<Member Name="NOT_DEFINED" DataType="BIT" Dimension="0" Radix="Decimal" Hidden="false" Target="STATE" BitNumber="0"/>
<Member Name="STATE_1" DataType="BIT" Dimension="0" Radix="Binary" Hidden="false" Target="STATE" BitNumber="1"/>
<Member Name="STATE_2" DataType="BIT" Dimension="0" Radix="Binary" Hidden="false" Target="STATE" BitNumber="2"/>
<Member Name="STATE_3" DataType="BIT" Dimension="0" Radix="Binary" Hidden="false" Target="STATE" BitNumber="3"/>
<Member Name="STATE_4" DataType="BIT" Dimension="0" Radix="Binary" Hidden="false" Target="STATE" BitNumber="4"/>
<Member Name="STATE_5" DataType="BIT" Dimension="0" Radix="Binary" Hidden="false" Target="STATE" BitNumber="5"/>
<Member Name="STATE_6" DataType="BIT" Dimension="0" Radix="Binary" Hidden="false" Target="STATE" BitNumber="6"/>
<Member Name="STATE_7" DataType="BIT" Dimension="0" Radix="Binary" Hidden="false" Target="STATE" BitNumber="7"/>
<Member Name="STATE_8" DataType="BIT" Dimension="0" Radix="Binary" Hidden="false" Target="STATE" BitNumber="8"/>
<Member Name="STATE_9" DataType="BIT" Dimension="0" Radix="Binary" Hidden="false" Target="STATE" BitNumber="9"/>
<Member Name="STATE_10" DataType="BIT" Dimension="0" Radix="Binary" Hidden="false" Target="STATE" BitNumber="10"/>
<Member Name="STATE_11" DataType="BIT" Dimension="0" Radix="Binary" Hidden="false" Target="STATE" BitNumber="11"/>
<Member Name="STATE_12" DataType="BIT" Dimension="0" Radix="Binary" Hidden="false" Target="STATE" BitNumber="12"/>
<Member Name="STATE_13" DataType="BIT" Dimension="0" Radix="Binary" Hidden="false" Target="STATE" BitNumber="13"/>
<Member Name="STATE_14" DataType="BIT" Dimension="0" Radix="Binary" Hidden="false" Target="STATE" BitNumber="14"/>
<Member Name="STATE_15" DataType="BIT" Dimension="0" Radix="Binary" Hidden="false" Target="STATE" BitNumber="15"/>
<Member Name="TRANS" DataType="INT" Dimension="0" Radix="Decimal"/>
<Member Name="BEGIN_STATE_1" DataType="BIT" Dimension="0" Radix="Binary" Hidden="false" Target="TRANS" BitNumber="1"/>
<Member Name="BEGIN_STATE_2" DataType="BIT" Dimension="0" Radix="Binary" Hidden="false" Target="TRANS" BitNumber="2"/>
<Member Name="BEGIN_STATE_3" DataType="BIT" Dimension="0" Radix="Binary" Hidden="false" Target="TRANS" BitNumber="3"/>
<Member Name="BEGIN_STATE_4" DataType="BIT" Dimension="0" Radix="Binary" Hidden="false" Target="TRANS" BitNumber="4"/>
<Member Name="BEGIN_STATE_5" DataType="BIT" Dimension="0" Radix="Binary" Hidden="false" Target="TRANS" BitNumber="5"/>
<Member Name="BEGIN_STATE_6" DataType="BIT" Dimension="0" Radix="Binary" Hidden="false" Target="TRANS" BitNumber="6"/>
<Member Name="BEGIN_STATE_7" DataType="BIT" Dimension="0" Radix="Binary" Hidden="false" Target="TRANS" BitNumber="7"/>
<Member Name="BEGIN_STATE_8" DataType="BIT" Dimension="0" Radix="Binary" Hidden="false" Target="TRANS" BitNumber="8"/>
<Member Name="BEGIN_STATE_9" DataType="BIT" Dimension="0" Radix="Binary" Hidden="false" Target="TRANS" BitNumber="9"/>
<Member Name="BEGIN_STATE_10" DataType="BIT" Dimension="0" Radix="Binary" Hidden="false" Target="TRANS" BitNumber="10"/>
<Member Name="BEGIN_STATE_11" DataType="BIT" Dimension="0" Radix="Binary" Hidden="false" Target="TRANS" BitNumber="11"/>
<Member Name="BEGIN_STATE_12" DataType="BIT" Dimension="0" Radix="Binary" Hidden="false" Target="TRANS" BitNumber="12"/>
<Member Name="BEGIN_STATE_13" DataType="BIT" Dimension="0" Radix="Binary" Hidden="false" Target="TRANS" BitNumber="13"/>
<Member Name="BEGIN_STATE_14" DataType="BIT" Dimension="0" Radix="Binary" Hidden="false" Target="TRANS" BitNumber="14"/>
<Member Name="BEGIN_STATE_15" DataType="BIT" Dimension="0" Radix="Binary" Hidden="false" Target="TRANS" BitNumber="15"/>
</Members>
</DataType>
</DataTypes>
</Controller>
</RSLogix5000Content>
 
Last edited:
Hmm, thought that might be the case. I don't really want to play with the UDTs, as they aren't mine (I'm doing mods to a running machine). As you suggest, I think it best I COP them into DINT(s), then manipulate them. Tx.
 

Similar Topics

I’m running a micro 820 to measure a tank level, then turning on equipment at certain levels. I have an analog input (4-20) that I’m storing and...
Replies
10
Views
280
How do you go about implementing, on the M580 PLC, how many days, hours, minutes before a predefine event in the future? The RRTC_DT yields the...
Replies
3
Views
1,816
This is a Citect SCADA question I have Six variables of type REAL (Float) to compare and determine (identify) which variable has the highest...
Replies
4
Views
1,421
I have currently made a logic to read Serial input from a barcode scanner. The situation is that I need to read the barcode from the machine and...
Replies
5
Views
2,039
Hello, We are using Schneider SCADAPack 357 and Trimble Acutime 2000GPS. We are getting the data as a string(ASCII) from...
Replies
3
Views
1,477
Back
Top Bottom