🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

McpX

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

McpX

MC protocol communication library for Mitsubishi PLC(三菱PLC用MCプロトコル通信ライブラリ)

0.5.1
NuGet
Version published
Maintainers
1
Created
Source

McpX

McpX is a library for communicating with Mitsubishi Electric PLCs using the MC protocol.
It features a simple and easy-to-use API, allowing you to communicate without worrying about MC protocol details.
It runs on various platforms, including Linux, Windows, and macOS.

Installation

.NET CLI

dotnet add package McpX

Package Manager(Visual Studio)

PM> NuGet\Install-Package McpX

Example Usage

using McpXLib;
using McpXLib.Enums;

// Connect to PLC by specifying IP and port
using (var mcpx = new McpX("192.168.12.88", 10000))
{
    // Read 7000 points starting from M0
    bool[] mArr = mcpx.BatchRead<bool>(Prefix.M, "0", 7000);
    
    // Read 7000 words starting from D1000
    short[] dArr = mcpx.BatchRead<short>(Prefix.D, "1000", 7000);

    // Write 1234 to D0 and 5678 to D1 as signed 32-bit integers
    mcpx.BatchWrite<int>(Prefix.D, "0", [1234, 5678]);
}

C# and Visual Basic samples are available here.

Supported Commands

NameDescriptionSynchronous MethodAsynchronous Method
Single ReadReads a single value from the specified device.Read<T>(Prefix prefix, string address)ReadAsync<T>(Prefix prefix, string address)
Single WriteWrites a single value to the specified device.Write<T>(Prefix prefix, string address, T value)WriteAsync<T>(Prefix prefix, string address, T value)
Batch ReadReads multiple consecutive values starting from the specified address.BatchRead<T>(Prefix prefix, string address, ushort length)BatchReadAsync<T>(Prefix prefix, string address, ushort length)
Batch WriteWrites an array of values to consecutive device addresses.BatchWrite<T>(Prefix prefix, string address, T[] values)BatchWriteAsync<T>(Prefix prefix, string address, T[] values)
Random ReadReads values from non-consecutive word and double-word addresses.RandomRead<T1, T2>((Prefix, string)[] wordAddresses, (Prefix, string)[] doubleWordAddresses)RandomReadAsync<T1, T2>((Prefix, string)[] wordAddresses, (Prefix, string)[] doubleWordAddresses)
Random WriteWrites values to non-consecutive word and double-word addresses.RandomWrite<T1, T2>(...)RandomWriteAsync<T1, T2>(...)
Monitor RegistrationRegisters devices to monitor.MonitorRegist((Prefix, string)[] wordAddresses, (Prefix, string)[] doubleWordAddresses)MonitorRegistAsync((Prefix, string)[] wordAddresses, (Prefix, string)[] doubleWordAddresses)
Monitor ReadReads the latest values from registered monitoring devices.Monitor<T1, T2>(...)MonitorAsync<T1, T2>(...)
Remote Password Lock/UnlockAutomatically locks the PLC with the specified remote password when the instance is created and unlocks it when disposed.McpX(string ip, int port, string? password = null)

Supported Protocols

  • TCP
  • UDP
  • 3E frame (binary code)
  • 3E frame (ASCII code)
  • 4E frame (binary code)
  • 4E frame (ASCII code)

Roadmap

  • 3E frame (ASCII code) support
  • 4E frame (binary code) support
  • 4E frame (ASCII code) support
  • UDP support

Changelog

Keywords

MCProtocol

FAQs

Package last updated on 17 Apr 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts