in DataLinkLayer_DataReceived() we need to allow I/O files to select the second word
around line 2418 change the code to:
EnoughElements = False '* Are there enought elements read for this request
If (PolledAddressList(i).ElementNumber - PLCAddressByTNS(rTNS).Element + PolledAddressList(i).ElementsToRead <= d.Length) And _ (PolledAddressList(i).FileType <> 134 And PolledAddressList(i).FileType <> 135 And PolledAddressList(i).FileType <> &H8B And PolledAddressList(i).FileType <> &H8C) Then EnoughElements = True ElseIf (PolledAddressList(i).BitNumber < 16) And ((PolledAddressList(i).ElementNumber - PLCAddressByTNS(rTNS).Element + PolledAddressList(i).ElementsToRead) / 16 <= d.Length) Then EnoughElements = True ElseIf (PolledAddressList(i).FileType = 134 Or PolledAddressList(i).FileType = 135) And (PolledAddressList(i).ElementNumber - PLCAddressByTNS(rTNS).Element + PolledAddressList(i).ElementsToRead) <= d.Length Then EnoughElements = True ElseIf (PolledAddressList(i).FileType = &H8B Or PolledAddressList(i).FileType = &H8C And _
PolledAddressList(i).ElementNumber = PLCAddressByTNS(rTNS).Element) Then
Dim WordToUse As Integer = 0
If PolledAddressList(i).BitNumber = 99 Then
WordToUse = PolledAddressList(i).SubElement
Else
WordToUse = PolledAddressList(i).BitNumber >> 4
End If
If (d.Length - 1) >= (PolledAddressList(i).ElementNumber - PLCAddressByTNS(rTNS).Element + WordToUse) Then
EnoughElements = True
End If
End If
a bit further down change it to:
IfPolledAddressList(i).BitNumber<99Then'*TODO:MakethishandlearquestformultiplebitsTry'*Testtoseeifbitsorintegersreturned'DimxAsIntegerTry'x=d(0)IfPolledAddressList(i).BitNumber<16ThenBitResult(0)=(d(PolledAddressList(i).ElementNumber-PLCAddressByTNS(rTNS).Element)And2^PolledAddressList(i).BitNumber)>0ElseDimWordToUseAsInteger=PolledAddressList(i).BitNumber>>4DimModifiedBitToUseAsInteger=PolledAddressList(i).BitNumberMod16BitResult(0)=(d(PolledAddressList(i).ElementNumber-PLCAddressByTNS(rTNS).Element+(WordToUse))And2^ModifiedBitToUse)>0EndIfCatchexAsExceptionBitResult(0)=d(0)EndTryCatchexAsExceptionMsgBox("Error in returning data from datareceived - "&ex.Message)EndTryElseIf(PolledAddressList(i).FileType=&H8BOrPolledAddressList(i).FileType=&H8C)_AndAlsoPolledAddressList(i).SubElement>0ThenBitResult(0)=d(1)Else'*AllotherdatatypesForkAsInteger=0ToPolledAddressList(i).ElementsToRead-1BitResult(k)=d((PolledAddressList(i).ElementNumber-PLCAddressByTNS(rTNS).Element+k))Next'm_SynchronizingObject.BeginInvoke(PolledAddressList(i).dlgCallBack,d(PolledAddressList(i).ElementNumber-PLCAddressByTNS(TNSReturned).Element))EndIfSynchronizingObject.BeginInvoke(PolledAddressList(i).dlgCallBack,NewObject(){BitResult})
With this O:3 and O:3.0 will give you the lower 16bit Word O:3.0 to O:3.15
O:3.1 will give you the higher 16bit Word O:3.16 to O:3.31
I imagine that using O:3 should be made to give you a full 32bit DWord, but I'm not sure if there is an easy way to do it.
BTW it would not hurt to add descriptions to the properties so we can see it in visual designer. eg:
<System.ComponentModel.Category("PLC Properties")> _ <System.ComponentModel.Description("PLC Driver")> _
Public Property CommComponent() As AdvancedHMIDrivers.IComComponent
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2012-08-05
Not the prettiest description of the fix, but I hope it helps.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2012-08-06
Ignore the second block of code above, it should be:
If you try to use an address value of O:3 or O:3.0 or O:3.1 they all fail to read anything.
this is my quick fix:
in AdvancedHMIDrivers\AllenBradleyPCCC.vb
in PollUpdate() we need to allow 2 words to be read if the high word is selected. O:3.1
around line 400 change the code to:
in DataLinkLayer_DataReceived() we need to allow I/O files to select the second word
around line 2418 change the code to:
a bit further down change it to:
With this O:3 and O:3.0 will give you the lower 16bit Word O:3.0 to O:3.15
O:3.1 will give you the higher 16bit Word O:3.16 to O:3.31
I imagine that using O:3 should be made to give you a full 32bit DWord, but I'm not sure if there is an easy way to do it.
BTW it would not hurt to add descriptions to the properties so we can see it in visual designer. eg:
Not the prettiest description of the fix, but I hope it helps.
Ignore the second block of code above, it should be:
Oops, I meant use the last code block I posted for the first block of code. PollUpdate()
Man sourceforge postings need an edit feature. And the ability to attach a diff.
:)