新增PLC测试应用和对应JSON from juqiuyue

it is OK
This commit is contained in:
xuedongliang 2024-03-14 15:39:18 +08:00
commit 9a3f8bd120
59 changed files with 2101 additions and 34 deletions

View File

@ -1,3 +1,3 @@
SRC_DIR := advantech beckhoff br delta mitsubishi omron schneider siemens ge xinje inovance keyence ab abb
SRC_DIR := advantech beckhoff br delta mitsubishi omron schneider siemens ge xinje inovance keyence panasonic fatek ab abb
include $(KERNEL_ROOT)/compiler.mk

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 MiB

View File

@ -1,22 +1,48 @@
# 台达 DVP通信测试
# 台达 PLC与矽达通ARM通信测试
[TOC]
## 通信接线及参数设置
## 台达DVP与矽达通ARM通信处测试
### 通信接线及参数设置
* 网口
* 通过自带 RJ45 网口连接
* 网口参数IP192.168.250.27 Port502
* 测试的协议:Modbus TCP
## 存储区
### 存储区
- 含MDXY。台达PLC中 各存储区地址和Modbus地址有明确的对应表详见台达DVP协议解析测试文档。
## 通信测试
### 通信测试
- 共测试BOOLINT16INT32FLOAT 共四种类型数据。
- 测试D区M区和Y区。
## 台达AS332T与矽达通ARM通信处测试
### 通信接线及参数设置
* 网口
* 通过自带 RJ45 网口连接
* 网口参数IP192.168.250.5 Port502
* 测试的协议:Modbus TCP
### 存储区
- 含MDXY。台达PLC中 各存储区地址和Modbus地址有明确的对应表详见台达AS332T协议解析测试文档。
### 通信测试结果
- 共测试BOOLINT16INT32FLOAT 共四种类型数据。
- 测试D区M区和Y区。
![](./image/recipe.png)
![](./image/test_result1.png)
![](./image/test_result2.png)

View File

@ -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 <control.h>
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);

Binary file not shown.

After

Width:  |  Height:  |  Size: 123 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 171 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -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
}
]
}

View File

@ -0,0 +1,3 @@
SRC_FILES := fatek_fbs_24mc_uart.c
include $(KERNEL_ROOT)/compiler.mk

View File

@ -0,0 +1,42 @@
# 永宏通信测试
[TOC]
## 永宏FBs-24MCT2-AC通信测试
### 通信接线及参数设置
* 网口和串口
* FBS-24MCT2自带圆口232用于程序的下载。
* 可本体拓展FBs-CBES用于Modbus TCP永宏私有协议永宏协议等通信。板卡默认IP192.168.2.3.端口号500永宏协议
* 通过本体拓展FBs-CM22通信模板可用于Modbus RTU及永宏协议通信。串口接线+接485A-接485B。
* 串口模块MODBUS RTU通信参数配置通信速率9600数据位8bit停止位1bit校验偶校验
* 串口模块永宏协议通信参数配置通信速率9600数据位8bit停止位1bit校验偶校验
* 终端与PLC通信测试PC编程软件与PLC不能处于联机状态。
### 存储区
- 存储区 XYRD区等。
### 通信测试
- 共测试BOOLINT16等类型数据。
- 测试Y区R区及D区数据。
- 测试截图:
测试PLC环境搭建
![](./image/FATEK.jpg)
解析完成的配方为:
![](./image/panasonic_fpxh_recipe.png)
测试结果:
![](./image/panasonic_fpxh_communication_test.png)

View File

