forked from xuos/xiuos
1.add ge cpe100 test app 2.add ge plc readme
This commit is contained in:
parent
af665f9f29
commit
fb27201603
|
@ -1,3 +1,3 @@
|
|||
SRC_FILES := ge_versamax001.c
|
||||
SRC_FILES := ge_versamax001.c ge_cpe100.c
|
||||
|
||||
include $(KERNEL_ROOT)/compiler.mk
|
|
@ -0,0 +1,57 @@
|
|||
---
|
||||
typora-copy-images-to: upload
|
||||
---
|
||||
|
||||
# 艾默生(原GE) 通信测试
|
||||
|
||||
[TOC]
|
||||
|
||||
## 小型VersaMAX CPU001测试
|
||||
|
||||
### 通信接线及参数设置
|
||||
|
||||
* 串口
|
||||
* COM2为15孔D型 RS485。波特率:19200,数据位:8位,停止位:1位,校验:偶校验。接线按下图典型双线接法。
|
||||
|
||||

|
||||
|
||||
### 存储区
|
||||
|
||||
- 存储区 I,Q,AI,R区。其他内存区如M,AQ不能直接访问,要通过程序转换访问。
|
||||
|
||||
### 通信测试
|
||||
|
||||
- 共测试BOOL,INT16,FLOAT共三种类型数据。
|
||||
|
||||
|
||||
- 测试R区及Q区数据。
|
||||
|
||||
|
||||
- R区数据测试,用功能码03,以字为单位读取。配方中start_address字段为PLC地址直接减1。
|
||||
|
||||
|
||||
- Q区数据测试,用功能码01,以位为单位读取。配方中start_address字段为PLC地址直接减1。
|
||||
|
||||
## 中型PLC CPE100通信测试
|
||||
|
||||
### 通信接线及参数设置
|
||||
|
||||
- 网口
|
||||
- 网口RJ45,参数 IP:192.168.250.28 端口号:502
|
||||
|
||||
### 存储区
|
||||
|
||||
- 存储区 I,Q,AI,R区。其他内存区如M,AQ不能直接访问,要通过程序转换访问。
|
||||
|
||||
### 通信测试
|
||||
|
||||
- 共测试BOOL,INT16,INT32,FLOAT,DOUBLE共五种类型数据。
|
||||
|
||||
|
||||
- 测试R区及Q区数据。
|
||||
|
||||
|
||||
- R区数据测试,用功能码03,以字为单位读取。配方中start_address字段为PLC地址直接减1。
|
||||
|
||||
|
||||
- Q区数据测试,用功能码01,以位为单位读取。配方中start_address字段为PLC地址直接减1。
|
|
@ -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 |
|
@ -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
|
||||
}
|
||||
|
||||
]
|
||||
}
|
|
@ -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
|
||||
}
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue