No announcement yet.

Testing DWord bit value.

  • Filter
  • Time
  • Show
Clear All
new posts

  • Testing DWord bit value.

    I took over a project that uses a Do-More H2DM1E to monitor 112 inputs in an alarm annunciator system; when an input goes true, the controller sends out the appropriate message from a SL variable determined by that input. As the program is written now, each input is de-bounced and assigned a C coil to call that message. All those are ORed together to set an alarm bit and subsequently NANDed together to reset the bit. When I received the project, there were only 17 inputs wired in and the code was already getting unwieldy. I thought of casting the inputs into DWords and using bit ENCODE and a little math to determine which message to call from a View-Marq message list. This works great if there is only one alarm but I haven't come up with an efficient way to determine ALL the active bits and display them in sequence. Any ideas?

  • #2
    Using a For Loop with Indirect Addressing on sequential bits or a One Dimensional Table using a pointer may work for this.

    Step through the list of bits and check for alarms.
    Add up alarms to show none made or at least one made for a reset bit.

    Additional One Dimensional Tables with the same pointer in logic could be used to track whether or not the alarm has been sent to a View-Marq message, assign levels of urgency, count number of alarms, etc.


    • #3
      Thanks RogerR ! That sounds way easier than the math routines I had planned to use.


      • #4
        Glad to help...