Trying to read an array of 27 strings that are all standard length. It seems the driver gets hung up on reading anything over 20, so I divided the reads. Sometimes this works and sometimes it doesn't.
I also tried creating another driver to handle one half, and that gave the same results.
Driver is set to 1000 poll rate with 8000 timeout.
Any ideas?
Public Class MainForm
'*******************************************************************************
'* Stop polling when the form is not visible in order to reduce communications
'* Copy this section of code to every new form created
'*******************************************************************************
Private NotFirstShow As Boolean
Private Sub Form_VisibleChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.VisibleChanged
'* Do not start comms on first show in case it was set to disable in design mode
If NotFirstShow Then
AdvancedHMIDrivers.Utilities.StopComsOnHidden(components, Me)
Else
NotFirstShow = True
End If
End Sub
'***************************************************************
'* .NET does not close hidden forms, so do it here
'* to make sure forms are disposed and drivers close
'***************************************************************
Private Sub MainForm_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
Dim index As Integer
While index < My.Application.OpenForms.Count
If My.Application.OpenForms(index) IsNot Me Then
My.Application.OpenForms(index).Close()
End If
index += 1
End While
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim stuff() As String
Dim junk() As String
Dim ack As Boolean
Dim upc As String
stuff = conPLC1.Read("PROGRAM:MainProgram.Station1.SQL.Receive.Component[0]", 13)
junk = conPLC1.Read("PROGRAM:MainProgram.Station1.SQL.Receive.Component[13]", 14)
complist.Items.Clear()
complist.Items.AddRange(stuff)
complist.Items.AddRange(junk)
conPLC1.Write("PROGRAM:MainProgram.Station1.resultNewArrivalACK", 1)
ack = conPLC1.Read("PROGRAM:MainProgram.Station1.resultNewArrivalACK")
If ack = True Then
conPLC1.Write("PROGRAM:MainProgram.Station1.resultNewArrivalACK", 0)
End If
upc = upclabel.Text.ToString
If upc.Contains("08856") Then
If upc.Length = 13 Then
checklabel.Text = "Scanned Code Is A UPC Number. Transferred To FTTM."
Else
checklabel.Text = "Scanned Code Is Not A UPC Number. Copied To Compare Array In PLC."
End If
End If
End Sub
End Class