AdvancedHMI Software

General Category => Open Discussion => Topic started by: bachphi on May 29, 2018, 10:42:14 PM

Title: Modbus with Micrologix 1400
Post by: bachphi on May 29, 2018, 10:42:14 PM
Besides the regular SerialDF1 & EthernetIPforSLCMicro communication, Micrologix 1400 also offer Modbus RTU & modbus TCP. It's very nice to have this flexibility. I am not sure why Rockwell did not integrate modbus into their Compactlogix line.

First, Enable it in the channel configuration
(https://s22.postimg.cc/uybrl44u9/Modbus_TCPEnable.png)

Once it enabled, Channel 1 modbus tab will appear and here you can config your file number accordingly
(https://s22.postimg.cc/ae6xmuuap/Mod_Bus_Config.png)

 
Dont forget to recycle power to ML1400. Next some codings:

Code: [Select]
Imports AdvancedHMIDrivers

Public Class Form1

    Public PLC As ModbusTCPCom = New ModbusTCPCom()

    Private SubID, SubID2, SubID3 As Integer
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        PLC.IPAddress = "192.168.1.10"
        PLC.PollRateOverride = "0"
        '
        SubID = PLC.Subscribe("30001", 1, 0, AddressOf DataReturned) '
        SubID2 = PLC.Subscribe("40001", 1, 0, AddressOf DataReturned)
        'SubID3 = PLC.Subscribe("B3:1", 2, 0, AddressOf DataReturned)
   End Sub
 Private Sub DataReturned(ByVal sender As Object, ByVal e As MfgControl.AdvancedHMI.Drivers.Common.PlcComEventArgs)
        If e.PlcAddress = "30001" Then
            Label1.Text = e.Values(0)
        End If
        If e.PlcAddress = "40001" Then
            Label2.Text = e.Values(0)
        End If
     

    End Sub

Note:
Modbus TCP devices use client/server model. Client established a connection to server, then request info from server.
Modbus RTU devices use master/slave model. A Slave resides on a serial network (e.g. RS485) and listens for requests from a Modbus Master.
Title: Re: Modbus with Micrologix 1400
Post by: Archie on May 29, 2018, 11:46:50 PM
I am not sure why Rockwell did not integrate modbus into their Compactlogix line.
I wondered the same thing since Modbus is used by so many devices. It's practically the universal protocol.
Title: Re: Modbus with Micrologix 1400
Post by: Darrell on May 30, 2018, 11:46:22 PM
maybe the own prosoft ,
Title: Re: Modbus with Micrologix 1400
Post by: bachphi on June 13, 2018, 04:17:28 PM
true, like this one for compactlogix:
prosoft mvi69e-mbs

http://www.prosoft-technology.com/Products/Rockwell-Automation-In-chassis/Platform/CompactLogix/Modbus-Serial-Enhanced-Communication-Module