





更多源码下载
https://8ma.co/res/YBMV713F
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MitsubishiPlc</class>
<widget class="QWidget" name="MitsubishiPlc">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1030</width>
<height>646</height>
</rect>
</property>
<property name="windowTitle">
<string>QT(C++)与三菱MC 1E 二进制协议通信</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout" stretch="6,4">
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QWidget" name="widget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>340</height>
</size>
</property>
<widget class="QLineEdit" name="lineEdit_2">
<property name="geometry">
<rect>
<x>460</x>
<y>60</y>
<width>81</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>6000</string>
</property>
</widget>
<widget class="QLabel" name="label_4">
<property name="geometry">
<rect>
<x>60</x>
<y>140</y>
<width>61</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>读地址:</string>
</property>
</widget>
<widget class="QPushButton" name="bt_open">
<property name="geometry">
<rect>
<x>570</x>
<y>50</y>
<width>91</width>
<height>41</height>
</rect>
</property>
<property name="text">
<string>连接</string>
</property>
<property name="type" stdset="0">
<string>primary</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit">
<property name="geometry">
<rect>
<x>130</x>
<y>60</y>
<width>211</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>127.0.0.1</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_4">
<property name="geometry">
<rect>
<x>350</x>
<y>130</y>
<width>81</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>1</string>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>400</x>
<y>70</y>
<width>51</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>端口:</string>
</property>
</widget>
<widget class="QLabel" name="label_5">
<property name="geometry">
<rect>
<x>280</x>
<y>140</y>
<width>61</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>读数量:</string>
</property>
</widget>
<widget class="QPushButton" name="bt_close">
<property name="geometry">
<rect>
<x>690</x>
<y>50</y>
<width>91</width>
<height>41</height>
</rect>
</property>
<property name="text">
<string>断开</string>
</property>
<property name="type" stdset="0">
<string>danger</string>
</property>
</widget>
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>150</x>
<y>10</y>
<width>561</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>QT(C++)实现MC 1E 二进制协议与三菱PLC通信</string>
</property>
<property name="type" stdset="0">
<string>h3</string>
</property>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>60</x>
<y>70</y>
<width>61</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>IP地址:</string>
</property>
</widget>
<widget class="QPushButton" name="bt_write">
<property name="geometry">
<rect>
<x>620</x>
<y>230</y>
<width>130</width>
<height>40</height>
</rect>
</property>
<property name="text">
<string>写入short</string>
</property>
<property name="type" stdset="0">
<string>warning</string>
</property>
</widget>
<widget class="QPushButton" name="bt_read">
<property name="geometry">
<rect>
<x>120</x>
<y>230</y>
<width>130</width>
<height>40</height>
</rect>
</property>
<property name="text">
<string>short读取</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_3">
<property name="geometry">
<rect>
<x>130</x>
<y>130</y>
<width>121</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>D100</string>
</property>
</widget>
<widget class="QLabel" name="label_6">
<property name="geometry">
<rect>
<x>130</x>
<y>100</y>
<width>751</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string><html><head/><body><p>位地址支持<span style=" color:#008000;">X、Y、M、F、B</span>,字地址支持<span style=" color:#008000;">D、W、R</span>,位的读取如M10,字的读写如D100</p></body></html></string>
</property>
</widget>
<widget class="QPushButton" name="bt_readBool">
<property name="geometry">
<rect>
<x>120</x>
<y>180</y>
<width>130</width>
<height>40</height>
</rect>
</property>
<property name="text">
<string>bool读取</string>
</property>
</widget>
<widget class="QPushButton" name="bt_readInt">
<property name="geometry">
<rect>
<x>120</x>
<y>280</y>
<width>130</width>
<height>40</height>
</rect>
</property>
<property name="text">
<string>int读取</string>
</property>
</widget>
<widget class="QLabel" name="label_10">
<property name="geometry">
<rect>
<x>550</x>
<y>140</y>
<width>61</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>写地址:</string>
</property>
</widget>
<widget class="QLabel" name="label_11">
<property name="geometry">
<rect>
<x>750</x>
<y>140</y>
<width>41</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>写值:</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_5">
<property name="geometry">
<rect>
<x>810</x>
<y>130</y>
<width>81</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>1</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_6">
<property name="geometry">
<rect>
<x>610</x>
<y>130</y>
<width>121</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>D100</string>
</property>
</widget>
<widget class="QPushButton" name="bt_write_2">
<property name="geometry">
<rect>
<x>620</x>
<y>180</y>
<width>130</width>
<height>40</height>
</rect>
</property>
<property name="text">
<string>写入bool</string>
</property>
<property name="type" stdset="0">
<string>warning</string>
</property>
</widget>
<widget class="QPushButton" name="bt_write_3">
<property name="geometry">
<rect>
<x>620</x>
<y>280</y>
<width>130</width>
<height>40</height>
</rect>
</property>
<property name="text">
<string>写入Int</string>
</property>
<property name="type" stdset="0">
<string>warning</string>
</property>
</widget>
<widget class="QPushButton" name="pushButton_35">
<property name="geometry">
<rect>
<x>870</x>
<y>10</y>
<width>121</width>
<height>41</height>
</rect>
</property>
<property name="text">
<string>源码下载</string>
</property>
<property name="type" stdset="0">
<string>primary</string>
</property>
</widget>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QListWidget" name="listWidget"/>
</item>
</layout>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections/>
</ui>
三菱 FX 系列 和 A 系列 PLC 在使用 MC 协议(MELSEC Communication Protocol) 时,通常采用的是 A 兼容 1E 帧(A-1E),而不是 QnA-3E。
✅ 正确对应关系如下:
| PLC 系列 | 推荐使用的 MC 协议帧格式 | 说明 |
|---|---|---|
| FX 系列(如 FX3U、FX5U 等) | A-1E 帧(A兼容1E) | FX3U 需加装以太网模块(如 FX3U-ENET-ADP),使用 A-1E;FX5U 内置以太网,可支持 QnA-3E,但传统上仍常按 A-1E 处理。 |
| A 系列 | A-1E 帧 | A 系列是早期产品,仅支持 A-1E 帧格式。 |
| Q 系列 / L 系列 / iQ-R / iQ-F | QnA-3E 帧(或 4E) | 新一代 PLC,支持更广地址范围和更多数据类型。 |
🔍 补充说明:
-
A-1E 帧:
- 属于较早期的 MC 协议格式。
- 仅支持有限地址范围,例如:
- D 寄存器:D0~D6143、D9000~D9255
- 不支持扩展寄存器(如 D10000+)
- 通常使用 二进制格式(Binary)通信。
- 适用于 FX(带以太网模块)、A 系列。
-
QnA-3E 帧:
- 更现代、功能更强。
- 支持 D0~D12287 甚至更大范围(依型号而定)。
- 支持 位/字随机读写、浮点数、批量操作等高级功能。
- FX5U 虽属 FX 系列,但因内置以太网且架构升级,官方文档明确支持 QnA-3E。
- 如果你使用的是 FX3U + 以太网模块 或 A 系列 PLC → 使用 MC A-1E 协议。
- 如果你使用的是 FX5U、Q 系列等新型 PLC → 推荐使用 MC QnA-3E 协议。

被折叠的 条评论
为什么被折叠?



