AdvancedHMI Software
General Category => Support Questions => Topic started by: StephenSDH on June 27, 2015, 10:30:45 PM
-
If I reference a bit inside a 16-Bit Integer with a toggle button, I get an exception. Exception says can't convert String to Boolean. I worked around by making the integer a DINT.
I'm good with converting the integers a DINT, but I'd be glad to test if you want to address.
Files
https://www.dropbox.com/sh/1plfjjlxb7p07cy/AACe9UUbg47Y5foOJMZmM8ZKa?dl=0
-
- Edit EthernetIPforCLXCom.vb
- Go to line 856
- Change the Case condition block of code to this:
Case &HD3 '* BOOL Array
Dim i As Integer
Dim x, BitValue As UInt64
Dim CurrentBitPos As Integer = BitIndex
For j = 0 To ((returnedData.Length - startIndex) / ElementSize) - 1
Select Case ElementSize
Case 1 '* SINT
x = returnedData(Convert.ToInt32(j * ElementSize + startIndex))
Case 2 ' * INT
x = BitConverter.ToUInt16(returnedData, Convert.ToInt32(j * ElementSize + startIndex))
Case 8 ' * LINT
x = BitConverter.ToUInt64(returnedData, Convert.ToInt32(j * ElementSize + startIndex))
Case Else
x = BitConverter.ToUInt32(returnedData, Convert.ToInt32(j * ElementSize + startIndex))
End Select
While CurrentBitPos < BitsPerElement
BitValue = Convert.ToUInt64(2 ^ (CurrentBitPos))
result(i) = Convert.ToString((x And BitValue) > 0)
i += 1
CurrentBitPos += 1
End While
CurrentBitPos = 0
Next
To make sure the right amount of code was changed, be sure the next line of code after the above code is:
Case &H82, &H83 '* TODO: Timer, Counter, Control
-
Tested, and it worked. Thanks