[PLC]三菱FX 5U Socket通讯程序
三菱FX 5U Socket通讯程序
1.Works3的相关通讯设置:
2.Socket通讯FB块梯形图:
3.Socket通讯FB块梯形图导出的CSV文件:
LOADE-20210722(备份) | ||||||
机型信息: | FX5CPU FX5U | |||||
步号 | 行间声明 | 指令 | I/O(软元件) | 空白栏 | PI声明 | 注解 |
0 | Socket Open 连接 No.1-No.8 ==> SD10680.0-7 SD10681.0-7 | |||||
68 | LD | OPEN | ||||
70 | ANI | BIT10680 | ||||
72 | ANI | BIT10681 | ||||
74 | MOVP | H0 | ||||
OPCtrWord | ||||||
78 | SP.SOCOPEN | "U0" | ||||
SocNum | ||||||
OPCtrWord | ||||||
OPEN_M[0] | ||||||
88 | LD | OPEN_M[0] | ||||
90 | MPS | |||||
91 | ANI | OPEN_M[1] | ||||
93 | SET | OPEN_M[2] | ||||
95 | MPP | |||||
96 | AND | OPEN_M[1] | ||||
98 | SET | OPEN_M[3] | ||||
100 | Socket Close 连接 No.1-No.8 ==> SD10680.0-7 SD10681.0-7 | |||||
164 | LDF | BIT10680 | ||||
168 | AND | BIT10681 | ||||
170 | PLS | C_bit | ||||
173 | LD | CLOSE | ||||
175 | AND | BIT10680 | ||||
177 | OR | C_bit | ||||
179 | ANI | C_Lock | ||||
181 | SP.SOCCLOSE | "U0" | ||||
SocNum | ||||||
CLCtrWord | ||||||
CLOSE_M[0] | ||||||
191 | SET | C_Lock | ||||
193 | LD | CLOSE_M[0] | ||||
195 | MPS | |||||
196 | ANI | CLOSE_M[1] | ||||
198 | OUT | CLOSE_M[2] | ||||
200 | MRD | |||||
201 | AND | CLOSE_M[1] | ||||
203 | OUT | CLOSE_M[3] | ||||
205 | MPP | |||||
206 | RST | C_Lock | ||||
208 | RECV DATA 接收数据 | |||||
228 | LD | RecvTrip | ||||
230 | AND | BIT10680 | ||||
232 | AND | BIT10682 | ||||
234 | ANI | RECV_M[0] | ||||
236 | SP.SOCRCV | "U0" | ||||
SocNum | ||||||
RecvCtrWord | ||||||
RecvDataBuff | ||||||
RECV_M[0] | ||||||
248 | LD | RECV_M[0] | ||||
250 | MPS | |||||
251 | ANI | RECV_M[1] | ||||
253 | OUT | RECV_M[2] | ||||
255 | MPP | |||||
256 | AND | RECV_M[1] | ||||
258 | OUT | RECV_M[3] | ||||
260 | SEND DATA 发送数据 | |||||
280 | LD | SendTrip | ||||
282 | AND | BIT10680 | ||||
284 | SP.SOCSND | "U0" | ||||
SocNum | ||||||
SendCtrWord | ||||||
SendDataBuff | ||||||
SEND_M |
4.Socket通讯FB块的局部标签:
5.Socket通讯FB块局部标签导出的CSV文件:
LOADE-20210722(备份) | |||||||
类 | 标签名 | 数据类型 | 常数 | 初始值 | 分配(软元件/标签) | 地址 | 注释 |
VAR | OPEN_M | ARRAY [0..3] OF BOOL | 打开控制 .2正常 .3异常 | ||||
VAR | CLOSE_M | ARRAY [0..3] OF BOOL | 关闭控制 .2正常 .3异常 | ||||
VAR | SEND_M | ARRAY [0..3] OF BOOL | 发送控制 .2正常 .3异常 | ||||
VAR | RECV_M | ARRAY [0..3] OF BOOL | 接收控制 .2正常 .3异常 | ||||
VAR_INPUT | SocNum | WORD | 连接号( K1 - K8) | ||||
VAR_INPUT | OPEN | BOOL | 打开请求 | ||||
VAR_INPUT | CLOSE | BOOL | 关闭请求 | ||||
VAR | C_bit | BOOL | 关闭位 | ||||
VAR | C_Lock | BOOL | 关闭互锁 | ||||
VAR_INPUT | BIT10680 | BOOL | 开放结束信号 .0-.7 | ||||
VAR_INPUT | BIT10681 | BOOL | 开放请求信号 .0-.7 | ||||
VAR_INPUT | BIT10682 | BOOL | 接收状态信号 .0-.7 | ||||
VAR | OPCtrWord | ARRAY [0..9] OF WORD | 打开控制字(设置模式) | ||||
VAR | CLCtrWord | ARRAY [0..1] OF WORD | 关闭控制字 | ||||
VAR_INPUT | RecvTrip | BOOL | 触发接收 | ||||
VAR_INPUT | SendTrip | BOOL | 触发发送 | ||||
VAR | RecvCtrWord | ARRAY [0..1] OF WORD | 接收控制字 | ||||
VAR_OUTPUT | RecvDataBuff | ARRAY [0..19] OF WORD | 接收数据存储 | ||||
VAR | SendCtrWord | ARRAY [0..1] OF WORD | 发送控制字 | ||||
VAR_INPUT | SendDataBuff | ARRAY [0..19] OF WORD | 发送数据存储 |