https://github.com/yudaikitamura/mcpxpy
mcpxpy is a Python wrapper for McpX, a .NET library for communicating with Mitsubishi Electric PLCs using the MC protocol.
https://github.com/yudaikitamura/mcpxpy
mcprotocol melsec plc python
Last synced: about 1 year ago
JSON representation
mcpxpy is a Python wrapper for McpX, a .NET library for communicating with Mitsubishi Electric PLCs using the MC protocol.
- Host: GitHub
- URL: https://github.com/yudaikitamura/mcpxpy
- Owner: YudaiKitamura
- License: mit
- Created: 2025-04-16T12:50:21.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-04-16T13:59:14.000Z (about 1 year ago)
- Last Synced: 2025-04-16T20:15:18.198Z (about 1 year ago)
- Topics: mcprotocol, melsec, plc, python
- Language: Python
- Homepage:
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
**mcpxpy is a Python wrapper for [McpX](https://github.com/YudaiKitamura/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.
## Installation
### PyPI
```sh
pip install -i https://test.pypi.org/simple/ mcpxpy
```
## Example Usage
```python
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])
```
## Supported Protocols
- TCP
- UDP
- 3E frame (binary code)
- 3E frame (ASCII code)
- 4E frame (binary code)
- 4E frame (ASCII code)