Author Topic: Modbus RTU for the Horner OCS  (Read 3427 times)

wesley

  • Newbie
  • *
  • Posts: 4
    • View Profile
Modbus RTU for the Horner OCS
« on: July 17, 2014, 01:53:23 PM »
There are some small tweaks necessary to the ModbusRTUCom.vb to use it with the Horner OCS HE-XT102:
In SendData:
           If Not InternalRequest Or (DLL(MyDLLInstance).SendQueDepth < 10) Then
                DLL(MyDLLInstance).SendRTUFrame(FinsF)
                'Added for Horner
                Threading.Thread.Sleep(100)
                'End of add for Horner
                Return True
            Else
                Return False
            End If

In Write function:
            Dim PDU As New ModbusPDUFrame(address.WriteFunctionCode, address, dataPacket.ToArray)
            Dim RTUPacket As MfgControl.AdvancedHMI.Drivers.ModbusRTU.ModbusRTUFrame

            'Modified to work with the Horner
            If address.BitsPerElement = 16 Then
                PDU.EncapsulatedData(2) = PDU.EncapsulatedData(5)
                PDU.EncapsulatedData(3) = PDU.EncapsulatedData(6)
            Else
                PDU.EncapsulatedData(2) = PDU.EncapsulatedData(5)
            End If
            'End of Horner modification
            RTUPacket = New ModbusRTUFrame(m_StationAddress, PDU, CurrentTNS)


            SendData(RTUPacket, address.InternallyRequested)
            Return New String() {"0"}
            'End SyncLock
        End Function

Then in the Horner put in the following attached 2 rungs:

I used VB.Net 2013 and the components (integer and boolean) work. Also, the following commands work:
Dim strResult(4) As String
strResult = ModbusRTUCom2.Read("43901", 1) 'reads %R901
strResult = ModbusRTUCom2.Read("03009", 1) 'reads %M9
ModbusRTUCom2.Write("43902", "12345") 'writes %R902
ModbusRTUCom2.Write("03017", "0") 'writes %M17

Archie probably has a cleaner approach but this works.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5268
    • View Profile
    • AdvancedHMI
Re: Modbus RTU for the Horner OCS
« Reply #1 on: September 08, 2014, 09:10:48 PM »
Try these tests again with version 3.69 or higher. There were a lot of improvements made in the ModbusRTU driver

wesley

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Modbus RTU for the Horner OCS
« Reply #2 on: September 09, 2014, 04:48:23 PM »
The 369 version works great with the components. But for some reason, a read using ModbusRTUCom1.Read("03902", 1) is getting a 0 as the ID in the WaitForResponse which yields a null since the response is coming back with an index of 1.

Wes Byers

  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: Modbus RTU for the Horner OCS
« Reply #3 on: December 28, 2015, 06:18:17 PM »
Just an update, all works well with the latest version.