日本語 English

How to Communicate with Mitsubishi PLCs Using the MC Protocol

What Is the MC Protocol?

The MC protocol is a communication protocol for accessing devices on Mitsubishi Electric MELSEC series PLCs over Ethernet.
It can read and write D devices, M devices, X and Y devices and more.

Overview

Configuration for connecting to a MITSUBISHI PLC
Hardware configuration

Reads and writes memory using the MELSEC communication protocol (MC protocol) on the Ethernet port of a MITSUBISHI PLC
This library uses the following frame and code

Frame3E frame
Code Binary code

The MITSUBISHI PLC is the server, and no ladder is needed on the MITSUBISHI side

Features of McLink

  • Supports MC protocol 3E frames
  • Supports binary code
  • Supports TCP communication
  • Supports UDP communication
  • Supports D device reading
  • Supports M device reading
  • Supports random reading
  • Supports the NX/NJ series

Namespace: McLink

FB list
McpReadBatch read
McpReadBitBatch read in bit units
McpRandomReadRandom reading
McpWriteBatch write
McpWriteBitBatch write in bit units
McpUDPSend MC protocol command UDP
McpTCPSend MC protocol command TCP

McpRead (batch read)

McpRead
Input
IpAddress
STRING[200]
Destination IP address
Port
UINT
Port number
Device
McLink\DeviceCode
Device code
Address
UDINT
First device
ReadSize
UINT
Number of device points
In-out
ReciveData
ARRAY[*] OF WORD
Received data

McpReadBit (batch read in bit units)

McpReadBit
Input
IpAddress
STRING[200]
Destination IP address
Port
UINT
Port number
Device
McLink\DeviceCode
Device code
Address
UDINT
First device
ReadSize
UINT
Number of device points
In-out
ReciveData
ARRAY[*] OF WORD
Received data

McpRamdomRead (random read)

McpRandomRead
Input
IpAddress
STRING[200]
Destination IP address
Port
UINT
Port number
WordDevice
STRING[255]
Word device names (comma-separated)
DWordDevice
STRING[255]
Double word device names (comma-separated)
In-out
ReadDataW
ARRAY[0..9] OF WORD
Word device received data
ReadDataDW
ARRAY[0..9] OF DWORD
Double word device received data

McpWrite (batch write)

McpWrite
Input
IpAddress
STRING[200]
Destination IP address
Port
UINT
Port number
Device
McLink\DeviceCode
Device code
Address
UDINT
First device
WriteSize
UINT
Number of device points
In-out
WriteData
ARRAY[*] OF WORD
Write data

McpWriteBit (batch write in bit units)

McpWriteBit
Input
IpAddress
STRING[200]
Destination IP address
Port
UINT
Port number
Device
McLink\DeviceCode
Device code
Address
UDINT
First device
WriteSize
UINT
Number of device points
In-out
WriteData
ARRAY[*] OF WORD
Write data

McpUDP (send MC protocol command UDP)

McpUDP
Input
IpAddress
STRING[200]
Destination IP address
Port
UINT
Port number
CmdSize
MUINT
Number of bytes to send
Output
ReciveSize
UINT
Number of bytes received
In-out
Cmd
ARRAY[*] OF BYTE
Send command
ReciveData
ARRAY[*] OF BYTE
Received data

McpTCP (send MC protocol command TCP)

McpTCP
Input
IpAddress
STRING[200]
Destination IP address
Port
UINT
Port number
CmdSize
MUINT
Number of bytes to send
Output
ReciveSize
UINT
Number of bytes received
In-out
Cmd
ARRAY[*] OF BYTE
Send command
ReciveData
ARRAY[*] OF BYTE
Received data

Program example

McpRead (batch read)

Batch read
Batch read
FB input variables
Device \\McLink\DeviceCode#D
Address 0
ReadSize 5
FB input/output variables
ReadData [0001,0002,0003,0004,0005]

McpReadBit (batch read in bit units)

Batch read in bit units
Batch read in bit units
FB input variables
Device \\McLink\DeviceCode#M
Address 0
ReadSize 10
FB input/output variables
ReadBitData [TRUE,TRUE,TRUE,TRUE,TRUE,FALSE,FALSE,FALSE,FALSE]

McpRamdomRead (random read)

Random reading
Random reading
FB input variables
WordDevice 'D0,D10,X10'
DWordDevice 'D100,M0,Y20'
FB input/output variables
ReadDataW [0001,000A,000F]
ReadDataDW [00660065,04030201,12345678]

McpWrite (batch write)

Batch write
Batch write
FB input variables
Device \\McLink\DeviceCode#D
Address 0
WriteSize 2
FB input/output variables
WriteData [000A,000B]

McpWriteBit (batch write in bit units)

Batch write in bit units
Batch write in bit units
FB input variables
Device \\McLink\DeviceCode#M
Address 0
WriteSize 6
FB input/output variables
WriteData [TRUE,TRUE,,TRUE,TRUE,TRUE,TRUE]

McpUDP (send MC protocol command UDP)

Send MC protocol command UDP
Send MC protocol command UDP
FB input variables
CmdSize 10
FB output variables
ReciveSize 4
FB output variables
Cmd [01,04,00,00,00,00,00,A8,02,00]
ReciveData [01,00,02,00]

McpTCP (send MC protocol command TCP)

Send MC protocol command TCP
Send MC protocol command TCP
FB input variables
CmdSize 10
FB output variables
ReciveSize 4
FB output variables
Cmd [01,04,00,00,00,00,00,A8,02,00]
ReciveData [01,00,02,00]

Related pages

OSD Tools logo
OSD ToolsPLC Communication Test Tool Set

The Free edition is free. One Pro license unlocks all five tools

TCP/UDPEtherNet/IP · CIPMC protocolFINSModbus TCP
Learn more

TCP and UDP communication test tool

Analyze and test TCP and UDP communication

ComCom

An application that sends messages you create using Ethernet socket communication

Python MC protocol communication

MITSUBISHI MC Protocol Communication

MC protocol communication with MITSUBISHI PLCs

MITSUBISHI

MC protocol error code list

MC Protocol Error Codes

Meanings and fixes for MC protocol (SLMP) end codes such as C059, C056 and C051

McLink library

By downloading, you are deemed to have agreed to the Terms of Use

Files included with the library

  • McLink.slr (library file)
  • McLink.csm2 (library source file)
  • McLinkSample.csm2 (sample using the library)
  • McLink.md (library description)

Comments