AdvancedHMI Software
General Category => Support Questions => Topic started by: RedBinary on March 13, 2013, 09:47:59 AM
-
In the HMI I've written I'm communicating with a ControlLogix PLC. I've seen the issue mentioned over at the SourceForge forum of the addresses being read in with ReadAny() pulling in a maximum of 59. I've found this to be the case in my project as well. I need to read in 2 arrays of 100 DINTs each, so I'm handling this by pulling the data in chunks of 50.
The main issue is that every once in awhile the data returned will be incorrect. The values in the tags are guaranteed to all be in the range of 0 to 100. When the error occurs only a 1 member array is returned with a value of >100. Once this is occurs it is persistent - ReadAny() will only ever return a 1 member array with an incorrect value until the program is killed. Relaunch the program and reads work fine again.
What would be the recommended way to handle this? Maybe there's a good way to programmatically reset the driver?
-
Having a little trouble getting the forum to load this morning!
I thought I should specify: even when ReadAny() is failing the components on the form (BasicLabels, BasicIndicators) still function properly.
The code inside a try/catch:
Dim profile_points1(50) As String 'read times out trying to pull all 100 points in one shot
Dim profile_points2(50) As String 'so break it into 2 separate arrays & calls
'ListBox1.Items.Clear()
profile_points1 = plc_clx.ReadAny("Program:HEAD_" & (currentHead + 1) & ".PARISON_CPT[0]", 50)
Dim i As Integer = 0
If validateReturnedArray(profile_points1) Then
For i = 0 To 49
currentProfilePoints(i) = profile_points1(i)
'ListBox1.Items.Add(i & ":" & profile_points1(i))
Next
profile_points2 = plc_clx.ReadAny("Program:HEAD_" & (currentHead + 1) & ".PARISON_CPT[50]", 50)
If validateReturnedArray(profile_points2) Then
comAttemptCount = 0
For i = 0 To 49
currentProfilePoints(i + 50) = profile_points2(i)
' ListBox1.Items.Add((i + 50) & ":" & profile_points2(i))
Next
Else
comAttemptCount = comAttemptCount + 1
MessageBox.Show(errMsg, "bad array caught in profile loop 2. (" & comAttemptCount & ")")
'resetCom()
readParsionValues()
End If
Else
comAttemptCount = comAttemptCount + 1
MessageBox.Show(errMsg, "bad array caught in profile loop 1. (" & comAttemptCount & ")")
'resetCom()
readParsionValues()
End If
comFaultCount = 0
-
Any thoughts on what I should look for?
-
Version 3.27 is now available and one of the problems addressed was reading large arrays. Try the new version and see if it fixes your problem, then let me know.