forked from xuos/xiuos
1.add melsec q06hPLC test app 2.modify readme file
This commit is contained in:
parent
46a15c1dc7
commit
5af6d63cd4
|
@ -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
|
||||
|
||||
include $(KERNEL_ROOT)/compiler.mk
|
||||
|
|
|
@ -1,24 +1,53 @@
|
|||
# 三菱 FX2N通信测试
|
||||
# 三菱通信测试
|
||||
|
||||
[TOC]
|
||||
|
||||
## 通信接线及参数设置
|
||||
## 三菱FX2N通信测试
|
||||
|
||||
### 通信接线及参数设置
|
||||
|
||||
* 串口
|
||||
* FX2N自带8针圆口422,用于程序的下载。全系列不支持网口,且需购买串口拓展模块FX2N-485-BD用于通信测试。
|
||||
* 接线:RDA和SDA短接,引出A;RDB与SDB短接,引出B。
|
||||
* 串口模块支持MC-1C协议,通信速率:9600;数据位:7bit;停止位:1bit;校验:偶校验
|
||||
|
||||
## 存储区
|
||||
### 存储区
|
||||
|
||||
- 存储区 I,Q,M,D区。
|
||||
|
||||
## 通信测试
|
||||
### 通信测试
|
||||
|
||||
- 共测试BOOL,INT16,FLOAT共三种类型数据。
|
||||
|
||||
|
||||
- 测试M区及D区数据。
|
||||
|
||||
## 三菱Q06H通信测试
|
||||
|
||||
### 通信接线及参数设置
|
||||
|
||||
* 接口
|
||||
* 首次连接时,可通过CPU自带的串口(打印机方口线)进行程序的下载。
|
||||
* 本次测试通过Q06H拓展的模块QJ71E71_100模块的网口模块进行MC—3E通信测试。
|
||||
* PLC网口模块IP:192.168.250.21 端口号:4000
|
||||
|
||||
### 存储区
|
||||
|
||||
- 存储区 I,Q,M,D区。
|
||||
|
||||
### 通信测试
|
||||
|
||||
- 共测试BOOL,INT16,FLOAT共三种类型数据。
|
||||
|
||||
|
||||
- 测试M区及D区数据。
|
||||
|
||||
- 测试截图:
|
||||
|
||||
解析完成的配方为
|
||||
|
||||

|
||||
|
||||
测试结果:
|
||||
|
||||

|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 158 KiB |
Binary file not shown.
After Width: | Height: | Size: 156 KiB |
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
Binary file not shown.
After Width: | Height: | Size: 6.8 KiB |
|
@ -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
|
||||
}
|
||||
|
||||
]
|
||||
}
|
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue