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.
?
一、首先將網(wǎng)絡接口與工控機或路由器連接
First, connect the network interface to the industrial computer or router
注意連接路由器之前,需要本地網(wǎng)絡連接將驅動器的IP地址固定為靜態(tài)IP地址并分配IP地址到路由器的同一個網(wǎng)段內
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?啟用靜態(tài)IP地址 IP地址設置:2011 子網(wǎng)掩碼: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. |
子網(wǎng)掩碼 |
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
正確連接后,在網(wǎng)絡中會有一個N5的設備產(chǎn)生,并可以查看N5的IP地址
?
二、下載網(wǎng)絡調試小工具,以firefox的RESTClient的組件為例
首先添加自定義HTTP頭字段
三,發(fā)送讀取命令
用GET獲取對象數(shù)據(jù)
如查詢電流(2031)數(shù)據(jù):
http://169.254.217.51/od/2031/00
數(shù)據(jù)為16進制:0x00000834=2100(十進制)
CURL 命令
curl -X GET -H 'Content-Type: application/x-www-form-urlencoded' -i 'http://169.254.217.51/od/2031/00'
四、發(fā)送寫入命令
用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"'