Author Topic: Modbus with Micrologix 1400  (Read 3402 times)

bachphi

  • Hero Member
  • *****
  • Posts: 671
    • View Profile
Modbus with Micrologix 1400
« 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


Once it enabled, Channel 1 modbus tab will appear and here you can config your file number accordingly


 
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.
« Last Edit: June 08, 2020, 10:47:14 AM by bachphi »
===================================================
This is NOT alt.read.my.mind.
No such thing is sh^t-for-brains unless you are posting to alt.read.my.mind.
===================================================

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Modbus with Micrologix 1400
« Reply #1 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.

Darrell

  • Full Member
  • ***
  • Posts: 198
  • Electrician / PLC Technician
    • View Profile
Re: Modbus with Micrologix 1400
« Reply #2 on: May 30, 2018, 11:46:22 PM »
maybe the own prosoft ,

bachphi

  • Hero Member
  • *****
  • Posts: 671
    • View Profile
===================================================
This is NOT alt.read.my.mind.
No such thing is sh^t-for-brains unless you are posting to alt.read.my.mind.
===================================================