forked from xuos/xiuos
				
			1.add panasonic fpxh plc test app 2.add panasonic fpxh plc readme file
This commit is contained in:
		
							parent
							
								
									81924837dd
								
							
						
					
					
						commit
						e5e654988b
					
				| 
						 | 
					@ -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
 | 
					include $(KERNEL_ROOT)/compiler.mk
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,3 @@
 | 
				
			||||||
 | 
					SRC_FILES := panasonic_fpxh_tcp.c panasonic_fpxh_uart.c
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					include $(KERNEL_ROOT)/compiler.mk
 | 
				
			||||||
| 
						 | 
					@ -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环境搭建:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  解析完成的配方为:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  测试结果:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 200 KiB  | 
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 182 KiB  | 
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 23 KiB  | 
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 6.4 KiB  | 
| 
						 | 
					@ -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 <control.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					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);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -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 <control.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					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);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -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 use this feature let the following define uncommented.
 | 
				
			||||||
 - To disable it and process by CPU comment the  the checksum.
 | 
					 - To disable it and process by CPU comment the  the checksum.
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
<<<<<<< HEAD
 | 
					 | 
				
			||||||
 #define CHECKSUM_BY_HARDWARE
 | 
					 #define CHECKSUM_BY_HARDWARE
 | 
				
			||||||
=======
 | 
					 | 
				
			||||||
#define CHECKSUM_BY_HARDWARE
 | 
					 | 
				
			||||||
>>>>>>> f27c6d2091fa87777963810d926380f3ab178dab
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef CHECKSUM_BY_HARDWARE
 | 
					#ifdef CHECKSUM_BY_HARDWARE
 | 
				
			||||||
/* CHECKSUM_GEN_IP==0: Generate checksums by hardware for outgoing IP packets.*/
 | 
					/* CHECKSUM_GEN_IP==0: Generate checksums by hardware for outgoing IP packets.*/
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue