Menu

AllenBradleyPCCC.vb crashing

Help
cjawood
2011-11-07
2013-05-30
  • cjawood

    cjawood - 2011-11-07

    Hi,
    I have a slc 5/04, and some forms with some DigitalPanelMeter's for counters, timers and N7:120
    I am using Driver DF1Comm1 and I keep getting a exception sometimes in 10 seconds and sometimes it wont show up for a couple minutes
    It says:

    "Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: startIndex"

    then it points me to line:
    result(i) = BitConverter.ToInt16(ReturnedData, j)
    in AllenBradleyPCCC.vb

    Does anyone know what I can do to not get this error?
    I have tried different things, but I am not sure how to keep it from happening.
    Thanks

     
  • cjawood

    cjawood - 2011-11-07

    Oh ya, I'm using AdvancedHMIBetaV319

     
  • cjawood

    cjawood - 2011-11-08

    Hi,
    I  have a header that is showing a heartbeat using a GraphicIndicator so I know I am communicating with the plc,
    Maybe that is part of my problem?
    I have added the Stop polling code in for all my forms but that don't stop the crashing.
    I would like to try using only one DF1 for all my controls.
    I seen that you have used  "the DF1Comm of each component of the popup to the DF1 that's on the main form."
    But when I try to put the properties of a control under the CommComponent it will only alow me to select (None) I cant type in MainForm.DF1Comm1.
    Could you tell me how to set the DF1Comm of each component to the DF1Comm1 that's on the main form?
    Please help
    Thanks

     
  • Archie

    Archie - 2011-11-08

    When using a single instance of the communication component, you can no longer use visual controls on forms other than the form the one component exists. That technique only works if accessing the single communication instance via code.

     
  • cjawood

    cjawood - 2011-11-13

    Hi,
    Thanks for making this HMI!
    I am having fun playing with it.

    I added a MsgBox to the  AllenBradleyPCCC to try to figure out why i cant keep the program running, I think that the T9:1.ACC in my DigitalPanelMeters is causing my issues.
    The MsgBox shows me values like  -15780  while the other controls have values 0 and above.
    Is there a easy way to have the AllenBradleyPCCC try to see if the value in the array is invalid?
    So that it could just continue.
    I tried doing this but I don't know how to write it.
    The MsgBox("You Crashed") never activates, I just get a exception error.
    I don't really want to change my plc program to only use N files.

    Thanks Much
                Case &H86, &H87  '* Timer, counter
                    '* If a sub element is designated then read the same sub element for all timers
                    Dim j As Integer
                    For i As Integer = 0 To ParsedResult.NumberOfElements - 1

                        If ParsedResult.SubElement > 0 Then
                            j = i * 6 + (ParsedResult.SubElement) * 2
                        Else
                            j = i * 2
                        End If

             Try                    ' Set up structured error handling.
                            result(i) = BitConverter.ToInt16(ReturnedData, j)        ' Cause's a "?" error.
                            ResultiVal = result(i)
                            MsgBox(AllenBradleyPCCC.ResultiVal)
                        Catch ex As Exception When result(i) < 1     ' Catch the error.
                            MsgBox("You Crashed")                               ' Show an explanatory message.
                        Finally
                            ' If (Not result(i) Is Nothing) Then
                            ' Beep()
     
                            ' End If

                        End Try

    '''If result(i) = Null then exit sub

     
  • cjawood

    cjawood - 2011-11-22

    So, since V319 DF1 doesn't work, I  Guess People will have to use V310 that Df1 works with?
    Could you set up some structured error handling in future updates please?
    I would like to use the newer versions if I could.

    Thanks

    If you are working with a collection, make sure that the index is less than the size of the collection.
    The index must be within the size range of the collection and cannot exceed the size range or be less than zero.

     
  • Archie

    Archie - 2011-11-23

    So far I have been unable to reproduce this problem. Are you opening and closing forms when the exception occurs?

    The one issue I found was when the driver instance get's disposed. This is the fix for that:

        'Component overrides dispose to clean up the component list.
        Protected Overrides Sub Dispose(ByVal disposing As Boolean)
            '* The handle linked to the DataLink Layer has to be removed, otherwise it causes a problem when a form is closed
            If DLL(MyDLLInstance) IsNot Nothing Then RemoveHandler DLL(MyDLLInstance).DataReceived, Dr

            MyBase.Dispose(disposing)
        End Sub

     

Log in to post a comment.