Ethernet / IP controller basic debug via pc Browser
Actual application scenario: endless conveyor belt. In this case, there are 310 stations. The user sends the station number through Ethernet to achieve the purpose of the motor running to the specified station. In this process, the driver automatically calculates the optimal path, such as 309 to 1 instead of going back 308 but going forward 2.
Core technical points: (1) The internal program of the driver implements logical operations and calculates the optimal path to run. (2) Point data interacts with external industrial computer through etherne communication.
Implementation plan: Through nanoj to achieve logical operations and path planning, etc., please contact Yanlan for more details.
一、首先将网络接口与工控机或路由器连接
First, connect the network interface to the industrial computer or router
注意连接路由器之前,需要本地网络连接将驱动器的IP地址固定为静态IP地址并分配IP地址到路由器的同一个网段内
Note Before connecting the router, you need a local network connection to fix the drive's IP address to a static IP address and assign the IP address to the same network segment of the router
To fix the IP address:
配置项目 |
对象 |
值对应的含义 |
IP-Configuration |
2010 |
=0x0000000E 自动获取IP和DHCP =0x00000001 启用静态IP地址 IP地址设置:2011 子网掩码:2012 |
IP地址IPv4-Address |
2011 |
The address 192.168.2.0 is first converted to the hexadecimal notation and then yields the following configuration value: 192 => C0h 168 => A8h 2 => 02h 0 => 0 The associated setting value is then C0A80200h. |
子网掩码 |
2012 |
例如:255.255.255.0 255 => FFh 0 => 0 2012=0xFFFFFF00 |
After connecting properly, there will be an N5 device in the network, and you can view the IP address of N5
正确连接后,在网络中会有一个N5的设备产生,并可以查看N5的IP地址
二、下载网络调试小工具,以firefox的RESTClient的组件为例
首先添加自定义HTTP头字段
三,发送读取命令
用GET获取对象数据
如查询电流(2031)数据:
http://169.254.217.51/od/2031/00
数据为16进制:0x00000834=2100(十进制)
CURL 命令
curl -X GET -H 'Content-Type: application/x-www-form-urlencoded' -i 'http://169.254.217.51/od/2031/00'
四、发送写入命令
用POST写入对象命令
http://169.254.217.51/od/2400/02
之前加载的自定义头文件
正文
"00000001" //2400:02=1
"00000064" //2400:02=100
curl -X POST -H 'Content-Type: application/x-www-form-urlencoded' -i 'http://169.254.217.51/od/2400/02' --data '"00000001"'
curl -X POST -H 'Content-Type: application/x-www-form-urlencoded' -i 'http://169.254.217.51/od/2400/02' --data '"00000064"'