c语言采集西门子PLC数据,西门子PLC数据采集

一、硬件环境

1、海创Box智能网关

2、西门子PLC (ST20 S7-200)

20190319201137.png

二、产品连接方式

20190319201459.png

三、产品配置

奥迈智能网关 请参考《奥迈智能网关设置》

**西门子PLC ** (ST20 S7-200) 配置好设备连接ip

20190319201554.png

20190319202130.png

四、项目部署调试

打开海创-IIoT。本次教程需要用到如下节点,在左侧节点栏中拖拽出使用

定时器周期性触发输入时间戳或者相应的字符

20190319202403.png

S7西门子用于读取S7西门子通信协议的设备数据

20190319202428.png

调试用于调试节点输出

20190319202446.png

配置相应节点后配置界面如下:

20190319202520.png

节点配置:

定时器设置成周期性触发,主要当触发流程使用,具体配置如下图

20190319202810.png

S7西门子设置如下配置,即可取到M区0.1的地址数据

20190319202849.png

20190319202940.png

调试在右侧调试窗口输出调试结果,无需配置

部署调试:

按照以上教程配置好流程后,点击部署,部署成功后程序开始运行,就会在调试窗口输出相应的结果,调试结果如下

20190319203021.png

[

{

"id": "3c9559.b5d63aa8",

"type": "iot-s7",

"z": "41f61d2.fbe09e4",

"name": "",

"server": "f0605fb0.3a733",

"columns": [

{

"Key": "2号跑马灯",

"Label": "2号跑马灯",

"Address": "M0.2",

"Arithmetic": ""

}

],

"x": 340,

"y": 380,

"wires": [

[

"1fa324c1.eb258b"

]

]

},

{

"id": "1421da2b.ec0216",

"type": "inject",

"z": "41f61d2.fbe09e4",

"name": "",

"topic": "",

"payload": "",

"payloadType": "date",

"repeat": "",

"crontab": "",

"once": false,

"onceDelay": 0.1,

"x": 240,

"y": 380,

"wires": [

[

"3c9559.b5d63aa8"

]

]

},

{

"id": "1fa324c1.eb258b",

"type": "debug",

"z": "41f61d2.fbe09e4",

"name": "",

"active": true,

"tosidebar": true,

"console": false,

"tostatus": false,

"complete": "true",

"x": 480,

"y": 380,

"wires": []

},

{

"id": "f0605fb0.3a733",

"type": "iot-s7-client",

"z": "",

"name": "",

"communicate": "TCP",

"host": "192.168.7.163",

"post": "102",

"baudrate": "9600",

"databits": "8",

"stopbits": "1",

"parity": "None",

"expand": {},

"connmode": "tsap",

"rack": "0",

"slot": "2",

"localtsaphi": "10",

"localtsaplo": "00",

"remotetsaphi": "03",

"remotetsaplo": "00",

"verbose": "default"

}

]

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值