Looking at Boolean Arrays - Logix5000

Unfortunately the Rockwell boolean array is limited in which instructions take it as source and destination operands. There is a well-documented work-around to embed the boolean array in a user defined type (UDT), and then copy a tag of that UDT into a fully functional array of a native type (e.g., DINT array).

Rockwell documents it here (Tech Connect): Using File Type Instructions on Boolean Arrays

You could do this, but -- and this is a big "but" -- it will require every reference of the ALARMS array in the program to be modified for slightly different tag syntax. Also, you would not want to do this if the ALARMS array is externally referenced by an HMI or some other application (unless you modify that too).

But if you only have a reasonable number of rungs to change, and can do that when your system is not running (i.e., not generating alarms), the attached screen shots show one approach.

There is a user defined type udtBoolArray512, with one member named "B" that is of type BOOL[512].

There is a tag named uALARMS which is of the type udtBoolArray512. (It could just be named ALARMS, but then it would conflict with your existing tag with that same name.)

The search logic copies that UDT into an array of DINTs, in this case with a length of at least 16 to contain the whole UDT. Once the data is in the DINT array, all of the file instructions are available. This example shows a FAL approach to searching for any non-zero bit in the BOOL array. There are others like FBC which give more information.

The test rungs above the FAL show how to address the new alarm bits. For example, ALARMS[200] would be replaced by uALARMS.B[200] with the new tag naming.

This approach may not be applicable in your circumstance due to the re-addressing requirement, but maybe worth considering.

(Repost with corrected array length and attachments.)

udt definition.jpg tag properties.jpg search logic.jpg
 
I am the lazy type, I use pointers whenever I can get away with it :)

If this is the case here, then it would be pretty simple to setup


Maybe I don't understand, I was envisioning something like this


1. ALARM_ROUTINE: only called from a scheduled routine; neither scheduled nor free-running.


Code:
### Inputs:  DINT INDIRECT_ADDRESS - index in ALARMS of alarm to check
###          BOOL IS_SET - updated state of current alarm
###
### Outputs:  BOOL ANY_ALARM - 0 if no alarms are set; else 1
###
### Internal: DINT ALARM_COUNT - count of current alarms (1 bits)


### Rung 0:  Return if bit has not changed (nothing to do)

     ALARMS[INDIRECT_ADDRESS]     IS_SET
--+----------] [--------------------] [-----+---[Return]
  |                                         |
  |  ALARMS[INDIRECT_ADDRESS]     IS_SET    |
  +----------]/[--------------------]/[-----+


### Rung 1:  Assume alarm is being turned off
                                     __________________
------------------------------------[SUB               ]---
                                    [SrcA  ALARM_COUNT ]
                                    [SrcB  1           ]
                                    [[U]Dest  ALARM_COUNT [/U]]


### Rung 2:  Handle case where alarm is being turned on
###          - Including correction of assumption of Rung 1

  IS_SET       __________________
---] [----+---[ADD               ]---+---
          |   [SrcA  ALARM_COUNT ]   |
          |   [SrcB  2           ]   |
          |   [[U]Dest  ALARM_COUNT [/U]]   |
          |                          |
          | ALARMS[INDIRECT_ADDRESS] |
          +---------( )--------------+


### Rung 3:  set output ANY_ALARM

    __________________      ANY_ALARM
---[GRT               ]--------( )------
   [SrcA  ALARM_COUNT ]
   [[U]SrcB  0           [/U]]
2. Then, every place in scheduled routines where an alarm might occur, e.g. mold temperature is too high, do something like this:


Code:
### Rung N - Branch 0:  Alarm logic; assign 1 or 0 to alarm routine input IS_SET
###        - Branch 1:  Assign pointer to alarm routine input INDIRECT_ADDRESS
###        - Branch 2:  Call ALARM_ROUTINE

        ___________________            IS_SET
---+---[GRT                ]------------( )-----------+---
   |   [SrcA  MOLD_TEMP    ]                          |
   |   [[U]SrcB  MOLD_HI_TEMP [/U]]                          |
   |                       _______________________    |
   +----------------------[MOV                    ]---+
   |                      [Src   415              ]   |
   |                      [[U]Dest  INDIRECT_ADDRESS [/U]]   |
   |                                                  |
   +----------------[JSR:  ALARM_ROUTINE]-------------+
Is that not something like what you did?
 
Last edited:

Similar Topics

Hi , Where i can find Mitsubishi PLC Card end of line & replacement model details. i am looking for Q02CPU replacement model. Please advice. thanks
Replies
2
Views
145
I have Allen Bradley plcs, I have had Circuit breakers and other automation equipment in the past. There's no solid buyers local. How much do you...
Replies
2
Views
218
can anyone has a good program to learn plc programming online. i have the basic looking into improve my skills thanks
Replies
1
Views
155
I want to monitor a couple signals in a place where there is no PLC but there is ethernet. I know I can use an AENTR or Flex I/O and a module but...
Replies
21
Views
805
I downloaded v24 for studio 5000 but can’t find where the download manager put it! Any help? I’ve done it before but can’t remember. Thanks
Replies
9
Views
399
Back
Top Bottom