AdvancedHMI Software
General Category => Support Questions => Topic started by: MrPike on November 17, 2015, 09:45:48 PM
-
Archie, I would like to know if its possible to poll a different number of registers on each form with the ModbusTCP driver with each read. For instance, my project has two forms both polling the same device. Page1 can block read multiple register at a time. However the address range for the second page only allows polling one register at a time or else I get an error from the device. The second page consist of 60 BasicLabels. Can this be done?...I fear the answer is no since the code is in ModbusBase, is it realistic to add 60 ModbusTCP drivers to the form and assign it to each BasicLabel? What line is this in ModbusBase? Thank you!
-
What is the error you are getting? There must be some kind of limitation with the device. You can go to line 532 in ModbusBase.vb and experiment with the group size by changing the value of 20 in this code:
While (index + ItemCountToGroup + 1) < SubscriptionList.Count AndAlso _
SubscriptionList(index + ItemCountToGroup).Address.ReadFunctionCode = SubscriptionList(index + ItemCountToGroup + 1).Address.ReadFunctionCode AndAlso _
SubscriptionList(index + ItemCountToGroup).Address.BitsPerElement = SubscriptionList(index + ItemCountToGroup + 1).Address.BitsPerElement AndAlso _
((SubscriptionList(index + ItemCountToGroup + 1).Address.Element + SubscriptionList(index + ItemCountToGroup + 1).Address.NumberOfElements) - SubscriptionList(index).Address.Element) < 20 AndAlso
SubscriptionList(index + ItemCountToGroup).Address.Address.Substring(0, 1).ToUpper = SubscriptionList(index + ItemCountToGroup + 1).Address.Address.Substring(0, 1).ToUpper
-
Yes it is an intentional limitation of the device to prevent from access to more than 1 RW register at a time. The "read only" can be block read with no problems. Is it possible to change the # of registers read at a time for each form? Thx
-
You can create a new property by adding this code to ModbusBase.vb :
Private m_MaxReadGroupSize As Integer = 20
Public Property MaxReadGroupSize As Integer
Get
Return m_MaxReadGroupSize
End Get
Set(value As Integer)
m_MaxReadGroupSize = value
End Set
End Property
Then change the value of 20 from the previous post to m_MaxReadGroupSize
-
Awesome! I will give this a try and let you know. Thanks