1.add ge cpe100 test app 2.add ge plc readme

This commit is contained in:
jqy1988 2023-05-05 14:59:52 +08:00
parent af665f9f29
commit fb27201603
6 changed files with 253 additions and 1 deletions

View File

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

View File

@ -0,0 +1,57 @@
---
typora-copy-images-to: upload
---
# 艾默生原GE 通信测试
[TOC]
## 小型VersaMAX CPU001测试
### 通信接线及参数设置
* 串口
* COM2为15孔D型 RS485。波特率19200数据位8位停止位1位校验偶校验。接线按下图典型双线接法。
![ge_versamax_serial](./img/ge_versamax_serial.png)
### 存储区
- 存储区 IQAIR区。其他内存区如MAQ不能直接访问要通过程序转换访问。
### 通信测试
- 共测试BOOLINT16FLOAT共三种类型数据。
- 测试R区及Q区数据。
- R区数据测试用功能码03以字为单位读取。配方中start_address字段为PLC地址直接减1。
- Q区数据测试用功能码01以位为单位读取。配方中start_address字段为PLC地址直接减1。
## 中型PLC CPE100通信测试
### 通信接线及参数设置
- 网口
- 网口RJ45参数 IP192.168.250.28 端口号502
### 存储区
- 存储区 IQAIR区。其他内存区如MAQ不能直接访问要通过程序转换访问。
### 通信测试
- 共测试BOOLINT16INT32FLOATDOUBLE共五种类型数据。
- 测试R区及Q区数据。
- R区数据测试用功能码03以字为单位读取。配方中start_address字段为PLC地址直接减1。
- Q区数据测试用功能码01以位为单位读取。配方中start_address字段为PLC地址直接减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 ge_cpe100.c
* @brief PLC GE Versamax app
* @version 3.0
* @author AIIT XUOS Lab
* @date 2022.9.27
*/
#include <control.h>
extern int Adapter4GActive(void);
void ControlGecpe100Test(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(ControlGecpe100Test, ge cpe100 Demo, PRIV_SHELL_CMD_MAIN_ATTR);

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

View File

@ -0,0 +1,73 @@
{
"device_id": 1,
"device_name": "GE_CPE100_TCP",
"communication_type": 0,
"socket_config": {
"plc_ip": "192.168.250.28",
"local_ip": "192.168.250.233",
"gateway": "192.168.250.1",
"netmask": "255.255.254.0",
"port": 502
},
"protocol_type": 2,
"read_period": 2000,
"read_item_list": [
{
"value_name": "Q001",
"value_type": 1,
"function_code": 1,
"start_address": 0,
"quantity": 1
},
{
"value_name": "Q010",
"value_type": 1,
"function_code": 1,
"start_address":9,
"quantity": 1
},
{
"value_name": "Q066",
"value_type": 1,
"function_code": 1,
"start_address": 65,
"quantity": 1
},
{
"value_name": "Q100",
"value_type": 1,
"function_code": 1,
"start_address":99,
"quantity": 1
},
{
"value_name": "R11",
"value_type": 3,
"function_code": 3,
"start_address": 10,
"quantity": 1
},
{
"value_name": "R12",
"value_type": 9,
"function_code": 3,
"start_address": 11,
"quantity": 2
},
{
"value_name": "R14",
"value_type": 8,
"function_code": 3,
"start_address": 13,
"quantity": 4
},
{
"value_name": "R18",
"value_type": 4,
"function_code": 3,
"start_address": 17,
"quantity": 2
}
]
}

View File

@ -0,0 +1,58 @@
{
"device_id": 1,
"device_name": "GE_VersaMAX_RTU",
"communication_type": 1,
"serial_config": {
"station": 1,
"baud_rate": 19200,
"data_bits": 8,
"stop_bits": 1,
"check_mode": 2
},
"protocol_type": 3,
"read_period": 2000,
"read_item_list": [
{
"value_name": "Q001",
"value_type": 1,
"function_code": 1,
"start_address": 0,
"quantity": 1
},
{
"value_name": "Q010",
"value_type": 1,
"function_code": 1,
"start_address": 9,
"quantity": 1
},
{
"value_name": "Q066",
"value_type": 1,
"function_code": 1,
"start_address": 65,
"quantity": 1
},
{
"value_name": "Q100",
"value_type": 1,
"function_code": 1,
"start_address": 99,
"quantity": 1
},
{
"value_name": "R11",
"value_type": 3,
"function_code": 3,
"start_address": 10,
"quantity": 1
},
{
"value_name": "R12",
"value_type": 9,
"function_code": 3,
"start_address": 11,
"quantity": 2
}
]
}