mcpxpy is a Python wrapper for McpX,
a .NET library for communicating with Mitsubishi Electric PLCs using the MC protocol.
This package allows Python applications to communicate with Mitsubishi PLCs via a high-performance native interface
powered by Ahead-of-Time (AOT) compiled shared libraries (.so
/ .dll
) using ctypes
.
⚡ By leveraging AOT-compiled binaries, mcpxpy achieves near-native performance,
making it highly efficient for real-time or high-frequency communication tasks.
⚠️ This library is currently under active development and not yet production-ready.
APIs and behavior may change without notice.
pip install -i https://test.pypi.org/simple/ mcpxpy
from mcpxpy import *
# Connect to PLC by specifying IP and port
with McpX("192.168.12.88", 10000) as mcpx:
# Read 7000 words starting from D1000
d_list = mcpx.batch_read_short(Prefix.D, "1000", 7000)
# Write 1234 to D0 and 5678 to D1 as signed 16-bit shorts
mcpx.batch_write_short(Prefix.D, "0", [1234, 5678])
- TCP
- UDP
- 3E frame (binary code)
- 3E frame (ASCII code)
- 4E frame (binary code)
- 4E frame (ASCII code)