diff --git a/APP_Framework/Applications/control_app/plc_demo/delta/README.md b/APP_Framework/Applications/control_app/plc_demo/delta/README.md index 16ba6225c..6d0dec6b6 100644 --- a/APP_Framework/Applications/control_app/plc_demo/delta/README.md +++ b/APP_Framework/Applications/control_app/plc_demo/delta/README.md @@ -1,22 +1,48 @@ -# 台达 DVP通信测试 +# 台达 PLC与矽达通ARM通信测试 [TOC] -## 通信接线及参数设置 +## 台达DVP与矽达通ARM通信处测试 + +### 通信接线及参数设置 * 网口 * 通过自带 RJ45 网口连接 * 网口参数:IP:192.168.250.27 Port:502 * 测试的协议:Modbus TCP -## 存储区 +### 存储区 - 含M,D,X,Y。台达PLC中 各存储区地址和Modbus地址有明确的对应表,详见台达DVP协议解析测试文档。 -## 通信测试 +### 通信测试 - 共测试BOOL,INT16,INT32,FLOAT 共四种类型数据。 - 测试D区,M区和Y区。 +## 台达AS332T与矽达通ARM通信处测试 + +### 通信接线及参数设置 + +* 网口 + * 通过自带 RJ45 网口连接 + * 网口参数:IP:192.168.250.5 Port:502 + * 测试的协议:Modbus TCP + +### 存储区 + +- 含M,D,X,Y。台达PLC中 各存储区地址和Modbus地址有明确的对应表,详见台达AS332T协议解析测试文档。 + +### 通信测试结果 + +- 共测试BOOL,INT16,INT32,FLOAT 共四种类型数据。 +- 测试D区,M区和Y区。 + +![](./image/recipe.png) + +![](./image/test_result1.png) + +![](./image/test_result2.png) + diff --git a/APP_Framework/Applications/control_app/plc_demo/delta/delta_as332t.c b/APP_Framework/Applications/control_app/plc_demo/delta/delta_as332t.c index 1b329319a..c60de8b64 100644 --- a/APP_Framework/Applications/control_app/plc_demo/delta/delta_as332t.c +++ b/APP_Framework/Applications/control_app/plc_demo/delta/delta_as332t.c @@ -1,4 +1,6 @@ /* + * Copyright (c) 2022 AIIT XUOS Lab + /* * Copyright (c) 2022 AIIT XUOS Lab * XiUOS is licensed under Mulan PSL v2. * You can use this software according to the terms and conditions of the Mulan PSL v2. @@ -15,9 +17,53 @@ * @brief PLC DELTA AS332T app * @version 3.0 * @author AIIT XUOS Lab - * @date 2022.9.27 + * @date 2022.10.10 */ +#include + +extern int Adapter4GActive(void); + +void ControlDeltaas332tTest(void) +{ + int i, j = 0; + int read_data_length = 0; + uint8_t read_data[128] = {0}; + +#ifdef CONNECTION_ADAPTER_4G + Adapter4GActive(); +#endif + + ControlProtocolType modbus_tcp_protocol = ControlProtocolFind(); + if (NULL == modbus_tcp_protocol) { + printf("%s get modbus tcp protocol %p failed\n", __func__, modbus_tcp_protocol); + return; + } + + printf("%s get modbus tcp protocol %p successfull\n", __func__, modbus_tcp_protocol); + + if (CONTROL_REGISTERED == modbus_tcp_protocol->protocol_status) { + ControlProtocolOpen(modbus_tcp_protocol); + + for (;;) { + read_data_length = ControlProtocolRead(modbus_tcp_protocol, read_data, sizeof(read_data)); + printf("%s read [%d] modbus tcp data %d using receipe file\n", __func__, i, read_data_length); + if (read_data_length) { + for (j = 0; j < read_data_length; j ++) { + printf("j %d data 0x%x\n", j, read_data[j]); + } + } + i++; + memset(read_data, 0, sizeof(read_data)); + PrivTaskDelay(10000); + } + + //ControlProtocolClose(modbus_tcp_protocol); + } +} +PRIV_SHELL_CMD_FUNCTION(ControlDeltaas332tTest, Delta as332t Demo, PRIV_SHELL_CMD_MAIN_ATTR); + + diff --git a/APP_Framework/Applications/control_app/plc_demo/delta/image/delta_as332t.jpg b/APP_Framework/Applications/control_app/plc_demo/delta/image/delta_as332t.jpg new file mode 100644 index 000000000..a648395ad Binary files /dev/null and b/APP_Framework/Applications/control_app/plc_demo/delta/image/delta_as332t.jpg differ diff --git a/APP_Framework/Applications/control_app/plc_demo/delta/image/delta_dvp.jpg b/APP_Framework/Applications/control_app/plc_demo/delta/image/delta_dvp.jpg new file mode 100644 index 000000000..c4d93ddf6 Binary files /dev/null and b/APP_Framework/Applications/control_app/plc_demo/delta/image/delta_dvp.jpg differ diff --git a/APP_Framework/Applications/control_app/plc_demo/delta/image/recipe.png b/APP_Framework/Applications/control_app/plc_demo/delta/image/recipe.png new file mode 100644 index 000000000..14fc4505e Binary files /dev/null and b/APP_Framework/Applications/control_app/plc_demo/delta/image/recipe.png differ diff --git a/APP_Framework/Applications/control_app/plc_demo/delta/image/test_result1.png b/APP_Framework/Applications/control_app/plc_demo/delta/image/test_result1.png new file mode 100644 index 000000000..fc304c2dd Binary files /dev/null and b/APP_Framework/Applications/control_app/plc_demo/delta/image/test_result1.png differ diff --git a/APP_Framework/Applications/control_app/plc_demo/delta/image/test_result2.png b/APP_Framework/Applications/control_app/plc_demo/delta/image/test_result2.png new file mode 100644 index 000000000..bdca3c1e6 Binary files /dev/null and b/APP_Framework/Applications/control_app/plc_demo/delta/image/test_result2.png differ diff --git a/APP_Framework/Applications/control_app/plc_demo/delta/json/test_recipe_delta_as332t_tcp.json b/APP_Framework/Applications/control_app/plc_demo/delta/json/test_recipe_delta_as332t_tcp.json new file mode 100644 index 000000000..8f80bf790 --- /dev/null +++ b/APP_Framework/Applications/control_app/plc_demo/delta/json/test_recipe_delta_as332t_tcp.json @@ -0,0 +1,79 @@ +{ + "device_id": 1, + "device_name": "DELTA_AS332T_TCP", + "communication_type": 0, + "socket_config": { + "plc_ip": "192.168.250.5", + "local_ip": "192.168.250.233", + "gateway": "192.168.250.1", + "netmask": "255.255.254.0", + "port": 502 + }, + "protocol_type": 2, + "read_period": 1000, + "read_item_list": [ + { + "value_name": "M16", + "value_type": 1, + "function_code": 1, + "start_address": 16, + "quantity": 1 + }, + { + "value_name": "M17", + "value_type": 1, + "function_code": 1, + "start_address": 17, + "quantity": 1 + }, + { + "value_name": "M18", + "value_type": 1, + "function_code": 1, + "start_address": 30, + "quantity": 1 + }, + { + "value_name": "D300", + "value_type": 3, + "function_code": 3, + "start_address": 300, + "quantity": 1 + }, + { + "value_name": "D301", + "value_type": 3, + "function_code": 3, + "start_address": 302, + "quantity": 1 + }, + { + "value_name": "D302", + "value_type": 4, + "function_code": 3, + "start_address": 302, + "quantity": 2 + }, + { + "value_name": "D304", + "value_type": 9, + "function_code": 3, + "start_address": 304, + "quantity": 2 + }, + { + "value_name": "Y1.0", + "value_type": 1, + "function_code": 1, + "start_address": 40976, + "quantity": 1 + }, + { + "value_name": "Y10", + "value_type": 3, + "function_code": 3, + "start_address": 40970, + "quantity": 1 + } + ] +} \ No newline at end of file diff --git a/APP_Framework/Applications/control_app/plc_demo/delta/test_recipe_delta_dvp.json b/APP_Framework/Applications/control_app/plc_demo/delta/json/test_recipe_delta_dvp.json similarity index 100% rename from APP_Framework/Applications/control_app/plc_demo/delta/test_recipe_delta_dvp.json rename to APP_Framework/Applications/control_app/plc_demo/delta/json/test_recipe_delta_dvp.json