【工控老马】欧姆龙PLC FINS指令模板整理
这是我整理的欧姆龙PLC fins指令读写测试数据,分享给大家,希望能帮助到你。
****如果你的电脑装有OMRON SYSMAC OPC Server,请把ETN-UNIT服务关闭,否则发送以下指令时将报错,导致读写不了PLC数据****
PLC中,CIO区地址=80H DM区地址=82H WR区地址=B1H。
下面以本机的IP=192.168.1.113 PLC的IP=192.168.1.10 PLC端口=9600为例说明如何使用指令(-->代表用户发送帧,<--代表PLC返回帧):
1、连接PLC
读取或写入数据前,必须先建立PLC连接,然后发以下握手命令给PLC。例如:
9:54:53-->46 49 4E 53 00 00 00 0C 00 00 00 00 00 00 00 00 00 00 00 71
9:54:53<--46 49 4E 53 00 00 00 10 00 00 00 01 00 00 00 00 00 00 00 71 00 00 00 0A
9:54:53<--连接PLC成功,握手成功!!
2、读WR.10.01 布尔型 结果=1(第2位为1)
9:57:12-->46 49 4E 53 00 00 00 1A 00 00 00 02 00 00 00 00 80 00 02 00 0A 00 00 71 00 FF 01 01 B1 00 0A 00 00 01
9:57:12<--46 49 4E 53 00 00 00 18 00 00 00 02 00 00 00 00 C0 00 02 00 71 00 00 0A 00 FF 01 01 00 00 19 B3
9:57:12<--读取成功!! 读取值:19B3(16进制) 0001100110110011(2进制)
3、读WR.10.0 整型 结果=12
9:59:17-->46 49 4E 53 00 00 00 1A 00 00 00 02 00 00 00 00 80 00 02 00 0A 00 00 71 00 FF 01 01 B1 00 0A 00 00 01
9:59:17<--46 49 4E 53 00 00 00 18 00 00 00 02 00 00 00 00 C0 00 02 00 71 00 00 0A 00 FF 01 01 00 00 00 0C
9:59:17<--读取成功!! 读取值:000C(16进制) 12(10进制)
4:读WR.10.0 双整型 结果=1065025548
10:00:17-->46 49 4E 53 00 00 00 1A 00 00 00 02 00 00 00 00 80 00 02 00 0A 00 00 71 00 FF 01 01 B1 00 0A 00 00 02
10:00:17<--46 49 4E 53 00 00 00 1A 00 00 00 02 00 00 00 00 C0 00 02 00 71 00 00 0A 00 FF 01 01 00 00 00 0C 3F 7B
10:00:17<--读取成功!! 读取值:000C3F7B(16进制) 1065025548(10进制)
5、读DM.10.0 浮点型 结果=1.5
10:02:21-->46 49 4E 53 00 00 00 1A 00 00 00 02 00 00 00 00 80 00 02 00 0A 00 00 71 00 FF 01 01 82 00 0A 00 00 02
10:02:21<--46 49 4E 53 00 00 00 1A 00 00 00 02 00 00 00 00 C0 00 02 00 71 00 00 0A 00 FF 01 01 00 00 00 00 3F C0
10:02:21<--读取成功!! 读取值:00003FC0(16进制) 1.5(浮点数)
6、读WR.480.0 字符型 长度6位 结果=HJK12345678
10:05:30-->46 49 4E 53 00 00 00 1A 00 00 00 02 00 00 00 00 80 00 02 00 0A 00 00 71 00 FF 01 01 B1 01 E0 00 00 06
10:05:30<--46 49 4E 53 00 00 00 22 00 00 00 02 00 00 00 00 C0 00 02 00 71 00 00 0A 00 FF 01 01 00 00 48 4A 4B 31 32 33 34 35 36 37 38 00
10:05:30<--读取成功!! 读取值:484A4B313233343536373800(16进制) HJK12345678(字符串)
7、写WR.10.01 写入值0 布尔型
10:05:17-->46 49 4E 53 00 00 00 1A 00 00 00 02 00 00 00 00 80 00 02 00 0A 00 00 71 00 FF 01 01 B1 00 0A 00 00 01
10:05:17<--46 49 4E 53 00 00 00 18 00 00 00 02 00 00 00 00 C0 00 02 00 71 00 00 0A 00 FF 01 01 00 00 00 0F
10:05:17-->原始值:000F(16进制) 0000000000001111(2进制) 写入值:000D(16进制) 0000000000001101(2进制)
10:05:17-->46 49 4E 53 00 00 00 1C 00 00 00 02 00 00 00 00 80 00 02 00 0A 00 00 71 00 00 01 02 B1 00 0A 00 00 01 00 0D
10:05:17<--46 49 4E 53 00 00 00 16 00 00 00 02 00 00 00 00 C0 00 02 00 71 00 00 0A 00 00 01 02 00 00
10:05:17<--写入成功!!
8、写WR.10.0 写入值6 整型
10:06:46-->写入值:6(10进制) 0006(16进制)
10:06:46-->46 49 4E 53 00 00 00 1C 00 00 00 02 00 00 00 00 80 00 02 00 0A 00 00 71 00 00 01 02 B1 00 0A 00 00 01 00 06
10:06:46<--46 49 4E 53 00 00 00 16 00 00 00 02 00 00 00 00 C0 00 02 00 71 00 00 0A 00 00 01 02 00 00
10:06:46<--写入成功!!
9、写WR.10.0 写入值1065025588 双整型
10:08:16-->写入值:1065025588(10进制) 3F7B0034(16进制)
10:08:16-->46 49 4E 53 00 00 00 1C 00 00 00 02 00 00 00 00 80 00 02 00 0A 00 00 71 00 00 01 02 B1 00 0A 00 00 01 00 34
10:08:16<--46 49 4E 53 00 00 00 16 00 00 00 02 00 00 00 00 C0 00 02 00 71 00 00 0A 00 00 01 02 00 00
10:08:16<--写入成功!!
10:08:16-->46 49 4E 53 00 00 00 1C 00 00 00 02 00 00 00 00 80 00 02 00 0A 00 00 71 00 00 01 02 B1 00 0B 00 00 01 3F 7B
10:08:16<--46 49 4E 53 00 00 00 16 00 00 00 02 00 00 00 00 C0 00 02 00 71 00 00 0A 00 00 01 02 00 00
10:08:16<--写入成功!!
10、写DM.10.0 写入值0.68 浮点型
10:11:32-->写入值:0.68(浮点数) 7B142E3F(16进制)
10:11:32-->46 49 4E 53 00 00 00 1C 00 00 00 02 00 00 00 00 80 00 02 00 0A 00 00 71 00 00 01 02 82 00 0A 00 00 01 14 7B
10:11:32<--46 49 4E 53 00 00 00 16 00 00 00 02 00 00 00 00 C0 00 02 00 71 00 00 0A 00 00 01 02 00 00
10:11:32<--写入成功!!
10:11:32-->46 49 4E 53 00 00 00 1C 00 00 00 02 00 00 00 00 80 00 02 00 0A 00 00 71 00 00 01 02 82 00 0B 00 00 01 3F 2E
10:11:32<--46 49 4E 53 00 00 00 16 00 00 00 02 00 00 00 00 C0 00 02 00 71 00 00 0A 00 00 01 02 00 00
10:11:32<--写入成功!!
11、写WR.480.0 写入值HJK12345678 字符型
10:17:02-->写入值:HJK12345678(字符串) 484A4B313233343536373800(16进制)
10:17:02-->46 49 4E 53 00 00 00 1C 00 00 00 02 00 00 00 00 80 00 02 00 0A 00 00 71 00 00 01 02 B1 01 E0 00 00 01 48 4A
10:17:02<--46 49 4E 53 00 00 00 16 00 00 00 02 00 00 00 00 C0 00 02 00 71 00 00 0A 00 00 01 02 00 00
10:17:02<--写入成功!!
10:17:02-->46 49 4E 53 00 00 00 1C 00 00 00 02 00 00 00 00 80 00 02 00 0A 00 00 71 00 00 01 02 B1 01 E1 00 00 01 4B 31
10:17:02<--46 49 4E 53 00 00 00 16 00 00 00 02 00 00 00 00 C0 00 02 00 71 00 00 0A 00 00 01 02 00 00
10:17:02<--写入成功!!
10:17:02-->46 49 4E 53 00 00 00 1C 00 00 00 02 00 00 00 00 80 00 02 00 0A 00 00 71 00 00 01 02 B1 01 E2 00 00 01 32 33
10:17:02<--46 49 4E 53 00 00 00 16 00 00 00 02 00 00 00 00 C0 00 02 00 71 00 00 0A 00 00 01 02 00 00
10:17:02<--写入成功!!
10:17:02-->46 49 4E 53 00 00 00 1C 00 00 00 02 00 00 00 00 80 00 02 00 0A 00 00 71 00 00 01 02 B1 01 E3 00 00 01 34 35
10:17:02<--46 49 4E 53 00 00 00 16 00 00 00 02 00 00 00 00 C0 00 02 00 71 00 00 0A 00 00 01 02 00 00
10:17:02<--写入成功!!
10:17:02-->46 49 4E 53 00 00 00 1C 00 00 00 02 00 00 00 00 80 00 02 00 0A 00 00 71 00 00 01 02 B1 01 E4 00 00 01 36 37
10:17:02<--46 49 4E 53 00 00 00 16 00 00 00 02 00 00 00 00 C0 00 02 00 71 00 00 0A 00 00 01 02 00 00
10:17:02<--写入成功!!
10:17:02<--完成!!
扫描左侧的二维码可以任意下载无限个程序源码或技术文档~
工控老马资料窝,中国两大专业工控技术文档及程序源码免费下载微信小程序之一!
找技术文档及程序源码,就上工控老马资料窝~