@ -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 fatek_fbs_24mc_uart.c
* @brief PLC fatek fbs app
* @version 3.0
* @author AIIT XUOS Lab
* @date 2023.11.28
*/
#include <control.h>
extern int Adapter4GActive(void);
void ControlFatekFBsUartTest(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(ControlFatekFBsUartTest, fatek fbs uart Demo, PRIV_SHELL_CMD_MAIN_ATTR);

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 KiB

View File

@ -0,0 +1,37 @@
{
"device_id": 1,
"device_name": "FATEK_FBSMC24T_RTU",
"communication_type": 1,
"serial_config": {
"station": 1,
"baud_rate": 9600,
"data_bits": 8,
"stop_bits": 1,
"check_mode":3
},
"protocol_type": 3,
"read_period": 2000,
"read_item_list": [
{
"value_name": "Y0",
"value_type": 1,
"function_code": 1,
"start_address": 0,
"quantity": 1
},
{
"value_name": "D0",
"value_type": 3,
"function_code": 3,
"start_address": 6000,
"quantity": 1
},
{
"value_name": "R10",
"value_type": 3,
"function_code": 3,
"start_address": 10,
"quantity": 1
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 200 KiB

View File

@ -1,3 +1,3 @@
SRC_FILES := mitsubishi_fx3u.c mitsubishi_fx5u.c mitsubishi_fx2n.c mitsubishi_q02u.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

View File

@ -1,24 +1,88 @@
# 三菱 FX2N通信测试
# 三菱通信测试
[TOC]
## 通信接线及参数设置
## 三菱FX2N通信测试
### 通信接线及参数设置
* 串口
* FX2N自带8针圆口422用于程序的下载。全系列不支持网口且需购买串口拓展模块FX2N-485-BD用于通信测试。
* 接线RDA和SDA短接引出ARDB与SDB短接引出B。
* 串口模块支持MC-1C协议通信速率9600数据位7bit停止位1bit校验偶校验
## 存储区
### 存储区
- 存储区 IQMD区。
## 通信测试
### 通信测试
- 共测试BOOLINT16FLOAT共三种类型数据。
- 测试M区及D区数据。
## 三菱Q06H通信测试
### 通信接线及参数设置
* 接口
* 首次连接时可通过CPU自带的串口打印机方口线进行程序的下载。
* 本次测试通过Q06H拓展的模块QJ71E71_100模块的网口模块进行MC—3E通信测试。
* PLC网口模块IP192.168.250.21 端口号4000
### 存储区
- 存储区 IQMD区。
### 通信测试
- 共测试BOOLINT16FLOAT共三种类型数据。
- 测试M区及D区数据。
- 测试截图:
解析完成的配方为
![](./image/q06h_recipe.png)
测试结果:
![](./image/q06h_communication_test.png)
## 三菱Q03UDV通信测试
### 通信接线及参数设置
* 接口
* 本次测试通过Q03UDV拓展的模块QJ71E71_100模块的网口模块进行MC—3E通信测试。网口模块IP192.168.250.21 端口号4000
* 本次测试还可通过Q03UDV自身网口进行MC—3E通信测试。网口模块IP192.168.250.22 端口号6000
### 存储区
- 存储区 IQMD区。
### 通信测试
- 共测试BOOLINT16FLOAT共三种类型数据。
- 测试M区及D区数据。
- 测试截图:
扩展模块解析完成的配方为
![](./image/q03udv_recipe.png)
CPU自带网口解析完成的配方为
![](image/Q03udv_recipe_1.png)
测试结果:
![](./image/q03udv_communication_test.png)

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

View File

@ -0,0 +1,368 @@
{
"device_id": 1,
"device_name": "FX3U_MC_1E",
"communication_type": 0,
"socket_config": {
"plc_ip": "192.168.250.25",
"local_ip": "192.168.250.233",
"gateway": "192.168.250.1",
"netmask": "255.255.254.0",
"port": 2000
},
"protocol_type": 6,
"read_period": 2000,
"read_item_list": [
{
"value_name": "启动",
"value_type": 1,
"device_code": "M",
"head_device_number_string": "0",
"device_points_count": 1,
"command_type": 0,
"monitoring_timer": 100
},
{
"value_name": "停止",
"value_type": 1,
"device_code": "M",
"head_device_number_string": "1",
"device_points_count": 1,
"command_type": 0,
"monitoring_timer": 100
},
{
"value_name": "使能",
"value_type": 1,
"device_code": "M",
"head_device_number_string": "2",
"device_points_count": 1,
"command_type": 0,
"monitoring_timer": 100
},
{
"value_name": "回零",
"value_type": 1,
"device_code": "M",
"head_device_number_string": "3",
"device_points_count": 1,
"command_type": 0,
"monitoring_timer": 100
},
{
"value_name": "急停",
"value_type": 1,
"device_code": "M",
"head_device_number_string": "4",
"device_points_count": 1,
"command_type": 0,
"monitoring_timer": 100
},
{
"value_name": "正限位",
"value_type": 1,
"device_code": "M",
"head_device_number_string": "5",
"device_points_count": 1,
"command_type": 0,
"monitoring_timer": 100
},
{
"value_name": "负限位",
"value_type": 1,
"device_code": "M",
"head_device_number_string": "6",
"device_points_count": 1,
"command_type": 0,
"monitoring_timer": 100
},
{
"value_name": "自动运行中",
"value_type": 1,
"device_code": "M",
"head_device_number_string": "20",
"device_points_count": 1,
"command_type": 0,
"monitoring_timer": 100
},
{
"value_name": "故障",
"value_type": 1,
"device_code": "M",
"head_device_number_string": "21",
"device_points_count": 1,
"command_type": 0,
"monitoring_timer": 100
},
{
"value_name": "待机",
"value_type": 1,
"device_code": "M",
"head_device_number_string": "22",
"device_points_count": 1,
"command_type": 0,
"monitoring_timer": 100
},
{
"value_name": "手动模式",
"value_type": 1,
"device_code": "M",
"head_device_number_string": "23",
"device_points_count": 1,
"command_type": 0,
"monitoring_timer": 100
},
{
"value_name": "自动模式",
"value_type": 1,
"device_code": "M",
"head_device_number_string": "24",
"device_points_count": 1,
"command_type": 0,
"monitoring_timer": 100
},
{
"value_name": "运行方向",
"value_type": 1,
"device_code": "M",
"head_device_number_string": "25",
"device_points_count": 1,
"command_type": 0,
"monitoring_timer": 100
},
{
"value_name": "复位",
"value_type": 1,
"device_code": "M",
"head_device_number_string": "26",
"device_points_count": 1,
"command_type": 0,
"monitoring_timer": 100
},
{
"value_name": "备用1",
"value_type": 1,
"device_code": "M",
"head_device_number_string": "27",
"device_points_count": 1,
"command_type": 0,
"monitoring_timer": 100
},
{
"value_name": "产量",
"value_type": 3,
"device_code": "D",
"head_device_number_string": "0",
"device_points_count": 1,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "整型1",
"value_type": 3,
"device_code": "D",
"head_device_number_string": "1",
"device_points_count": 1,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "整型2",
"value_type": 3,
"device_code": "D",
"head_device_number_string": "2",
"device_points_count": 1,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "整型3",
"value_type": 3,
"device_code": "D",
"head_device_number_string": "3",
"device_points_count": 1,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "整型4",
"value_type": 3,
"device_code": "D",
"head_device_number_string": "4",
"device_points_count": 1,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "整型5",
"value_type": 3,
"device_code": "D",
"head_device_number_string": "5",
"device_points_count": 1,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "整型6",
"value_type": 3,
"device_code": "D",
"head_device_number_string": "50",
"device_points_count": 1,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "整型7",
"value_type": 3,
"device_code": "D",
"head_device_number_string": "51",
"device_points_count": 1,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "整型8",
"value_type": 3,
"device_code": "D",
"head_device_number_string": "52",
"device_points_count": 1,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "整型9",
"value_type": 3,
"device_code": "D",
"head_device_number_string": "53",
"device_points_count": 1,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "速度",
"value_type": 9,
"device_code": "D",
"head_device_number_string": "200",
"device_points_count": 2,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "加速度",
"value_type": 9,
"device_code": "D",
"head_device_number_string": "202",
"device_points_count": 2,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "减速度",
"value_type": 9,
"device_code": "D",
"head_device_number_string": "204",
"device_points_count": 2,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "起始位置",
"value_type": 9,
"device_code": "D",
"head_device_number_string": "206",
"device_points_count": 2,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "终点位置",
"value_type": 9,
"device_code": "D",
"head_device_number_string": "208",
"device_points_count": 2,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "张力值",
"value_type": 9,
"device_code": "D",
"head_device_number_string": "300",
"device_points_count": 2,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "浮点型1",
"value_type": 9,
"device_code": "D",
"head_device_number_string": "302",
"device_points_count": 2,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "浮点型2",
"value_type": 9,
"device_code": "D",
"head_device_number_string": "304",
"device_points_count": 2,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "浮点型3",
"value_type": 9,
"device_code": "D",
"head_device_number_string": "306",
"device_points_count": 2,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "浮点型4",
"value_type": 9,
"device_code": "D",
"head_device_number_string": "308",
"device_points_count": 2,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "Y001",
"value_type": 1,
"device_code": "Y",
"head_device_number_string": "1",
"device_points_count": 1,
"command_type": 0,
"monitoring_timer": 100
},
{
"value_name": "Y002",
"value_type": 1,
"device_code": "Y",
"head_device_number_string": "2",
"device_points_count": 1,
"command_type": 0,
"monitoring_timer": 100
},
{
"value_name": "Y010",
"value_type": 1,
"device_code": "Y",
"head_device_number_string": "10",
"device_points_count": 1,
"command_type": 0,
"monitoring_timer": 100
},
{
"value_name": "D400",
"value_type": 4,
"device_code": "D",
"head_device_number_string": "400",
"device_points_count": 2,
"command_type": 1,
"monitoring_timer": 100
}
]
}

View File

@ -0,0 +1,331 @@
{
"device_id": 769,
"device_name": "Q02UCPU",
"communication_type": 1,
"serial_config": {
"station": 0,
"baud_rate": 19200,
"data_bits": 7,
"stop_bits": 1,
"check_mode": 3
},
"protocol_type": 10,
"read_period": 1000,
"read_item_list": [
{
"value_name": "启动",
"value_type": 1,
"device_code": "M",
"head_device_number_string": "0",
"device_points_count": 1,
"command_type": 0,
"monitoring_timer": 100
},
{
"value_name": "停止",
"value_type": 1,
"device_code": "M",
"head_device_number_string": "1",
"device_points_count": 1,
"command_type": 0,
"monitoring_timer": 100
},
{
"value_name": "使能",
"value_type": 1,
"device_code": "M",
"head_device_number_string": "2",
"device_points_count": 1,
"command_type": 0,
"monitoring_timer": 100
},
{
"value_name": "回零",
"value_type": 1,
"device_code": "M",
"head_device_number_string": "3",
"device_points_count": 1,
"command_type": 0,
"monitoring_timer": 100
},
{
"value_name": "急停",
"value_type": 1,
"device_code": "M",
"head_device_number_string": "4",
"device_points_count": 1,
"command_type": 0,
"monitoring_timer": 100
},
{
"value_name": "正限位",
"value_type": 1,
"device_code": "M",
"head_device_number_string": "5",
"device_points_count": 1,
"command_type": 0,
"monitoring_timer": 100
},
{
"value_name": "负限位",
"value_type": 1,
"device_code": "M",
"head_device_number_string": "6",
"device_points_count": 1,
"command_type": 0,
"monitoring_timer": 100
},
{
"value_name": "自动运行中",
"value_type": 1,
"device_code": "M",
"head_device_number_string": "20",
"device_points_count": 1,
"command_type": 0,
"monitoring_timer": 100
},
{
"value_name": "故障",
"value_type": 1,
"device_code": "M",
"head_device_number_string": "21",
"device_points_count": 1,
"command_type": 0,
"monitoring_timer": 100
},
{
"value_name": "待机",
"value_type": 1,
"device_code": "M",
"head_device_number_string": "22",
"device_points_count": 1,
"command_type": 0,
"monitoring_timer": 100
},
{
"value_name": "手动模式",
"value_type": 1,
"device_code": "M",
"head_device_number_string": "23",
"device_points_count": 1,
"command_type": 0,
"monitoring_timer": 100
},
{
"value_name": "自动模式",
"value_type": 1,
"device_code": "M",
"head_device_number_string": "24",
"device_points_count": 1,
"command_type": 0,
"monitoring_timer": 100
},
{
"value_name": "运行方向",
"value_type": 1,
"device_code": "M",
"head_device_number_string": "25",
"device_points_count": 1,
"command_type": 0,
"monitoring_timer": 100
},
{
"value_name": "复位",
"value_type": 1,
"device_code": "M",
"head_device_number_string": "26",
"device_points_count": 1,
"command_type": 0,
"monitoring_timer": 100
},
{
"value_name": "备用1",
"value_type": 1,
"device_code": "M",
"head_device_number_string": "27",
"device_points_count": 1,
"command_type": 0,
"monitoring_timer": 100
},
{
"value_name": "产量",
"value_type": 3,
"device_code": "D",
"head_device_number_string": "0",
"device_points_count": 1,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "整型1",
"value_type": 3,
"device_code": "D",
"head_device_number_string": "1",
"device_points_count": 1,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "整型2",
"value_type": 3,
"device_code": "D",
"head_device_number_string": "2",
"device_points_count": 1,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "整型3",
"value_type": 3,
"device_code": "D",
"head_device_number_string": "3",
"device_points_count": 1,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "整型4",
"value_type": 3,
"device_code": "D",
"head_device_number_string": "4",
"device_points_count": 1,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "整型5",
"value_type": 3,
"device_code": "D",
"head_device_number_string": "5",
"device_points_count": 1,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "整型6",
"value_type": 3,
"device_code": "D",
"head_device_number_string": "50",
"device_points_count": 1,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "整型7",
"value_type": 3,
"device_code": "D",
"head_device_number_string": "51",
"device_points_count": 1,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "整型8",
"value_type": 3,
"device_code": "D",
"head_device_number_string": "52",
"device_points_count": 1,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "整型9",
"value_type": 3,
"device_code": "D",
"head_device_number_string": "53",
"device_points_count": 1,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "速度",
"value_type": 9,
"device_code": "D",
"head_device_number_string": "200",
"device_points_count": 2,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "加速度",
"value_type": 9,
"device_code": "D",
"head_device_number_string": "202",
"device_points_count": 2,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "减速度",
"value_type": 9,
"device_code": "D",
"head_device_number_string": "204",
"device_points_count": 2,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "起始位置",
"value_type": 9,
"device_code": "D",
"head_device_number_string": "206",
"device_points_count": 2,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "终点位置",
"value_type": 9,
"device_code": "D",
"head_device_number_string": "208",
"device_points_count": 2,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "张力值",
"value_type": 9,
"device_code": "D",
"head_device_number_string": "300",
"device_points_count": 2,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "浮点型1",
"value_type": 9,
"device_code": "D",
"head_device_number_string": "302",
"device_points_count": 2,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "浮点型2",
"value_type": 9,
"device_code": "D",
"head_device_number_string": "304",
"device_points_count": 2,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "浮点型3",
"value_type": 9,
"device_code": "D",
"head_device_number_string": "306",
"device_points_count": 2,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "浮点型4",
"value_type": 9,
"device_code": "D",
"head_device_number_string": "308",
"device_points_count": 2,
"command_type": 1,
"monitoring_timer": 100
}
]
}

View File

@ -0,0 +1,494 @@
{
"device_id": 1,
"device_name": "Q02UCPU_MC_3E",
"communication_type": 0,
"socket_config": {
"plc_ip": "192.168.250.21",
"local_ip": "192.168.250.233",
"gateway": "192.168.250.1",
"netmask": "255.255.254.0",
"port": 4000
},
"protocol_type": 7,
"read_period": 2000,
"read_item_list": [
{
"value_name": "启动",
"value_type": 1,
"device_code": "M",
"head_device_number_string": "0",
"device_points_count": 1,
"command_type": 0,
"monitoring_timer": 100
},
{
"value_name": "停止",
"value_type": 1,
"device_code": "M",
"head_device_number_string": "1",
"device_points_count": 1,
"command_type": 0,
"monitoring_timer": 100
},
{
"value_name": "使能",
"value_type": 1,
"device_code": "M",
"head_device_number_string": "2",
"device_points_count": 1,
"command_type": 0,
"monitoring_timer": 100
},
{
"value_name": "回零",
"value_type": 1,
"device_code": "M",
"head_device_number_string": "3",
"device_points_count": 1,
"command_type": 0,
"monitoring_timer": 100
},
{
"value_name": "急停",
"value_type": 1,
"device_code": "M",
"head_device_number_string": "4",
"device_points_count": 1,
"command_type": 0,
"monitoring_timer": 100
},
{
"value_name": "正限位",
"value_type": 1,
"device_code": "M",
"head_device_number_string": "5",
"device_points_count": 1,
"command_type": 0,
"monitoring_timer": 100
},
{
"value_name": "负限位",
"value_type": 1,
"device_code": "M",
"head_device_number_string": "6",
"device_points_count": 1,
"command_type": 0,
"monitoring_timer": 100
},
{
"value_name": "自动运行中",
"value_type": 1,
"device_code": "M",
"head_device_number_string": "20",
"device_points_count": 1,
"command_type": 0,
"monitoring_timer": 100
},
{
"value_name": "故障",
"value_type": 1,
"device_code": "M",
"head_device_number_string": "21",
"device_points_count": 1,
"command_type": 0,
"monitoring_timer": 100
},
{
"value_name": "待机",
"value_type": 1,
"device_code": "M",
"head_device_number_string": "22",
"device_points_count": 1,
"command_type": 0,
"monitoring_timer": 100
},
{
"value_name": "手动模式",
"value_type": 1,
"device_code": "M",
"head_device_number_string": "23",
"device_points_count": 1,
"command_type": 0,
"monitoring_timer": 100
},
{
"value_name": "自动模式",
"value_type": 1,
"device_code": "M",
"head_device_number_string": "24",
"device_points_count": 1,
"command_type": 0,
"monitoring_timer": 100
},
{
"value_name": "运行方向",
"value_type": 1,
"device_code": "M",
"head_device_number_string": "25",
"device_points_count": 1,
"command_type": 0,
"monitoring_timer": 100
},
{
"value_name": "复位",
"value_type": 1,
"device_code": "M",
"head_device_number_string": "26",
"device_points_count": 1,
"command_type": 0,
"monitoring_timer": 100
},
{
"value_name": "备用1",
"value_type": 1,
"device_code": "M",
"head_device_number_string": "27",
"device_points_count": 1,
"command_type": 0,
"monitoring_timer": 100
},
{
"value_name": "产量",
"value_type": 3,
"device_code": "D",
"head_device_number_string": "0",
"device_points_count": 1,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "整型1",
"value_type": 3,
"device_code": "D",
"head_device_number_string": "1",
"device_points_count": 1,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "整型2",
"value_type": 3,
"device_code": "D",
"head_device_number_string": "2",
"device_points_count": 1,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "整型3",
"value_type": 3,
"device_code": "D",
"head_device_number_string": "3",
"device_points_count": 1,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "整型4",
"value_type": 3,
"device_code": "D",
"head_device_number_string": "4",
"device_points_count": 1,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "整型5",
"value_type": 3,
"device_code": "D",
"head_device_number_string": "5",
"device_points_count": 1,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "整型6",
"value_type": 3,
"device_code": "D",
"head_device_number_string": "50",
"device_points_count": 1,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "整型7",
"value_type": 3,
"device_code": "D",
"head_device_number_string": "51",
"device_points_count": 1,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "整型8",
"value_type": 3,
"device_code": "D",
"head_device_number_string": "52",
"device_points_count": 1,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "整型9",
"value_type": 3,
"device_code": "D",
"head_device_number_string": "53",
"device_points_count": 1,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "速度",
"value_type": 9,
"device_code": "D",
"head_device_number_string": "200",
"device_points_count": 2,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "加速度",
"value_type": 9,
"device_code": "D",
"head_device_number_string": "202",
"device_points_count": 2,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "减速度",
"value_type": 9,
"device_code": "D",
"head_device_number_string": "204",
"device_points_count": 2,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "起始位置",
"value_type": 9,
"device_code": "D",
"head_device_number_string": "206",
"device_points_count": 2,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "终点位置",
"value_type": 9,
"device_code": "D",
"head_device_number_string": "208",
"device_points_count": 2,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "张力值",
"value_type": 9,
"device_code": "D",
"head_device_number_string": "300",
"device_points_count": 2,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "浮点型1",
"value_type": 9,
"device_code": "D",
"head_device_number_string": "302",
"device_points_count": 2,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "浮点型2",
"value_type": 9,
"device_code": "D",
"head_device_number_string": "304",
"device_points_count": 2,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "浮点型3",
"value_type": 9,
"device_code": "D",
"head_device_number_string": "306",
"device_points_count": 2,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "浮点型4",
"value_type": 9,
"device_code": "D",
"head_device_number_string": "308",
"device_points_count": 2,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "Y001",
"value_type": 1,
"device_code": "Y",
"head_device_number_string": "1",
"device_points_count": 1,
"command_type": 0,
"monitoring_timer": 100
},
{
"value_name": "Y002",
"value_type": 1,
"device_code": "Y",
"head_device_number_string": "2",
"device_points_count": 1,
"command_type": 0,
"monitoring_timer": 100
},
{
"value_name": "Y010",
"value_type": 1,
"device_code": "Y",
"head_device_number_string": "10",
"device_points_count": 1,
"command_type": 0,
"monitoring_timer": 100
},
{
"value_name": "D400",
"value_type": 4,
"device_code": "D",
"head_device_number_string": "400",
"device_points_count": 2,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "D402",
"value_type": 8,
"device_code": "D",
"head_device_number_string": "402",
"device_points_count": 4,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "D406",
"value_type": 8,
"device_code": "D",
"head_device_number_string": "406",
"device_points_count": 4,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "B1",
"value_type": 1,
"device_code": "B",
"head_device_number_string": "1",
"device_points_count": 1,
"command_type": 0,
"monitoring_timer": 100
},
{
"value_name": "B10",
"value_type": 1,
"device_code": "B",
"head_device_number_string": "10",
"device_points_count": 1,
"command_type": 0,
"monitoring_timer": 100
},
{
"value_name": "B20",
"value_type": 1,
"device_code": "B",
"head_device_number_string": "20",
"device_points_count": 1,
"command_type": 0,
"monitoring_timer": 100
},
{
"value_name": "W1",
"value_type": 3,
"device_code": "W",
"head_device_number_string": "1",
"device_points_count": 1,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "W2",
"value_type": 4,
"device_code": "W",
"head_device_number_string": "2",
"device_points_count": 2,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "W4",
"value_type": 9,
"device_code": "W",
"head_device_number_string": "4",
"device_points_count": 2,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "W6",
"value_type": 8,
"device_code": "W",
"head_device_number_string": "6",
"device_points_count": 4,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "W22",
"value_type": 3,
"device_code": "W",
"head_device_number_string": "22",
"device_points_count": 1,
"command_type": 1,
"monitoring_timer": 100
},
{
"value_name": "B44",
"value_type": 1,
"device_code": "B",
"head_device_number_string": "44",
"device_points_count": 1,
"command_type": 0,
"monitoring_timer": 500
},
{
"value_name": "B200",
"value_type": 1,
"device_code": "B",
"head_device_number_string": "200",
"device_points_count": 1,
"command_type": 0,
"monitoring_timer": 500
},
{
"value_name": "Y100",
"value_type": 1,
"device_code": "Y",
"head_device_number_string": "100",
"device_points_count": 1,
"command_type": 0,
"monitoring_timer": 500
},
{
"value_name": "X150",
"value_type": 1,
"device_code": "X",
"head_device_number_string": "150",
"device_points_count": 1,
"command_type": 0,
"monitoring_timer": 500
}
]
}

View File

@ -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 <control.h>
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);

View File

@ -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_q06h.c
* @brief PLC MITSUBISHI Q06H app
* @version 3.0
* @author AIIT XUOS Lab
* @date 2023.10.30
*/
#include <control.h>
extern int Adapter4GActive(void);
void ControlQ06hTest(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(ControlQ06hTest, Mitsubishi Q06H Demo, PRIV_SHELL_CMD_MAIN_ATTR);

View File

@ -0,0 +1,26 @@
{
"device_id": 1,
"device_name": "NJ501",
"communication_type": 0,
"socket_config": {
"plc_ip": "192.168.250.22",
"local_ip": "192.168.250.233",
"gateway": "192.168.250.1",
"netmask": "255.255.255.0",
"port": 9600
},
"protocol_type": 5,
"read_period": 100,
"read_item_list": [
{
"value_name": "整型1",
"value_type": 3,
"area_char": "D",
"data_type": 1,
"start_address": 100,
"bit_address": 0,
"data_length": 1
}
]
}

View File

@ -18,6 +18,34 @@
* @date 2022.9.27
*/
#include <control.h>
void ControlNj501Test(void)
{
int i = 0;
uint16_t read_data_length = 0;
uint8_t read_data[1024] = {0};
ControlProtocolType fins_protocol = ControlProtocolFind();
if (NULL == fins_protocol) {
printf("%s get fins protocol %p failed\n", __func__, fins_protocol);
return;
}
printf("%s get fins protocol %p successfull\n", __func__, fins_protocol);
if (CONTROL_REGISTERED == fins_protocol->protocol_status) {
ControlProtocolOpen(fins_protocol);
for (;;) {
read_data_length = ControlProtocolRead(fins_protocol, read_data, sizeof(read_data));
printf("%s read [%d] fins data %d using receipe file\n", __func__, i, read_data_length);
i++;
PrivTaskDelay(100000);
}
//ControlProtocolClose(fins_protocol);
}
}
PRIV_SHELL_CMD_FUNCTION(ControlNj501Test, Omron Plc FINS Demo, PRIV_SHELL_CMD_MAIN_ATTR);

View File

@ -0,0 +1,3 @@
SRC_FILES := panasonic_fpxh_tcp.c panasonic_fpxh_uart.c
include $(KERNEL_ROOT)/compiler.mk

View File

@ -0,0 +1,39 @@
# 松下通信测试
[TOC]
## 松下FPXHC40ET通信测试
### 通信接线及参数设置
* 网口和串口
* FPXHC40ET自带miniUSB用于程序的下载。本体自带的串口为RS232。
* 本体自带的网口可用于Modbus TCPEthernet/IP等通信。目前用于Modbus TCP通信测试网口IP192.168.250.51 Port502
* 通过本体拓展FPXH-COM3通信模板可用于Modbus RTU通信。串口接线S+接485AS-接485B。
* 串口模块通信参数配置通信速率115200数据位8bit停止位1bit校验偶校验
### 存储区
- 存储区 XYRDL区等。
### 通信测试
- 共测试BOOLINT16等类型数据。
- 测试Y区R区及DT区数据。
- 测试截图:
测试PLC环境搭建
![](./image/PLC_xidatong.jpg)
解析完成的配方为:
![](./image/panasonic_fpxh_recipe.png)
测试结果:
![](./image/panasonic_fpxh_communication_test.png)

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

View File

@ -0,0 +1,65 @@
{
"device_id": 1,
"device_name": "PANASONIC_FPXH_TCP",
"communication_type": 0,
"socket_config": {
"plc_ip": "192.168.250.51",
"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": "Y0",
"value_type": 1,
"function_code": 1,
"start_address": 0,
"quantity": 1
},
{
"value_name": "R0",
"value_type": 1,
"function_code": 1,
"start_address":2048,
"quantity": 1
},
{
"value_name": "R100",
"value_type": 1,
"function_code": 1,
"start_address": 2208,
"quantity": 1
},
{
"value_name": "R101",
"value_type": 1,
"function_code": 1,
"start_address": 2209,
"quantity": 1
},
{
"value_name": "DT0",
"value_type": 3,
"function_code": 3,
"start_address": 0,
"quantity": 1
},
{
"value_name": "DT1",
"value_type": 3,
"function_code": 3,
"start_address": 1,
"quantity": 1
},
{
"value_name": "DT200",
"value_type": 3,
"function_code": 3,
"start_address": 200,
"quantity": 1
}
]
}

View File

@ -0,0 +1,66 @@
{
"device_id": 1,
"device_name": "PANASONIC_FPXH_RTU",
"communication_type": 1,
"serial_config": {
"station": 1,
"baud_rate": 9600,
"data_bits": 8,
"stop_bits": 1,
"check_mode":3
},
"protocol_type": 3,
"read_period": 2000,
"read_item_list": [
{
"value_name": "Y0",
"value_type": 1,
"function_code": 1,
"start_address": 0,
"quantity": 1
},
{
"value_name": "R0",
"value_type": 1,
"function_code": 1,
"start_address":2048,
"quantity": 1
},
{
"value_name": "R100",
"value_type": 1,
"function_code": 1,
"start_address": 2208,
"quantity": 1
},
{
"value_name": "R101",
"value_type": 1,
"function_code": 1,
"start_address": 2209,
"quantity": 1
},
{
"value_name": "DT0",
"value_type": 3,
"function_code": 3,
"start_address": 0,
"quantity": 1
},
{
"value_name": "DT1",
"value_type": 3,
"function_code": 3,
"start_address": 1,
"quantity": 1
},
{
"value_name": "DT200",
"value_type": 3,
"function_code": 3,
"start_address": 200,
"quantity": 1
}
]
}

View File

@ -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);

View File

@ -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);

View File

@ -1,3 +1,3 @@
SRC_FILES := siemens_s7_200_cn.c siemens_s7_200_smart.c siemens_s7_300.c siemens_s7_1200.c siemens_s7_1500.c
SRC_FILES := siemens_s7_200_cn.c siemens_s7_200_smart.c siemens_s7_1200.c siemens_s7_1500.c
include $(KERNEL_ROOT)/compiler.mk

View File

@ -0,0 +1,25 @@
{
"device_id": 1,
"device_name": "S7-1215",
"communication_type": 0,
"socket_config": {
"plc_ip": "192.168.250.5",
"local_ip": "192.168.250.233",
"gateway": "192.168.250.252",
"netmask": "255.255.255.0",
"port": 102
},
"protocol_type": 1,
"read_period": 100,
"read_item_list": [
{
"value_name": "浮点数",
"value_type": 9,
"area": "DB",
"wordlen": "Real",
"db_number": 10,
"start": 32,
"amount": 1
}
]
}

View File

@ -18,3 +18,28 @@
* @date 2023.3.27
*/
#include <control.h>
void ControlS71200Test(void)
{
int i = 0;
uint16_t read_data_length = 0;
uint8_t read_data[1024] = {0};
ControlProtocolType s7_protocol = ControlProtocolFind();
if (NULL == s7_protocol) {
printf("%s get s7 protocol %p failed\n", __func__, s7_protocol);
return;
}
printf("%s get s7 protocol %p successfull\n", __func__, s7_protocol);
if (CONTROL_REGISTERED == s7_protocol->protocol_status) {
ControlProtocolOpen(s7_protocol);
for (;;) {
read_data_length = ControlProtocolRead(s7_protocol, read_data, sizeof(read_data));
printf("%s read [%d] s7 data %d using receipe file\n", __func__, i, read_data_length);
i++;
memset(read_data, 0, sizeof(read_data));
PrivTaskDelay(10000);
}
}
}
PRIV_SHELL_CMD_FUNCTION(ControlS71200Test, Siemens Plc S7_1215 Demo, PRIV_SHELL_CMD_MAIN_ATTR);

View File

@ -1,20 +0,0 @@
/*
* 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 siemens_s7_300.c
* @brief PLC SIEMENS S7-300 app
* @version 3.0
* @author AIIT XUOS Lab
* @date 2023.3.27
*/

View File

@ -182,7 +182,7 @@ static uint32 CanReadData(void *dev , struct BusBlockReadParam *databuf)
ret = CAN_GetRxFrame(CAN_X, &frame_received);
if(EOK != ret){
// KPrintf("CAN recv frame failed(CODE:%d)!\n",ret);
// KPrintf("CAN recv frame failed(CODE:%d)!\n",ret);
p_can_config->data_lenth = 0;
return ERROR;
}