diff --git a/APP_Framework/Applications/control_app/plc_demo/Makefile b/APP_Framework/Applications/control_app/plc_demo/Makefile index 747b6d28b..871617c50 100755 --- a/APP_Framework/Applications/control_app/plc_demo/Makefile +++ b/APP_Framework/Applications/control_app/plc_demo/Makefile @@ -1,3 +1,3 @@ -SRC_DIR := advantech beckhoff br delta mitsubishi omron schneider siemens ge xinje inovance keyence +SRC_DIR := advantech beckhoff br delta mitsubishi omron schneider siemens ge xinje inovance keyence panasonic include $(KERNEL_ROOT)/compiler.mk diff --git a/APP_Framework/Applications/control_app/plc_demo/panasonic/Makefile b/APP_Framework/Applications/control_app/plc_demo/panasonic/Makefile new file mode 100644 index 000000000..796e6874a --- /dev/null +++ b/APP_Framework/Applications/control_app/plc_demo/panasonic/Makefile @@ -0,0 +1,3 @@ +SRC_FILES := panasonic_fpxh_tcp.c panasonic_fpxh_uart.c + +include $(KERNEL_ROOT)/compiler.mk \ No newline at end of file diff --git a/APP_Framework/Applications/control_app/plc_demo/panasonic/Readme.md b/APP_Framework/Applications/control_app/plc_demo/panasonic/Readme.md new file mode 100644 index 000000000..c27a7ed43 --- /dev/null +++ b/APP_Framework/Applications/control_app/plc_demo/panasonic/Readme.md @@ -0,0 +1,39 @@ +# 松下通信测试 + +[TOC] + +## 松下FPXHC40ET通信测试 + +### 通信接线及参数设置 + +* 网口和串口 + * FPXHC40ET自带miniUSB,用于程序的下载。本体自带的串口为RS232。 + * 本体自带的网口可用于Modbus TCP,Ethernet/IP等通信。目前用于Modbus TCP通信测试,网口IP:192.168.250.51 Port:502 + * 通过本体拓展FPXH-COM3通信模板,可用于Modbus RTU通信。串口接线:S+接485A;S-接485B。 + * 串口模块通信参数配置:通信速率:115200;数据位:8bit;停止位:1bit;校验:偶校验 + +### 存储区 + +- 存储区 X,Y,R,D,L区等。 + +### 通信测试 + +- 共测试BOOL,INT16等类型数据。 + + +- 测试Y区,R区及DT区数据。 + + +- 测试截图: + + 测试PLC环境搭建: + + ![](./image/PLC_xidatong.jpg) + + 解析完成的配方为: + + ![](./image/panasonic_fpxh_recipe.png) + + 测试结果: + + ![](./image/panasonic_fpxh_communication_test.png) \ No newline at end of file diff --git a/APP_Framework/Applications/control_app/plc_demo/panasonic/image/PLC_xidatong.jpg b/APP_Framework/Applications/control_app/plc_demo/panasonic/image/PLC_xidatong.jpg new file mode 100644 index 000000000..703290392 Binary files /dev/null and b/APP_Framework/Applications/control_app/plc_demo/panasonic/image/PLC_xidatong.jpg differ diff --git a/APP_Framework/Applications/control_app/plc_demo/panasonic/image/panasonic-fpxh.jpg b/APP_Framework/Applications/control_app/plc_demo/panasonic/image/panasonic-fpxh.jpg new file mode 100644 index 000000000..5bf2b9103 Binary files /dev/null and b/APP_Framework/Applications/control_app/plc_demo/panasonic/image/panasonic-fpxh.jpg differ diff --git a/APP_Framework/Applications/control_app/plc_demo/panasonic/image/panasonic_fpxh_communication_test.png b/APP_Framework/Applications/control_app/plc_demo/panasonic/image/panasonic_fpxh_communication_test.png new file mode 100644 index 000000000..c3765e56b Binary files /dev/null and b/APP_Framework/Applications/control_app/plc_demo/panasonic/image/panasonic_fpxh_communication_test.png differ diff --git a/APP_Framework/Applications/control_app/plc_demo/panasonic/image/panasonic_fpxh_recipe.png b/APP_Framework/Applications/control_app/plc_demo/panasonic/image/panasonic_fpxh_recipe.png new file mode 100644 index 000000000..3f0c45778 Binary files /dev/null and b/APP_Framework/Applications/control_app/plc_demo/panasonic/image/panasonic_fpxh_recipe.png differ diff --git a/APP_Framework/Applications/control_app/plc_demo/panasonic/panasonic_fpxh_tcp.c b/APP_Framework/Applications/control_app/plc_demo/panasonic/panasonic_fpxh_tcp.c new file mode 100644 index 000000000..cbd779c02 --- /dev/null +++ b/APP_Framework/Applications/control_app/plc_demo/panasonic/panasonic_fpxh_tcp.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 panasonic_fpxh_ethernet.c + * @brief PLC panasonic fpxh app + * @version 3.0 + * @author AIIT XUOS Lab + * @date 2023.11.22 + */ + +#include + +extern int Adapter4GActive(void); + +void ControlPanasonicFpxhTCPTest(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(ControlPanasonicFpxhTCPTest, panasonic Fpxh TCP Demo, PRIV_SHELL_CMD_MAIN_ATTR); + + diff --git a/APP_Framework/Applications/control_app/plc_demo/panasonic/panasonic_fpxh_uart.c b/APP_Framework/Applications/control_app/plc_demo/panasonic/panasonic_fpxh_uart.c new file mode 100644 index 000000000..8f75ec9a0 --- /dev/null +++ b/APP_Framework/Applications/control_app/plc_demo/panasonic/panasonic_fpxh_uart.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 panasonic_fpxh_uart.c + * @brief PLC panasonic fpxh app + * @version 3.0 + * @author AIIT XUOS Lab + * @date 2023.11.22 + */ + +#include + +extern int Adapter4GActive(void); + +void ControlPanasonicFpxhUartTest(void) +{ + int i, j = 0; + int read_data_length = 0; + uint8_t read_data[128] = {0}; + +#ifdef CONNECTION_ADAPTER_4G + Adapter4GActive(); +#endif + + ControlProtocolType modbus_rtu_protocol = ControlProtocolFind(); + if (NULL == modbus_rtu_protocol) { + printf("%s get modbus rtu protocol %p failed\n", __func__, modbus_rtu_protocol); + return; + } + + printf("%s get modbus rtu protocol %p successfull\n", __func__, modbus_rtu_protocol); + + if (CONTROL_REGISTERED == modbus_rtu_protocol->protocol_status) { + ControlProtocolOpen(modbus_rtu_protocol); + + for (;;) { + read_data_length = ControlProtocolRead(modbus_rtu_protocol, read_data, sizeof(read_data)); + printf("%s read [%d] modbus rtu 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_rtu_protocol); + } +} +PRIV_SHELL_CMD_FUNCTION(ControlPanasonicFpxhUartTest, panasonic fpxh uart Demo, PRIV_SHELL_CMD_MAIN_ATTR); + + diff --git a/Ubiquitous/XiZi_IIoT/resources/ethernet/LwIP/arch/lwipopts.h b/Ubiquitous/XiZi_IIoT/resources/ethernet/LwIP/arch/lwipopts.h index 529ab7a68..ae31f5c0d 100644 --- a/Ubiquitous/XiZi_IIoT/resources/ethernet/LwIP/arch/lwipopts.h +++ b/Ubiquitous/XiZi_IIoT/resources/ethernet/LwIP/arch/lwipopts.h @@ -412,11 +412,7 @@ The STM32F4x7 allows computing and verifying the IP, UDP, TCP and ICMP checksums - To use this feature let the following define uncommented. - To disable it and process by CPU comment the the checksum. */ -<<<<<<< HEAD #define CHECKSUM_BY_HARDWARE -======= -#define CHECKSUM_BY_HARDWARE ->>>>>>> f27c6d2091fa87777963810d926380f3ab178dab #ifdef CHECKSUM_BY_HARDWARE /* CHECKSUM_GEN_IP==0: Generate checksums by hardware for outgoing IP packets.*/