Author Topic: Boolean Array  (Read 4462 times)

damon

  • Newbie
  • *
  • Posts: 8
    • View Profile
Boolean Array
« on: March 14, 2015, 01:11:28 PM »
I am having great success reading StringArrays[224] from a Controllogix Controller, but not having any success reading a BooleanArray[224].  I read an array of strings on Form Load (alarms) from the PLC and then trying to monitor an array of Booleans to display and track alarms within the application, but not having much success reading the boolean array..

Would you have a piece of sample code?

Thanks

damon

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Boolean Array
« Reply #1 on: March 15, 2015, 02:36:15 PM »
Works great..

Try
            Dim plcReadAlarms() As String = EthernetIPforCLXCom1.Read("OI.Strings[0]", 224)
Catch ex As Exception
            MsgBox(ex.Message)
            'Exit Sub
End Try

various slight modifications like Dim plcReadAlarms() as Boolean or even leaving it a string array to read a bool array do not work.

Anyone have working code to read to a boolean array?

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Boolean Array
« Reply #2 on: March 17, 2015, 01:48:55 PM »
I did find a problem with reading BOOL arrays. Working on fixing this for the next version.

btjiii

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Boolean Array
« Reply #3 on: March 23, 2015, 05:23:53 PM »
Anyone know of a work around that will work without changing the program?

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Boolean Array
« Reply #4 on: March 23, 2015, 05:31:59 PM »
Have you tried version 3.98b to see if it works with the BOOL array?

btjiii

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Boolean Array
« Reply #5 on: March 23, 2015, 05:41:12 PM »
Yes that's the one I'm using and I get " A first exception of type 'System.OverflowException' occurred in AdvandedHMIDrivers.dll " And " A first exception of type 'System.OverflowException' occurred in MfgControl.AdvancedHMIDrivers.dll. My address is ALARMHtest.A Thanks

btjiii

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Boolean Array
« Reply #6 on: March 23, 2015, 05:49:55 PM »
Opps Sorry need to adjust my glasses I'm using a I will try b right now.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Boolean Array
« Reply #7 on: March 23, 2015, 05:55:49 PM »
I just did a quick test with 3.98b and it worked:

        Dim values() As String = EthernetIPforCLXCom1.Read("BoolArray[0]", 200)

btjiii

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Boolean Array
« Reply #8 on: March 23, 2015, 07:17:55 PM »
Sorry Archie I think I'm not doing something correctly.  Where do I put in the code you sent ?

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Boolean Array
« Reply #9 on: March 23, 2015, 07:27:27 PM »
Sorry Archie I think I'm not doing something correctly.  Where do I put in the code you sent ?
If you give me more details on exactly what you want to do, I can give you a better example on how to do it.

For the test I did, I added a button to the form, double clicked the button, then put that code in the click event handler. But of course more code would have to be added to make anything useful.

btjiii

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Boolean Array
« Reply #10 on: March 23, 2015, 07:40:54 PM »
Ok, I am trying to display alarms on a screen with MessageListByValue1 so that I can also show date time stamp.  The alarms are tied to bits in the array and display when the bit is a 1 on an RSView32 display.  I want to display the same alarm on AdvancedHMI on a TV. So for ex.  ALARMH.A[1] AU-1 Return High Temp Alarm. ALARMH.A[10] AU-10 High Temp Alarm

Hopefully, that is helpful.

Thanks Again

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Boolean Array
« Reply #11 on: March 23, 2015, 08:31:44 PM »
Ok, I am trying to display alarms on a screen with MessageListByValue1 so that I can also show date time stamp.  The alarms are tied to bits in the array and display when the bit is a 1 on an RSView32 display.  I want to display the same alarm on AdvancedHMI on a TV. So for ex.  ALARMH.A[1] AU-1 Return High Temp Alarm. ALARMH.A[10] AU-10 High Temp Alarm
The easiest way to do this would be to write a few rungs in the PLC that would check the values of the BOOL array, if it finds one that is true, then put the bit number into a DINT tag and pause it for a few seconds, then continue checking the BOOL array in a round robin. Then you could use the MessageListByValue and put the DINT Tag in the PLCAddressValue property.

Otherwise, its going to take a bit of VB code writing to do the same thing with the HMI. This is roughly how you would do it:

- Add a timer to the form and set the Interval to 250, and Enabled to True
- Double click the timer to get to the code
- Add this code:

Dim Values() as string
Values=EthernetIPforCLXCom1.Read("ALARMH.A[0]",32)
For BitNumber=0 to Values.Length-1
  if Values(BitNumber)="True" and LastValues(BitNumber)<>"True" then
        MessageListByValue1.Value=BitNumber
  End If
  LastValues(BitNumber)=Values(BitNumber)
Next


- Above the subroutine declaration, add this line of code:

Private LastValues(32) as string