diff --git a/APP_Framework/Applications/control_app/plc_demo/mitsubishi/Makefile b/APP_Framework/Applications/control_app/plc_demo/mitsubishi/Makefile index d2dd47014..845e91dc0 100755 --- a/APP_Framework/Applications/control_app/plc_demo/mitsubishi/Makefile +++ b/APP_Framework/Applications/control_app/plc_demo/mitsubishi/Makefile @@ -1,3 +1,3 @@ -SRC_FILES := mitsubishi_fx3u.c mitsubishi_fx5u.c mitsubishi_fx2n.c mitsubishi_q02u.c mitsubishi_q06h.c +SRC_FILES := mitsubishi_fx3u.c mitsubishi_fx5u.c mitsubishi_fx2n.c mitsubishi_q02u.c mitsubishi_q06h.c mitsubishi_q03udv.c include $(KERNEL_ROOT)/compiler.mk diff --git a/APP_Framework/Applications/control_app/plc_demo/mitsubishi/README.md b/APP_Framework/Applications/control_app/plc_demo/mitsubishi/README.md index c143acaee..7fd213d9b 100644 --- a/APP_Framework/Applications/control_app/plc_demo/mitsubishi/README.md +++ b/APP_Framework/Applications/control_app/plc_demo/mitsubishi/README.md @@ -51,3 +51,38 @@ 测试结果: ![](./image/q06h_communication_test.png) + + + +## 三菱Q03UDV通信测试 + +### 通信接线及参数设置 + +* 接口 + * 本次测试通过Q03UDV拓展的模块QJ71E71_100模块的网口模块进行MC—3E通信测试。网口模块IP:192.168.250.21 端口号:4000 + * 本次测试还可通过Q03UDV自身网口进行MC—3E通信测试。网口模块IP:192.168.250.22 端口号:6000 + +### 存储区 + +- 存储区 I,Q,M,D区。 + +### 通信测试 + +- 共测试BOOL,INT16,FLOAT共三种类型数据。 + + +- 测试M区及D区数据。 + +- 测试截图: + + 扩展模块解析完成的配方为 + + ![](./image/q03udv_recipe.png) + + CPU自带网口解析完成的配方为 + + ![](image/Q03udv_recipe_1.png) + + 测试结果: + + ![](./image/q03udv_communication_test.png) diff --git a/APP_Framework/Applications/control_app/plc_demo/mitsubishi/image/Q03udvPLC.jpg b/APP_Framework/Applications/control_app/plc_demo/mitsubishi/image/Q03udvPLC.jpg new file mode 100644 index 000000000..757b8c004 Binary files /dev/null and b/APP_Framework/Applications/control_app/plc_demo/mitsubishi/image/Q03udvPLC.jpg differ diff --git a/APP_Framework/Applications/control_app/plc_demo/mitsubishi/image/Q03udv_recipe_1.png b/APP_Framework/Applications/control_app/plc_demo/mitsubishi/image/Q03udv_recipe_1.png new file mode 100644 index 000000000..4087d421f Binary files /dev/null and b/APP_Framework/Applications/control_app/plc_demo/mitsubishi/image/Q03udv_recipe_1.png differ diff --git a/APP_Framework/Applications/control_app/plc_demo/mitsubishi/image/q03udv_communication_test.png b/APP_Framework/Applications/control_app/plc_demo/mitsubishi/image/q03udv_communication_test.png new file mode 100644 index 000000000..e32d3ed89 Binary files /dev/null and b/APP_Framework/Applications/control_app/plc_demo/mitsubishi/image/q03udv_communication_test.png differ diff --git a/APP_Framework/Applications/control_app/plc_demo/mitsubishi/image/q03udv_recipe.png b/APP_Framework/Applications/control_app/plc_demo/mitsubishi/image/q03udv_recipe.png new file mode 100644 index 000000000..341ed3972 Binary files /dev/null and b/APP_Framework/Applications/control_app/plc_demo/mitsubishi/image/q03udv_recipe.png differ diff --git a/APP_Framework/Applications/control_app/plc_demo/mitsubishi/mitsubishi_q03udv.c b/APP_Framework/Applications/control_app/plc_demo/mitsubishi/mitsubishi_q03udv.c new file mode 100644 index 000000000..9c374c946 --- /dev/null +++ b/APP_Framework/Applications/control_app/plc_demo/mitsubishi/mitsubishi_q03udv.c @@ -0,0 +1,64 @@ +/* + * 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. + * You may obtain a copy of Mulan PSL v2 at: + * http://license.coscl.org.cn/MulanPSL2 + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, + * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, + * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. + * See the Mulan PSL v2 for more details. + */ + +/** + * @file mitsubishi_q03udv.c + * @brief PLC MITSUBISHI Q03udv app + * @version 3.0 + * @author AIIT XUOS Lab + * @date 2023.10.30 + */ + +#include + +extern int Adapter4GActive(void); + +void ControlQ03udvTest(void) +{ + int i, j = 0; + int read_data_length = 0; + uint8_t read_data[128] = {0}; + +#ifdef CONNECTION_ADAPTER_4G + Adapter4GActive(); +#endif + + ControlProtocolType melsec_3e_protocol = ControlProtocolFind(); + if (NULL == melsec_3e_protocol) { + printf("%s get melsec 3e protocol %p failed\n", __func__, melsec_3e_protocol); + return; + } + + printf("%s get melsec 3e protocol %p successfull\n", __func__, melsec_3e_protocol); + + if (CONTROL_REGISTERED == melsec_3e_protocol->protocol_status) { + ControlProtocolOpen(melsec_3e_protocol); + + for (;;) { + read_data_length = ControlProtocolRead(melsec_3e_protocol, read_data, sizeof(read_data)); + printf("%s read [%d] melsec 3c 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(melsec_3c_protocol); + } +} +PRIV_SHELL_CMD_FUNCTION(ControlQ03udvTest, Mitsubishi Q03udv Demo, PRIV_SHELL_CMD_MAIN_ATTR); + +