Author Topic: Omron Serial Host Link connection problem  (Read 5415 times)

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5317
    • View Profile
    • AdvancedHMI
Re: Omron Serial Host Link connection problem
« Reply #15 on: January 13, 2017, 09:26:40 PM »
Try adding this code to OmronBaseCom and using them:

Code: [Select]
        Public Function ReadAsString(ByVal startAddress As String, ByVal numberOfElements As Integer) As String
            Dim values() As String = Read(startAddress, numberOfElements)
            Return MfgControl.AdvancedHMI.Drivers.Common.CalculationsAndConversions.WordsToString(values)
        End Function
Code: [Select]
        Public Sub WriteAsString(ByVal startAddress As String, ByVal stringToWrite As String)
            If Not String.IsNullOrEmpty(stringToWrite) Then
                Dim Values() As Integer = MfgControl.AdvancedHMI.Drivers.Common.CalculationsAndConversions.StringToWords(stringToWrite)
                Dim ValuesAsString(Values.Length - 1) As String
                For i = 0 To ValuesAsString.Length - 1
                    ValuesAsString(i) = CStr(Values(i))
                Next
                Write(startAddress, ValuesAsString)
            End If
        End Sub

aquilmustafa

  • Full Member
  • ***
  • Posts: 121
    • View Profile
Re: Omron Serial Host Link connection problem
« Reply #16 on: January 13, 2017, 09:49:59 PM »
Hey Archie,

Thanks for the solution. I'll be able to test that tomorrow.

Do you have any work around solution for reading and writing W0.00 also.

Many thanks for the prompt solution.