kjacoby
Member
Which version of VB did you create this with? I currently have 2010, and it wont open.
I use Visual Studio 2015 Community Edition. It should open with 2010, but you would need to install the service pack:Which version of VB did you create this with? I currently have 2010, and it wont open.
The Omron drivers do not support string directly, but I'm sure I can come up with some way to read it as integers, then convert it to strings.Love-love-love this HMI! I am a little stuck on something though. I have an Omron NJ101-9000, using FINS with Sysmac Studio and all is well except I can't figure out how to get my strings from the Omron to display on the HMI. It produces a numeric value as opposed to text.
You will need to convert the integers to a string. Here is a function that will convert the values into a string:That is what I am trying to ascertain as I write. I am trying to use a "D" data table however, it may not be the correct way to do it, and that is why I am getting numeric values and nothing alpha.
Private Function ConvertIntsToString(ByVal ints() As String) As String
'* Convert values to an array of bytes
Dim ByteArray(ints.Length * 2 - 1) As Byte
For i = 0 To ints.Length - 1
'* Upper byte
ByteArray(i * 2) = CByte((CInt(ints(i)) >> 8) And 255)
'* Lower byte
ByteArray(i * 2 + 1) = CByte(CInt(ints(i)) And 8)
Next
'* Convert the array of bytes to a string
Dim result As String
result = System.Text.Encoding.UTF8.GetString(byteArray)
Return result
End Function
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim values() As String = OmronEthernetFINSCom1.Read("D0", 10)
Button1.Text = ConvertIntsToString(values)
End Sub
You will need to convert the integers to a string. Here is a function that will convert the values into a string:
.
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim values() As String = OmronEthernetFINSCom1.Read("D0", 10)
Button1.Text = ConvertIntsToString(values)
End Sub
Private Function ConvertIntsToString(ByVal ints() As String) As String
'* Convert values to an array of bytes
Dim ByteArray(ints.Length * 2 - 1) As Byte
For i = 0 To ints.Length - 1
'* Upper byte
ByteArray(i * 2) = CByte((CInt(ints(i)) >> 8) And 255)
'* Lower byte
ByteArray(i * 2 + 1) = CByte(CInt(ints(i)) And 8)
Next
'* Convert the array of bytes to a string
Dim result As String
result = System.Text.Encoding.UTF8.GetString(byteArray)
Return result
End Function