Compare commits
302 Commits
2023_open_
...
master
Author | SHA1 | Date |
---|---|---|
|
49b20dfa6a | |
|
0fdf4f2ace | |
|
1c0edba5bd | |
|
22b980cc08 | |
|
64b2117012 | |
|
16a31c6739 | |
|
d664e2298e | |
|
02c82025c8 | |
|
dbaffab140 | |
|
1e59fd2a8d | |
|
3a99cc550c | |
|
d05754a98e | |
|
6d4cef4358 | |
|
5a2c07e1a9 | |
|
bd7966c5a3 | |
|
6114b4618f | |
|
71cf0c667c | |
|
80f80b64f0 | |
|
c1e99c449a | |
|
ba54936940 | |
![]() |
0efbe375eb | |
|
2e11a31da3 | |
|
dd0c6c66ed | |
|
446c3746a6 | |
|
2c4fe30bd3 | |
|
f7a232ed4f | |
|
f4e193a738 | |
|
29f1df2eea | |
|
4803239498 | |
|
736ba18769 | |
|
0b858de120 | |
|
56ec6edbe5 | |
|
5a12635b85 | |
|
c6de550e45 | |
|
52387d47a7 | |
|
48abec8a00 | |
![]() |
e62863bc22 | |
![]() |
a836b7f5c8 | |
|
79d741e015 | |
|
b6dd58c629 | |
|
16a53d4e80 | |
|
6d54c54bcc | |
|
a19312df24 | |
![]() |
361ea2b53e | |
![]() |
6b91caac18 | |
|
3b011500f1 | |
|
18eff4334c | |
|
50ecc1e520 | |
|
7a296b2744 | |
|
3a985252d9 | |
|
9f9e25a98e | |
|
baa04913bd | |
|
3c6e8ce109 | |
|
077dcd66ac | |
|
bcd9835020 | |
|
88ded7ca16 | |
|
8d2d7e3e09 | |
|
695dd91201 | |
|
e5df6012af | |
|
a24d73f710 | |
|
a7cbb0d041 | |
|
03039cbdab | |
|
6f3ec7de67 | |
|
10cc7cc270 | |
|
52b549c14c | |
|
213a92330e | |
|
fc380de895 | |
|
104791dbbe | |
|
b9bfce4865 | |
|
a2e5b49b19 | |
|
f5ad8437b5 | |
|
8f3df1e5c2 | |
|
0f5527d73a | |
|
620965dc2c | |
|
08c8f0b952 | |
|
50dab7b553 | |
|
c60f29277a | |
|
b939557317 | |
|
d987bf0357 | |
|
892613a0d5 | |
|
9a3f8bd120 | |
|
93614746fe | |
|
3b2a27ae9a | |
|
142a817ff3 | |
|
3dc6d58bdb | |
|
dc2aff8457 | |
![]() |
1044b26f14 | |
|
01f4d45e0c | |
|
d2ec2ba096 | |
|
63de0f983c | |
|
85b5d365df | |
|
9b92c71a21 | |
|
293fd9fea9 | |
|
1a3202748e | |
|
098a19e614 | |
![]() |
1e6f366843 | |
|
e054bb4c59 | |
|
23d6224395 | |
|
f6434bd573 | |
|
fb8c81c9f2 | |
|
6489d94dcd | |
|
5f9478251b | |
|
814a742260 | |
|
1dffac3f88 | |
|
9327b70860 | |
|
048796080a | |
|
2847b5a24d | |
|
6e8213af57 | |
|
38a087717c | |
|
f68900bb14 | |
|
df6543d41a | |
|
6bdf5cc0ce | |
|
7069f54ed9 | |
|
6942ad6d1d | |
|
2443536db5 | |
|
bca78a3133 | |
|
c7529f1702 | |
|
8f352253f9 | |
|
494312183b | |
|
c7309c478b | |
|
9199d2655f | |
|
6c96e1273c | |
|
f6cf46027d | |
|
76c66312c0 | |
|
d8213ec036 | |
|
7fe272fcb9 | |
|
0923c6239a | |
|
2e4a4367b0 | |
|
bbe1eba081 | |
|
255d7464f7 | |
|
5986dce9e7 | |
|
58ee6ad53b | |
|
ff4e53a980 | |
|
009b8a0a5a | |
|
1b904b7dad | |
|
348d53df91 | |
|
cc7109af18 | |
|
e5802dc0f3 | |
|
3e93d2e173 | |
|
bab22a96fe | |
|
49259b08a3 | |
|
28a1d12820 | |
|
cff963dab0 | |
|
05aa2078c8 | |
|
cf5a7ad103 | |
|
1d582ebcfd | |
|
87c4c585d9 | |
|
a290b93980 | |
|
618ca9d872 | |
|
c6b57ed826 | |
|
9e962d2cf2 | |
|
616aa90d25 | |
|
9d546c8c02 | |
|
a590eacebb | |
|
76c15215b8 | |
|
a81f8e35d2 | |
|
02e182db05 | |
|
a711491df6 | |
|
cd759ccc83 | |
|
051f67ddba | |
|
e292ce2fc8 | |
|
e7047a752d | |
|
cfe2cece57 | |
|
76868729bf | |
|
b9801f0a38 | |
|
53cb4a6efe | |
|
3aa16a8666 | |
|
e0de3d1e46 | |
|
f8b8ac46ca | |
|
9bc206fd0b | |
|
402f25a2fd | |
|
a1d05733de | |
|
337264d599 | |
|
9a97e9dd94 | |
|
093f362387 | |
|
3d35ff22e4 | |
|
eb74a93b36 | |
|
ad82f5beb7 | |
|
1e9146d2ff | |
|
616dc4584f | |
|
4c8df066b7 | |
|
9ae79832e9 | |
|
4de08ed386 | |
|
d5da547813 | |
|
084b9a6bc0 | |
|
ffe83b869a | |
|
c55286286e | |
|
a7d3e92357 | |
|
8202e08c9c | |
|
c4aaf920cd | |
|
3378579d9e | |
|
8a8a513cf1 | |
|
d3c7d7ce9f | |
|
e5e654988b | |
|
81924837dd | |
|
a92dc71ce4 | |
|
d0bf9c9564 | |
|
b2fef14aef | |
|
8c1423f50e | |
|
55ce48e0ba | |
|
f27c6d2091 | |
|
6d7250d4fd | |
|
52454eec8d | |
|
94d3d37a19 | |
|
88e8cc4193 | |
|
270d2b9ea3 | |
|
418bf921c6 | |
|
516b8627f7 | |
|
d1d846184b | |
|
ba81c73a06 | |
|
50d8ff5488 | |
|
e0e314e301 | |
|
98232123e4 | |
|
af33a3289c | |
|
b2ab878a33 | |
|
3c40a39d15 | |
|
0f2e05aed4 | |
|
71e3c8a654 | |
|
892bef64e9 | |
|
79d627a969 | |
|
b7e405ac94 | |
|
9b3f219b01 | |
|
d255ffaee5 | |
|
ab08ad959c | |
|
21379e813a | |
|
87446340f1 | |
|
041368d4c6 | |
|
ef4e4b37c0 | |
|
5af6d63cd4 | |
|
b82bdaea6b | |
|
46a15c1dc7 | |
|
9a210fa9db | |
|
6db0eccbe5 | |
|
e90c465a23 | |
|
719b02a3e7 | |
|
a247de691c | |
|
c96376ea25 | |
|
37764d4501 | |
|
267707c920 | |
|
29b15812b7 | |
|
54fb48f17b | |
|
7885326768 | |
|
966ccb5030 | |
|
51299c6b79 | |
|
53fc43e077 | |
|
fa439abd68 | |
|
242c7d66d2 | |
|
4f4bbc1d68 | |
|
38481e2ae2 | |
|
62e3006e1a | |
|
8c86c3c574 | |
|
dbfa37bf44 | |
|
29853ef76d | |
|
5b62808e28 | |
|
4d3858bf8f | |
|
987622d1e3 | |
|
a473111e5d | |
|
3437bfdc19 | |
|
98587d876d | |
|
6bbf1e2c4c | |
|
c2abf66f23 | |
|
d14272c55f | |
|
aa3e6c9370 | |
|
f7d0b0925c | |
|
b41a1709c6 | |
|
0b1489cfed | |
|
9fd61d3d2a | |
|
60a7835ef8 | |
|
5ef61d14b1 | |
|
474557a5ac | |
|
0a76e9c583 | |
|
e61ffc4589 | |
|
e8061577da | |
|
652e5789a7 | |
|
5da9a9c4ae | |
|
117789121e | |
|
bad8dc0fc2 | |
|
f24a0f2d47 | |
|
e33bd9dd78 | |
|
3427b3629d | |
|
29499a1ec3 | |
|
2ae328c773 | |
|
570e4a029c | |
|
b41748dfb6 | |
|
23b938f242 | |
|
55d63408fe | |
|
9e031ecee0 | |
|
d4b7fd6ba5 | |
|
74b31a5420 | |
|
a868ed3238 | |
|
544b0bcba4 | |
|
20113601e7 | |
|
fb458fe6cd | |
|
bb0fb51e7e | |
|
7ce3748947 | |
|
fa2c91e690 | |
|
e2edd918c3 | |
|
91ddfea1ed | |
|
2e4eb538b9 | |
|
4d56788af3 | |
|
0f5546a679 | |
|
b580f6b377 |
|
@ -22,9 +22,6 @@
|
||||||
[submodule "Ubiquitous/RT-Thread_Fusion_XiUOS/aiit_board/xidatong-riscv64/kendryte-sdk/kendryte-sdk-source"]
|
[submodule "Ubiquitous/RT-Thread_Fusion_XiUOS/aiit_board/xidatong-riscv64/kendryte-sdk/kendryte-sdk-source"]
|
||||||
path = Ubiquitous/RT-Thread_Fusion_XiUOS/aiit_board/xidatong-riscv64/kendryte-sdk/kendryte-sdk-source
|
path = Ubiquitous/RT-Thread_Fusion_XiUOS/aiit_board/xidatong-riscv64/kendryte-sdk/kendryte-sdk-source
|
||||||
url = https://www.gitlink.org.cn/chunyexixiaoyu/kendryte-sdk-source.git
|
url = https://www.gitlink.org.cn/chunyexixiaoyu/kendryte-sdk-source.git
|
||||||
[submodule "APP_Framework/lib/lorawan/lora_radio_driver"]
|
|
||||||
path = APP_Framework/lib/lorawan/lora_radio_driver
|
|
||||||
url = https://gitlink.org.cn/xuos/lora_radio_driver
|
|
||||||
[submodule "APP_Framework/lib/lorawan/lorawan_devicenode"]
|
[submodule "APP_Framework/lib/lorawan/lorawan_devicenode"]
|
||||||
path = APP_Framework/lib/lorawan/lorawan_devicenode
|
path = APP_Framework/lib/lorawan/lorawan_devicenode
|
||||||
url = https://gitlink.org.cn/xuos/lorawan_devicenode.git
|
url = https://gitlink.org.cn/xuos/lorawan_devicenode.git
|
||||||
|
|
|
@ -20,4 +20,5 @@ menu "Applications"
|
||||||
source "$APP_DIR/Applications/sensor_app/Kconfig"
|
source "$APP_DIR/Applications/sensor_app/Kconfig"
|
||||||
source "$APP_DIR/Applications/embedded_database_app/Kconfig"
|
source "$APP_DIR/Applications/embedded_database_app/Kconfig"
|
||||||
source "$APP_DIR/Applications/webnet/Kconfig"
|
source "$APP_DIR/Applications/webnet/Kconfig"
|
||||||
|
source "$APP_DIR/Applications/webserver/Kconfig"
|
||||||
endmenu
|
endmenu
|
||||||
|
|
|
@ -40,5 +40,9 @@ ifeq ($(CONFIG_ADD_XIZI_FEATURES),y)
|
||||||
SRC_DIR += webnet
|
SRC_DIR += webnet
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_APPLICATION_WEBSERVER),y)
|
||||||
|
SRC_DIR += webserver
|
||||||
|
endif
|
||||||
|
|
||||||
include $(KERNEL_ROOT)/compiler.mk
|
include $(KERNEL_ROOT)/compiler.mk
|
||||||
endif
|
endif
|
|
@ -281,6 +281,7 @@ menu "test app"
|
||||||
menuconfig USER_TEST_MQTTCLIENT
|
menuconfig USER_TEST_MQTTCLIENT
|
||||||
bool "Config test mqtt client"
|
bool "Config test mqtt client"
|
||||||
default n
|
default n
|
||||||
|
select LIB_USING_CJSON
|
||||||
|
|
||||||
menuconfig USER_TEST_FTPCLIENT
|
menuconfig USER_TEST_FTPCLIENT
|
||||||
bool "Config test ftp client"
|
bool "Config test ftp client"
|
||||||
|
|
|
@ -150,8 +150,10 @@ ifeq ($(CONFIG_ADD_XIZI_FEATURES),y)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_USER_TEST_FTPCLIENT_RISCV),y)
|
ifeq ($(CONFIG_USER_TEST_FTPCLIENT_RISCV),y)
|
||||||
|
ifeq ($(CONFIG_BSP_USING_W5500),y)
|
||||||
SRC_FILES += test_ftpclient_riscv/test_ftpclient_riscv.c
|
SRC_FILES += test_ftpclient_riscv/test_ftpclient_riscv.c
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_USER_TEST_LORA_P2P),y)
|
ifeq ($(CONFIG_USER_TEST_LORA_P2P),y)
|
||||||
SRC_FILES +=
|
SRC_FILES +=
|
||||||
|
|
|
@ -0,0 +1,162 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2020 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 test_4g_ec200a.c
|
||||||
|
* @brief Implement the connection 4G function, using QUECTEL EC200A device
|
||||||
|
* @version 1.1
|
||||||
|
* @author AIIT XUOS Lab
|
||||||
|
* @date 2023.10.15
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <transform.h>
|
||||||
|
|
||||||
|
#ifdef ADD_XIZI_FEATURES
|
||||||
|
|
||||||
|
char *trans_data = "{\"saleid\": \"52330000MJ87322565\", \"gateid\": \"10100001011\", \"type\": \"report\", \"time\": \"2023-06-15 17:22:00\", \"sequence\": \"268\", \"source\": \"da\", \"meter\": [{\"id\": \"T100106\", \"status\": \"1\", \"name\": \"T100106\", \"values\": {}}]}\r\n";
|
||||||
|
// const char chk_buad[] = {"AT+IPR?\r\n"};
|
||||||
|
const char set_mode[] = {"AT+QMTCFG=\"recv/mode\",0,0,1\r\n"};
|
||||||
|
// const char set_cfg[] = {"AT+QMTCFG=\"aliauth\",0,\"k0celEMx5DK\",\"test_device\",\"411aa14c0dc671f7ee869adced442d13\"\r\n"};
|
||||||
|
const char set_server[] = {"AT+QMTOPEN=0,\"xyheqmx.e3.luyouxia.net\",13333\r\n"};
|
||||||
|
// const char set_server[] = {"AT+QMTOPEN=0,\"iot-060a7p7c.mqtt.iothub.aliyuncs.com\",1883\r\n"};
|
||||||
|
const char set_conn[] = {"AT+QMTCONN=0,\"quectel\",\"test\",\"test123456\"\r\n"};
|
||||||
|
// const char set_conn[] = {"AT+QMTCONN=0,\"sysoul\"\r\n"};
|
||||||
|
// const char set_get[] = {"AT+QMTSUB=0,1,\"/get\",0\r\n"};
|
||||||
|
// const char set_reply[] = {"AT+QMTPUBEX=0,0,0,0,\"/reply\",1000\r\n"};
|
||||||
|
char recv_buf[100] = {0};
|
||||||
|
int buf_len = 0;
|
||||||
|
|
||||||
|
|
||||||
|
void Test4G(void)
|
||||||
|
{
|
||||||
|
int quectel_fd = PrivOpen(ADAPTER_QUECTEL_DRIVER, O_RDWR);
|
||||||
|
if (quectel_fd < 0) {
|
||||||
|
printf("open quectel fd error:%d\n", quectel_fd);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
printf("quectel fopen success\n");
|
||||||
|
|
||||||
|
struct SerialDataCfg quectel_cfg;
|
||||||
|
memset(&quectel_cfg, 0, sizeof(struct SerialDataCfg));
|
||||||
|
quectel_cfg.serial_baud_rate = BAUD_RATE_115200;
|
||||||
|
quectel_cfg.serial_data_bits = DATA_BITS_8;
|
||||||
|
quectel_cfg.serial_stop_bits = STOP_BITS_1;
|
||||||
|
quectel_cfg.serial_parity_mode = PARITY_NONE;
|
||||||
|
quectel_cfg.serial_bit_order = BIT_ORDER_LSB;
|
||||||
|
quectel_cfg.serial_invert_mode = NRZ_NORMAL;
|
||||||
|
// quectel_cfg.serial_buffer_size = SERIAL_RB_BUFSZ;
|
||||||
|
quectel_cfg.serial_buffer_size = 1024;
|
||||||
|
quectel_cfg.serial_timeout = 1000;
|
||||||
|
quectel_cfg.is_ext_uart = 0;
|
||||||
|
// quectel_cfg.ext_uart_no = ADAPTER_QUECTEL_DRIVER_EXT_PORT;
|
||||||
|
// quectel_cfg.port_configure = PORT_CFG_INIT;
|
||||||
|
|
||||||
|
struct PrivIoctlCfg ioctl_cfg;
|
||||||
|
ioctl_cfg.ioctl_driver_type = SERIAL_TYPE;
|
||||||
|
ioctl_cfg.args = &quectel_cfg;
|
||||||
|
if (0 != PrivIoctl(quectel_fd, OPE_INT, &ioctl_cfg)) {
|
||||||
|
printf("ioctl quectel fd error %d\n", quectel_fd);
|
||||||
|
PrivClose(quectel_fd);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("4G module set\n");
|
||||||
|
|
||||||
|
// memset(recv_buf, 0, sizeof(recv_buf));
|
||||||
|
// printf("chk_buad: %s\n", chk_buad);
|
||||||
|
// printf("chk_buad_len: %d\n", strlen(chk_buad));
|
||||||
|
// PrivWrite(quectel_fd, chk_buad, strlen(chk_buad));
|
||||||
|
// PrivTaskDelay(30);
|
||||||
|
// buf_len = PrivRead(quectel_fd, recv_buf, sizeof(recv_buf));
|
||||||
|
// printf("buf_len: %d\n", buf_len);
|
||||||
|
// printf("[%s] Info: Recv from uart: %s\n", __func__, recv_buf);
|
||||||
|
// PrivTaskDelay(1000);
|
||||||
|
|
||||||
|
memset(recv_buf, 0, sizeof(recv_buf));
|
||||||
|
printf("set_mode: %s\n", set_mode);
|
||||||
|
printf("set_mode_len: %d\n", strlen(set_mode));
|
||||||
|
PrivWrite(quectel_fd, set_mode, strlen(set_mode));
|
||||||
|
PrivTaskDelay(30);
|
||||||
|
buf_len = PrivRead(quectel_fd, recv_buf, sizeof(recv_buf));
|
||||||
|
printf("buf_len: %d\n", buf_len);
|
||||||
|
printf("[%s] Info: Recv from uart: %s\n", __func__, recv_buf);
|
||||||
|
PrivTaskDelay(1000);
|
||||||
|
|
||||||
|
// memset(recv_buf, 0, sizeof(recv_buf));
|
||||||
|
// printf("set_cfg: %s\n", set_cfg);
|
||||||
|
// printf("set_cfg_len: %d\n", strlen(set_cfg));
|
||||||
|
// PrivWrite(quectel_fd, set_cfg, strlen(set_cfg));
|
||||||
|
// PrivTaskDelay(30);
|
||||||
|
// buf_len = PrivRead(quectel_fd, recv_buf, sizeof(recv_buf));
|
||||||
|
// printf("buf_len: %d\n", buf_len);
|
||||||
|
// printf("[%s] Info: Recv from uart: %s\n", __func__, recv_buf);
|
||||||
|
// PrivTaskDelay(1000);
|
||||||
|
|
||||||
|
memset(recv_buf, 0, sizeof(recv_buf));
|
||||||
|
printf("set_server: %s\n", set_server);
|
||||||
|
printf("set_server_len: %d\n", strlen(set_server));
|
||||||
|
PrivWrite(quectel_fd, set_server, strlen(set_server));
|
||||||
|
PrivTaskDelay(30);
|
||||||
|
buf_len = PrivRead(quectel_fd, recv_buf, sizeof(recv_buf));
|
||||||
|
printf("buf_len: %d\n", buf_len);
|
||||||
|
printf("[%s] Info: Recv from uart: %s\n", __func__, recv_buf);
|
||||||
|
PrivTaskDelay(1000);
|
||||||
|
|
||||||
|
memset(recv_buf, 0, sizeof(recv_buf));
|
||||||
|
printf("set_conn: %s\n", set_conn);
|
||||||
|
printf("set_conn_len: %d\n", strlen(set_conn));
|
||||||
|
PrivWrite(quectel_fd, set_conn, strlen(set_conn));
|
||||||
|
PrivTaskDelay(30);
|
||||||
|
buf_len = PrivRead(quectel_fd, recv_buf, sizeof(recv_buf));
|
||||||
|
printf("buf_len: %d\n", buf_len);
|
||||||
|
printf("[%s] Info: Recv from uart: %s\n", __func__, recv_buf);
|
||||||
|
PrivTaskDelay(1000);
|
||||||
|
|
||||||
|
while (1) {
|
||||||
|
printf("start send\n");
|
||||||
|
char set_reply[50] = {"AT+QMTPUBEX=0,0,0,0,\"/reply\","};
|
||||||
|
char data_len_str[20];
|
||||||
|
sprintf(data_len_str, "%d", strlen(trans_data));
|
||||||
|
printf("data_len_str: %s\n", data_len_str);
|
||||||
|
strcat(set_reply, data_len_str);
|
||||||
|
strcat(set_reply, "\r\n");
|
||||||
|
|
||||||
|
memset(recv_buf, 0, sizeof(recv_buf));
|
||||||
|
printf("set_reply: %s\n", set_reply);
|
||||||
|
printf("set_reply_len: %d\n", strlen(set_reply));
|
||||||
|
PrivWrite(quectel_fd, set_reply, strlen(set_reply));
|
||||||
|
PrivTaskDelay(30);
|
||||||
|
buf_len = PrivRead(quectel_fd, recv_buf, sizeof(recv_buf));
|
||||||
|
printf("buf_len: %d\n", buf_len);
|
||||||
|
printf("[%s] Info: Recv from uart: %s\n", __func__, recv_buf);
|
||||||
|
PrivTaskDelay(500);
|
||||||
|
|
||||||
|
memset(recv_buf, 0, sizeof(recv_buf));
|
||||||
|
printf("send_data: %s\n", trans_data);
|
||||||
|
printf("send_data_len: %d\n", strlen(trans_data));
|
||||||
|
PrivWrite(quectel_fd, trans_data, strlen(trans_data));
|
||||||
|
PrivTaskDelay(30);
|
||||||
|
buf_len = PrivRead(quectel_fd, recv_buf, sizeof(recv_buf));
|
||||||
|
printf("buf_len: %d\n", buf_len);
|
||||||
|
printf("[%s] Info: Recv from uart: %s\n", __func__, recv_buf);
|
||||||
|
PrivTaskDelay(5000);
|
||||||
|
}
|
||||||
|
|
||||||
|
PrivClose(quectel_fd);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
PRIV_SHELL_CMD_FUNCTION(Test4G, a quectel test sample, PRIV_SHELL_CMD_MAIN_ATTR);
|
||||||
|
#endif
|
|
@ -18,6 +18,7 @@
|
||||||
* @date: 2023/2/17
|
* @date: 2023/2/17
|
||||||
*/
|
*/
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <transform.h>
|
#include <transform.h>
|
||||||
#ifdef ADD_XIZI_FEATURES
|
#ifdef ADD_XIZI_FEATURES
|
||||||
|
@ -54,28 +55,34 @@ void TestCAN(void)
|
||||||
}
|
}
|
||||||
printf("CAN configure successful!\n");
|
printf("CAN configure successful!\n");
|
||||||
|
|
||||||
uint8_t data_buff[64u] = {1,2,3,4,4,3,2,1};
|
uint8_t data_buff[64u] = "12344321";
|
||||||
struct CanSendConfigure frame_send;
|
struct CanSendConfigure frame_send;
|
||||||
frame_send.ide=0;
|
frame_send.ide=0;
|
||||||
frame_send.stdid = 0x55;
|
frame_send.stdid = 0x55;
|
||||||
frame_send.rtr=0;
|
frame_send.rtr=0;
|
||||||
frame_send.data_lenth=8;
|
frame_send.data_lenth=8;
|
||||||
frame_send.data = data_buff;
|
|
||||||
|
|
||||||
struct CanSendConfigure frame_recv;
|
struct CanSendConfigure frame_recv;
|
||||||
uint8_t recv_buff[65U] = {0};
|
uint8_t recv_buff[64u] = {};
|
||||||
frame_recv.data = recv_buff;
|
frame_recv.data = recv_buff;
|
||||||
|
|
||||||
// CAN write
|
// CAN write
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
PrivTaskDelay(500);
|
// PrivTaskDelay(500);
|
||||||
PrivWrite(can_fd, &frame_send, NONE);
|
// PrivWrite(can_fd, &frame_send, NONE);
|
||||||
PrivTaskDelay(500);
|
// PrivTaskDelay(500);
|
||||||
PrivRead(can_fd, &frame_recv, NONE);
|
PrivRead(can_fd, &frame_recv, NONE);
|
||||||
// if any data has received,Then printf message
|
// if any data has received,Then printf message
|
||||||
if(frame_recv.data_lenth > 0){
|
if(frame_recv.data_lenth > 0){
|
||||||
printf("ID %08x:%s\n",frame_recv.exdid,frame_recv.data);
|
printf("ID %08x : \n",frame_recv.exdid);
|
||||||
|
for(int i = 0; i < frame_recv.data_lenth; i ++) {
|
||||||
|
printf("0x%x ", frame_recv.data[i]);
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
frame_send.data = recv_buff;
|
||||||
|
PrivWrite(can_fd, &frame_send, NONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include <transform.h>
|
#include <transform.h>
|
||||||
#ifdef ADD_XIZI_FEATURES
|
#ifdef ADD_XIZI_FEATURES
|
||||||
|
|
||||||
|
#ifdef BSP_USING_W5500
|
||||||
#include <socket.h>
|
#include <socket.h>
|
||||||
|
|
||||||
#define BUFF_SIZE 128
|
#define BUFF_SIZE 128
|
||||||
|
@ -189,6 +190,6 @@ PRIV_SHELL_CMD_FUNCTION(TestSocketAsClient, a w5500 client-ip-port-msg test samp
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -22,7 +22,7 @@
|
||||||
#include <transform.h>
|
#include <transform.h>
|
||||||
#ifdef ADD_XIZI_FEATURES
|
#ifdef ADD_XIZI_FEATURES
|
||||||
|
|
||||||
#define BSP_LED_PIN 29
|
#define BSP_LED_PIN 134
|
||||||
#define NULL_PARAMETER 0
|
#define NULL_PARAMETER 0
|
||||||
|
|
||||||
static uint16_t pin_fd=0;
|
static uint16_t pin_fd=0;
|
||||||
|
@ -30,6 +30,7 @@ static struct PinStat pin_led;
|
||||||
|
|
||||||
void LedFlip(void *parameter)
|
void LedFlip(void *parameter)
|
||||||
{
|
{
|
||||||
|
printf("%s val %d time %d\n", __func__, pin_led.val, PrivGetTickTime());
|
||||||
pin_led.pin = BSP_LED_PIN;
|
pin_led.pin = BSP_LED_PIN;
|
||||||
pin_led.val = !pin_led.val;
|
pin_led.val = !pin_led.val;
|
||||||
PrivWrite(pin_fd, &pin_led, NULL_PARAMETER);
|
PrivWrite(pin_fd, &pin_led, NULL_PARAMETER);
|
||||||
|
@ -37,7 +38,7 @@ void LedFlip(void *parameter)
|
||||||
|
|
||||||
void TestHwTimer(void)
|
void TestHwTimer(void)
|
||||||
{
|
{
|
||||||
x_ticks_t period = 1;
|
uint32_t period_ms = 500;
|
||||||
|
|
||||||
pin_fd = PrivOpen(HWTIMER_PIN_DEV_DRIVER, O_RDWR);
|
pin_fd = PrivOpen(HWTIMER_PIN_DEV_DRIVER, O_RDWR);
|
||||||
if(pin_fd<0) {
|
if(pin_fd<0) {
|
||||||
|
@ -75,7 +76,7 @@ void TestHwTimer(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ioctl_cfg.args = (void *).
|
ioctl_cfg.args = (void *)&period_ms;
|
||||||
if (0 != PrivIoctl(timer_fd, OPE_CFG, &ioctl_cfg)) {
|
if (0 != PrivIoctl(timer_fd, OPE_CFG, &ioctl_cfg)) {
|
||||||
printf("timer pin fd error %d\n", pin_fd);
|
printf("timer pin fd error %d\n", pin_fd);
|
||||||
PrivClose(pin_fd);
|
PrivClose(pin_fd);
|
||||||
|
|
|
@ -98,6 +98,7 @@ void TestLora(int argc, char *argv[])
|
||||||
uart_cfg.serial_buffer_size = SERIAL_RB_BUFSZ;
|
uart_cfg.serial_buffer_size = SERIAL_RB_BUFSZ;
|
||||||
uart_cfg.serial_timeout = 1000;
|
uart_cfg.serial_timeout = 1000;
|
||||||
uart_cfg.is_ext_uart = 0;
|
uart_cfg.is_ext_uart = 0;
|
||||||
|
uart_cfg.dev_recv_callback = NULL;
|
||||||
|
|
||||||
ioctl_cfg.ioctl_driver_type = SERIAL_TYPE;
|
ioctl_cfg.ioctl_driver_type = SERIAL_TYPE;
|
||||||
ioctl_cfg.args = (void *)&uart_cfg;
|
ioctl_cfg.args = (void *)&uart_cfg;
|
||||||
|
|
|
@ -62,6 +62,7 @@ static struct SerialDataCfg serial_cfg =
|
||||||
.serial_buffer_size = SERIAL_RB_BUFSZ,
|
.serial_buffer_size = SERIAL_RB_BUFSZ,
|
||||||
.serial_timeout = E220_DAFAULT_SERIAL_TIMEOUT, // 串口超时配置
|
.serial_timeout = E220_DAFAULT_SERIAL_TIMEOUT, // 串口超时配置
|
||||||
.is_ext_uart = 0,
|
.is_ext_uart = 0,
|
||||||
|
.dev_recv_callback = NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum LoraMode current_mode = -1; // 当前模块处于什么模式
|
enum LoraMode current_mode = -1; // 当前模块处于什么模式
|
||||||
|
|
|
@ -569,7 +569,7 @@ int32_t MQTTMsgPublish(int32_t sock, char *topic, int8_t qos, uint8_t* msg)
|
||||||
uint8_t buf[MSG_MAX_LEN];
|
uint8_t buf[MSG_MAX_LEN];
|
||||||
int32_t buflen = sizeof(buf),len;
|
int32_t buflen = sizeof(buf),len;
|
||||||
MQTTString topicString = MQTTString_initializer;
|
MQTTString topicString = MQTTString_initializer;
|
||||||
uint16_t packid = 0,packetidbk;
|
uint16_t packid = 0,packetidbk = 0;
|
||||||
|
|
||||||
//填充主题
|
//填充主题
|
||||||
topicString.cstring = (char *)topic;
|
topicString.cstring = (char *)topic;
|
||||||
|
|
|
@ -138,6 +138,7 @@ void Test485(void)
|
||||||
uart_cfg.serial_buffer_size = SERIAL_RB_BUFSZ;
|
uart_cfg.serial_buffer_size = SERIAL_RB_BUFSZ;
|
||||||
uart_cfg.serial_timeout = -1;
|
uart_cfg.serial_timeout = -1;
|
||||||
uart_cfg.is_ext_uart = 0;
|
uart_cfg.is_ext_uart = 0;
|
||||||
|
uart_cfg.dev_recv_callback = NULL;
|
||||||
|
|
||||||
ioctl_cfg.ioctl_driver_type = SERIAL_TYPE;
|
ioctl_cfg.ioctl_driver_type = SERIAL_TYPE;
|
||||||
ioctl_cfg.args = (void *)&uart_cfg;
|
ioctl_cfg.args = (void *)&uart_cfg;
|
||||||
|
|
|
@ -70,6 +70,7 @@ void Test485(void)
|
||||||
uart_cfg.serial_buffer_size = SERIAL_RB_BUFSZ;
|
uart_cfg.serial_buffer_size = SERIAL_RB_BUFSZ;
|
||||||
uart_cfg.serial_timeout = 1000;
|
uart_cfg.serial_timeout = 1000;
|
||||||
uart_cfg.is_ext_uart = 0;
|
uart_cfg.is_ext_uart = 0;
|
||||||
|
uart_cfg.dev_recv_callback = NULL;
|
||||||
|
|
||||||
ioctl_cfg.ioctl_driver_type = SERIAL_TYPE;
|
ioctl_cfg.ioctl_driver_type = SERIAL_TYPE;
|
||||||
ioctl_cfg.args = (void *)&uart_cfg;
|
ioctl_cfg.args = (void *)&uart_cfg;
|
||||||
|
|
|
@ -76,10 +76,12 @@ struct IperfParam {
|
||||||
static void* TestIperfServer(void* param)
|
static void* TestIperfServer(void* param)
|
||||||
{
|
{
|
||||||
struct IperfParam* iperf_param = (struct IperfParam*)param;
|
struct IperfParam* iperf_param = (struct IperfParam*)param;
|
||||||
int sock = socket(AF_INET, SOCK_STREAM, 0);
|
int sock = socket(AF_INET, SOCK_STREAM, 6);
|
||||||
if (sock < 0) {
|
if (sock < 0) {
|
||||||
printf("[%s] Err: Can't create socker.\n", __func__);
|
printf("[%s] Err: Can't create socker.\n", __func__);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
} else {
|
||||||
|
printf("[%s] Info Create server socket %d\n", __func__, sock);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t* recv_data = (uint8_t*)malloc(IPERF_BUFSZ);
|
uint8_t* recv_data = (uint8_t*)malloc(IPERF_BUFSZ);
|
||||||
|
@ -121,8 +123,9 @@ static void* TestIperfServer(void* param)
|
||||||
socklen_t sin_size = sizeof(struct sockaddr_in);
|
socklen_t sin_size = sizeof(struct sockaddr_in);
|
||||||
struct sockaddr_in client_addr;
|
struct sockaddr_in client_addr;
|
||||||
int connection = accept(sock, (struct sockaddr*)&client_addr, &sin_size);
|
int connection = accept(sock, (struct sockaddr*)&client_addr, &sin_size);
|
||||||
printf("[%s] Info: New client connected from (%s, %d)\n", __func__,
|
printf("[%s] Info: New client connected from (%s, %d), connect: %d\n", __func__,
|
||||||
inet_ntoa(client_addr.sin_addr), ntohs(client_addr.sin_port));
|
inet_ntoa(client_addr.sin_addr), ntohs(client_addr.sin_port),
|
||||||
|
connection);
|
||||||
|
|
||||||
int flag = 1;
|
int flag = 1;
|
||||||
setsockopt(connection,
|
setsockopt(connection,
|
||||||
|
@ -141,8 +144,8 @@ static void* TestIperfServer(void* param)
|
||||||
inet_ntoa(client_addr.sin_addr), ntohs(client_addr.sin_port));
|
inet_ntoa(client_addr.sin_addr), ntohs(client_addr.sin_port));
|
||||||
break;
|
break;
|
||||||
} else if (bytes_received < 0) {
|
} else if (bytes_received < 0) {
|
||||||
KPrintf("recv error, client: (%s, %d)\n",
|
KPrintf("recv error: %d, client: (%s, %d)\n",
|
||||||
inet_ntoa(client_addr.sin_addr), ntohs(client_addr.sin_port));
|
bytes_received, inet_ntoa(client_addr.sin_addr), ntohs(client_addr.sin_port));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -258,8 +261,6 @@ enum IperfParamEnum {
|
||||||
|
|
||||||
void TestSocket(int argc, char* argv[])
|
void TestSocket(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
lwip_config_tcp(0, lwip_ipaddr, lwip_netmask, lwip_gwaddr);
|
|
||||||
|
|
||||||
static char usage_info[] = "Run either a iperf server or iperf client.";
|
static char usage_info[] = "Run either a iperf server or iperf client.";
|
||||||
static char program_info[] = "Lwip socket test task, a simple iperf.";
|
static char program_info[] = "Lwip socket test task, a simple iperf.";
|
||||||
static const char* const usages[] = {
|
static const char* const usages[] = {
|
||||||
|
|
|
@ -23,12 +23,13 @@
|
||||||
void TimerFunction(union sigval sig_val)
|
void TimerFunction(union sigval sig_val)
|
||||||
{
|
{
|
||||||
static int cnt = 0;
|
static int cnt = 0;
|
||||||
printf("%s cnt %d\n", __func__, cnt++);
|
printf("%s cnt %d ms %d\n", __func__, cnt++, PrivGetTickTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestTimer(void)
|
void TestTimer(void)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
static int count = 0;
|
||||||
int timer_flags;
|
int timer_flags;
|
||||||
timer_t timer_id;
|
timer_t timer_id;
|
||||||
struct sigevent evp;
|
struct sigevent evp;
|
||||||
|
@ -40,7 +41,9 @@ void TestTimer(void)
|
||||||
evp.sigev_notify_function = TimerFunction;
|
evp.sigev_notify_function = TimerFunction;
|
||||||
evp.sigev_notify_attributes = &timer_flags;
|
evp.sigev_notify_attributes = &timer_flags;
|
||||||
|
|
||||||
ret = timer_create(CLOCK_REALTIME, &evp, &timer_id);
|
count++;
|
||||||
|
|
||||||
|
ret = PrivTimerCreate(count, &evp, &timer_id);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
printf("%s create timer failed ret %d\n", __func__, ret);
|
printf("%s create timer failed ret %d\n", __func__, ret);
|
||||||
return;
|
return;
|
||||||
|
@ -48,14 +51,14 @@ void TestTimer(void)
|
||||||
|
|
||||||
struct itimerspec value;
|
struct itimerspec value;
|
||||||
//active time interval
|
//active time interval
|
||||||
value.it_interval.tv_sec = 2;
|
value.it_interval.tv_sec = 0;
|
||||||
value.it_interval.tv_nsec = 0;
|
value.it_interval.tv_nsec = 1000000 * 10;
|
||||||
|
|
||||||
//first timer set time
|
//first timer set time
|
||||||
value.it_value.tv_sec = 2;
|
value.it_value.tv_sec = 2;
|
||||||
value.it_value.tv_nsec = 0;
|
value.it_value.tv_nsec = 0;
|
||||||
|
|
||||||
ret = timer_settime(timer_id, 1, &value, NULL);
|
ret = PrivTimerModify(timer_id, 1, &value, NULL);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
printf("%s set timer time failed ret %d\n", __func__, ret);
|
printf("%s set timer time failed ret %d\n", __func__, ret);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -68,6 +68,7 @@ void TestUart(int argc, char* argv[])
|
||||||
uart_cfg.serial_buffer_size = SERIAL_RB_BUFSZ;
|
uart_cfg.serial_buffer_size = SERIAL_RB_BUFSZ;
|
||||||
uart_cfg.serial_timeout = -1;
|
uart_cfg.serial_timeout = -1;
|
||||||
uart_cfg.is_ext_uart = 0;
|
uart_cfg.is_ext_uart = 0;
|
||||||
|
uart_cfg.dev_recv_callback = NULL;
|
||||||
|
|
||||||
struct PrivIoctlCfg ioctl_cfg;
|
struct PrivIoctlCfg ioctl_cfg;
|
||||||
ioctl_cfg.ioctl_driver_type = SERIAL_TYPE;
|
ioctl_cfg.ioctl_driver_type = SERIAL_TYPE;
|
||||||
|
|
|
@ -15,6 +15,10 @@ ifeq ($(CONFIG_ADD_XIZI_FEATURES),y)
|
||||||
SRC_DIR += socket_demo
|
SRC_DIR += socket_demo
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_CONNECTION_ADAPTER_FREEMODBUSTCP),y)
|
||||||
|
SRC_DIR += freemodbus_tcp_slave
|
||||||
|
endif
|
||||||
|
|
||||||
include $(KERNEL_ROOT)/compiler.mk
|
include $(KERNEL_ROOT)/compiler.mk
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
SRC_FILES := tcpserver_sample.c
|
||||||
|
|
||||||
|
include $(KERNEL_ROOT)/compiler.mk
|
|
@ -0,0 +1,259 @@
|
||||||
|
/*
|
||||||
|
* FreeModbus Libary: Win32 Demo Application
|
||||||
|
* Copyright (C) 2006 Christian Walter <wolti@sil.at>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* File: $Id$
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**********************************************************
|
||||||
|
* Linux TCP support.
|
||||||
|
* Based on Walter's project.
|
||||||
|
* Modified by Steven Guo <gotop167@163.com>
|
||||||
|
***********************************************************/
|
||||||
|
|
||||||
|
/* ----------------------- Standard C Libs includes --------------------------*/
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <pthread.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#include <transform.h>
|
||||||
|
#include "lwip/sys.h"
|
||||||
|
#include "lwip/sockets.h"
|
||||||
|
|
||||||
|
/* ----------------------- Modbus includes ----------------------------------*/
|
||||||
|
#include "mb.h"
|
||||||
|
#include "mbport.h"
|
||||||
|
|
||||||
|
/* ----------------------- Defines ------------------------------------------*/
|
||||||
|
#define PROG "freemodbus"
|
||||||
|
|
||||||
|
#define REG_INPUT_START 1000
|
||||||
|
#define REG_INPUT_NREGS 4
|
||||||
|
#define REG_HOLDING_START 2000
|
||||||
|
#define REG_HOLDING_NREGS 10
|
||||||
|
|
||||||
|
/* ----------------------- Static variables ---------------------------------*/
|
||||||
|
static USHORT usRegInputStart = REG_INPUT_START;
|
||||||
|
static USHORT usRegInputBuf[REG_INPUT_NREGS];
|
||||||
|
static USHORT usRegHoldingStart = REG_HOLDING_START;
|
||||||
|
static USHORT usRegHoldingBuf[REG_HOLDING_NREGS];
|
||||||
|
static pthread_mutex_t xLock;
|
||||||
|
static enum ThreadState
|
||||||
|
{
|
||||||
|
STOPPED,
|
||||||
|
RUNNING,
|
||||||
|
SHUTDOWN
|
||||||
|
} ePollThreadState;
|
||||||
|
|
||||||
|
/* ----------------------- Static functions ---------------------------------*/
|
||||||
|
static BOOL bCreatePollingThread( void );
|
||||||
|
static enum ThreadState eGetPollingThreadState( void );
|
||||||
|
static void eSetPollingThreadState( enum ThreadState eNewState );
|
||||||
|
static void* pvPollingThread( void *pvParameter );
|
||||||
|
int LWIPConnectSocket(uint16_t port);
|
||||||
|
|
||||||
|
/* ----------------------- Start implementation -----------------------------*/
|
||||||
|
int MBSlave()
|
||||||
|
{
|
||||||
|
int iExitCode;
|
||||||
|
CHAR cCh;
|
||||||
|
BOOL bDoExit;
|
||||||
|
usRegHoldingBuf[5] = 123;
|
||||||
|
usRegHoldingBuf[7] = 234;
|
||||||
|
|
||||||
|
printf("%s ip %d.%d.%d.%d mask %d.%d.%d.%d gw %d.%d.%d.%d\n", __func__,
|
||||||
|
192, 168, 250, 233,
|
||||||
|
255, 255, 255, 255,
|
||||||
|
192, 168, 250, 1);
|
||||||
|
uint8_t local_ip[4] = {192,168,250,233};
|
||||||
|
uint8_t gateway[4] = {192,168,250,1};
|
||||||
|
uint8_t netmask[4] = {255,255,255,0};
|
||||||
|
lwip_config_tcp(0, local_ip, netmask, gateway);
|
||||||
|
printf("%s LWIPInit done\n", __func__);
|
||||||
|
|
||||||
|
if( eMBTCPInit( MB_TCP_PORT_USE_DEFAULT ) != MB_ENOERR )
|
||||||
|
{
|
||||||
|
fprintf( stderr, "%s: can't initialize modbus stack!\r\n", PROG );
|
||||||
|
iExitCode = EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
eSetPollingThreadState( STOPPED );
|
||||||
|
/* CLI interface. */
|
||||||
|
if( bCreatePollingThread( ) != TRUE )
|
||||||
|
{
|
||||||
|
printf( "Can't start protocol stack! Already running?\r\n" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
printf("%d %d %s\n",sizeof(usRegHoldingBuf),__LINE__,__func__);
|
||||||
|
|
||||||
|
while(1)
|
||||||
|
{
|
||||||
|
for(int i =0; i<sizeof(usRegHoldingBuf)/2;i++)
|
||||||
|
{
|
||||||
|
printf("poll recv is %3d\n", usRegHoldingBuf[i]);
|
||||||
|
MdelayKTask(100);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return iExitCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
PRIV_SHELL_CMD_FUNCTION(MBSlave, a Mtcp server Demo, PRIV_SHELL_CMD_MAIN_ATTR);
|
||||||
|
|
||||||
|
|
||||||
|
BOOL bCreatePollingThread( void )
|
||||||
|
{
|
||||||
|
BOOL bResult;
|
||||||
|
pthread_t xThread;
|
||||||
|
if( eGetPollingThreadState( ) == STOPPED )
|
||||||
|
{
|
||||||
|
if( pthread_create( &xThread, NULL, pvPollingThread, NULL ) != 0 )
|
||||||
|
{
|
||||||
|
/* Can't create the polling thread. */
|
||||||
|
bResult = FALSE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bResult = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bResult = FALSE;
|
||||||
|
}
|
||||||
|
return bResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void* pvPollingThread( void *pvParameter )
|
||||||
|
{
|
||||||
|
eSetPollingThreadState( RUNNING );
|
||||||
|
|
||||||
|
if( eMBEnable( ) == MB_ENOERR )
|
||||||
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
if( eMBPoll( ) != MB_ENOERR )
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
while( eGetPollingThreadState( ) != SHUTDOWN );
|
||||||
|
}
|
||||||
|
|
||||||
|
( void )eMBDisable( );
|
||||||
|
|
||||||
|
eSetPollingThreadState( STOPPED );
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum ThreadState eGetPollingThreadState( )
|
||||||
|
{
|
||||||
|
enum ThreadState eCurState;
|
||||||
|
|
||||||
|
( void )pthread_mutex_lock( &xLock );
|
||||||
|
eCurState = ePollThreadState;
|
||||||
|
( void )pthread_mutex_unlock( &xLock );
|
||||||
|
|
||||||
|
return eCurState;
|
||||||
|
}
|
||||||
|
|
||||||
|
void eSetPollingThreadState( enum ThreadState eNewState )
|
||||||
|
{
|
||||||
|
( void )pthread_mutex_lock( &xLock );
|
||||||
|
ePollThreadState = eNewState;
|
||||||
|
( void )pthread_mutex_unlock( &xLock );
|
||||||
|
}
|
||||||
|
|
||||||
|
eMBErrorCode eMBRegInputCB( UCHAR * pucRegBuffer, USHORT usAddress, USHORT usNRegs )
|
||||||
|
{
|
||||||
|
eMBErrorCode eStatus = MB_ENOERR;
|
||||||
|
int iRegIndex;
|
||||||
|
|
||||||
|
if( ( usAddress >= REG_INPUT_START )
|
||||||
|
&& ( usAddress + usNRegs <= REG_INPUT_START + REG_INPUT_NREGS ) )
|
||||||
|
{
|
||||||
|
iRegIndex = ( int )( usAddress - usRegInputStart );
|
||||||
|
while( usNRegs > 0 )
|
||||||
|
{
|
||||||
|
*pucRegBuffer++ = ( unsigned char )( usRegInputBuf[iRegIndex] >> 8 );
|
||||||
|
*pucRegBuffer++ = ( unsigned char )( usRegInputBuf[iRegIndex] & 0xFF );
|
||||||
|
iRegIndex++;
|
||||||
|
usNRegs--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
eStatus = MB_ENOREG;
|
||||||
|
}
|
||||||
|
|
||||||
|
return eStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
eMBErrorCode eMBRegHoldingCB( UCHAR * pucRegBuffer, USHORT usAddress, USHORT usNRegs, eMBRegisterMode eMode )
|
||||||
|
{
|
||||||
|
eMBErrorCode eStatus = MB_ENOERR;
|
||||||
|
int iRegIndex;
|
||||||
|
|
||||||
|
if( ( usAddress >= REG_HOLDING_START ) &&
|
||||||
|
( usAddress + usNRegs <= REG_HOLDING_START + REG_HOLDING_NREGS ) )
|
||||||
|
{
|
||||||
|
iRegIndex = ( int )( usAddress - usRegHoldingStart );
|
||||||
|
switch ( eMode )
|
||||||
|
{
|
||||||
|
/* Pass current register values to the protocol stack. */
|
||||||
|
case MB_REG_READ:
|
||||||
|
while( usNRegs > 0 )
|
||||||
|
{
|
||||||
|
*pucRegBuffer++ = ( UCHAR ) ( usRegHoldingBuf[iRegIndex] >> 8 );
|
||||||
|
*pucRegBuffer++ = ( UCHAR ) ( usRegHoldingBuf[iRegIndex] & 0xFF );
|
||||||
|
iRegIndex++;
|
||||||
|
usNRegs--;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* Update current register values with new values from the
|
||||||
|
* protocol stack. */
|
||||||
|
case MB_REG_WRITE:
|
||||||
|
while( usNRegs > 0 )
|
||||||
|
{
|
||||||
|
usRegHoldingBuf[iRegIndex] = *pucRegBuffer++ << 8;
|
||||||
|
usRegHoldingBuf[iRegIndex] |= *pucRegBuffer++;
|
||||||
|
iRegIndex++;
|
||||||
|
usNRegs--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
eStatus = MB_ENOREG;
|
||||||
|
}
|
||||||
|
return eStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
eMBErrorCode eMBRegCoilsCB( UCHAR * pucRegBuffer, USHORT usAddress, USHORT usNCoils, eMBRegisterMode eMode )
|
||||||
|
{
|
||||||
|
return MB_ENOREG;
|
||||||
|
}
|
||||||
|
|
||||||
|
eMBErrorCode eMBRegDiscreteCB( UCHAR * pucRegBuffer, USHORT usAddress, USHORT usNDiscrete )
|
||||||
|
{
|
||||||
|
return MB_ENOREG;
|
||||||
|
}
|
|
@ -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 fatek ab abb koyo
|
||||||
|
|
||||||
include $(KERNEL_ROOT)/compiler.mk
|
include $(KERNEL_ROOT)/compiler.mk
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
SRC_FILES := ab_l30erm.c ab_micro850.c
|
||||||
|
|
||||||
|
include $(KERNEL_ROOT)/compiler.mk
|
|
@ -0,0 +1,91 @@
|
||||||
|
# AB_850通信测试
|
||||||
|
|
||||||
|
[TOC]
|
||||||
|
|
||||||
|
## 通信接线及参数设置
|
||||||
|
|
||||||
|
* 网口
|
||||||
|
|
||||||
|
*Mosbus TCP协议,IP:192.168.250.56,Port:502
|
||||||
|
|
||||||
|
## 存储区
|
||||||
|
|
||||||
|
- 存储区D区
|
||||||
|
|
||||||
|
## JSON配方设计
|
||||||
|
|
||||||
|
* AB_850类型PLC需要配置控制器映射
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
* 共测试Word和real共2种类型数据,real型数据有2个Word组成,以下为JSON文件解释。
|
||||||
|
|
||||||
|
- ```json
|
||||||
|
{
|
||||||
|
"device_id": 1, //设备ID默认是1,此参数无效
|
||||||
|
"device_name": "AB_850", //设备名称,自定义
|
||||||
|
"communication_type": 0, //通讯协议类型 0是以太网,1是串口
|
||||||
|
"socket_config": { //以太网配置
|
||||||
|
"plc_ip": "192.168.250.56", //PLC的IP地址
|
||||||
|
"local_ip": "192.168.250.233", //矽达通IP地址设定
|
||||||
|
"gateway": "192.168.250.1", //矽达通的网关地址设定
|
||||||
|
"netmask": "255.255.255.0", //矽达通子网掩码设定
|
||||||
|
"port":502 //端口号设定
|
||||||
|
},
|
||||||
|
"protocol_type": 2, //通讯协议,2代表modbus-tcp协议
|
||||||
|
"read_period": 100, //交互周期ms
|
||||||
|
"read_item_list": [
|
||||||
|
{
|
||||||
|
"value_name": "CON_DATA[0]", //变量名称,自定义
|
||||||
|
"value_type": 1, //变量类型,BOOL = 1,INT8 = 2,INT16,INT32,UINT8,UINT16,UINT32,DOUBLE,FLOAT = 9
|
||||||
|
"function_code": 1, //功能码。1是读线圈
|
||||||
|
"start_address": 0, //起始地址
|
||||||
|
"data_length": 1 //默认是1,代表读取1个数据类型长度
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value_name": "CON_DATA[1]", //变量名称,自定义
|
||||||
|
"value_type": 1, //变量类型,BOOL = 1,INT8 = 2,INT16,INT32,UINT8,UINT16,UINT32,DOUBLE,FLOAT = 9
|
||||||
|
"function_code": 1, //功能码。1是读
|
||||||
|
"start_address": 1, //起始地址偏移1位106*8+1=849
|
||||||
|
"data_length": 1 //默认是1,代表读取1个数据类型长度
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value_name": "CON_INT", //变量名称,自定义
|
||||||
|
"value_type": 3, //变量类型,BOOL = 1,INT8 = 2,INT16,INT32,UINT8,UINT16,UINT32,DOUBLE,FLOAT = 9
|
||||||
|
"function_code": 3, //功能码。3是读
|
||||||
|
"start_address": 2, //起始地址偏移2位
|
||||||
|
"data_length": 1 //默认是1,代表读取1个数据类型长度
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value_name": "CON_ARRAY[0]_1", //变量名称,自定义
|
||||||
|
"value_type": 3, //变量类型,BOOL = 1,INT8 = 2,INT16,INT32,UINT8,UINT16,UINT32,DOUBLE,FLOAT = 9
|
||||||
|
"function_code": 3, //功能码。3是读
|
||||||
|
"start_address": 3, //起始地址偏移3位
|
||||||
|
"data_length": 1 //默认是1,代表读取1个数据类型长度
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value_name": "CON_ARRAY[0]_2", //变量名称,自定义,CON_ARRAY[0]_1和CON_ARRAY[0]_2组成real型数据
|
||||||
|
"value_type": 3, //变量类型,BOOL = 1,INT8 = 2,INT16,INT32,UINT8,UINT16,UINT32,DOUBLE,FLOAT = 9
|
||||||
|
"function_code": 3, //功能码。3是读
|
||||||
|
"start_address": 4, //起始地址偏移4位
|
||||||
|
"data_length": 1 //默认是1,代表读取1个数据类型长度
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## 通信测试
|
||||||
|
|
||||||
|
(1) 新增1个通信demo,命名为ab_micro850.c;
|
||||||
|
|
||||||
|
(2) 复制modbus_tcp样例代码程序到ab_micro850.c文件中;
|
||||||
|
|
||||||
|
(3) void **ControlAB850Test**(void) 更改函数名;
|
||||||
|
|
||||||
|
(4) PRIV_SHELL_CMD_FUNCTION(**ControlAB850Test**, AB Plc micro850 Demo**, PRIV_SHELL_CMD_MAIN_ATTR);更改测试指令;
|
||||||
|
|
||||||
|
(5) 剪裁配置完成后,用过烧写器下载至矽数通中,重启后完成测试。
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,71 @@
|
||||||
|
# AB_L30ERM通信测试
|
||||||
|
|
||||||
|
[TOC]
|
||||||
|
|
||||||
|
## 通信接线及参数设置
|
||||||
|
|
||||||
|
* 网口
|
||||||
|
|
||||||
|
*Ethernet/ip协议,IP:192.168.250.57,Port:44818
|
||||||
|
|
||||||
|
## 存储区
|
||||||
|
|
||||||
|
- Ethernet/ip协议是根据变量名称搜索寄存器地址
|
||||||
|
|
||||||
|
## JSON配方设计
|
||||||
|
|
||||||
|
* 本实例共测试Word和real共2种类型数据,以下为JSON文件解释。
|
||||||
|
|
||||||
|
- ```json
|
||||||
|
{
|
||||||
|
"device_id": “ab_l30”, //
|
||||||
|
"device_name": "robot", //设备名称,自定义
|
||||||
|
"communication_type": 0, //通讯协议类型 0是以太网,1是串口
|
||||||
|
"socket_config": { //以太网配置
|
||||||
|
"plc_ip": "192.168.250.37", //PLC的IP地址
|
||||||
|
"local_ip": "192.168.250.123", //矽达通IP地址设定
|
||||||
|
"gateway": "192.168.250.1", //矽达通的网关地址设定
|
||||||
|
"netmask": "255.255.255.0", //矽达通子网掩码设定
|
||||||
|
"port":502 //端口号设定
|
||||||
|
},
|
||||||
|
"protocol_type": 12, //通讯协议,12代表ethernet/ip协议
|
||||||
|
"read_period": 100, //交互周期ms
|
||||||
|
"read_item_list": [
|
||||||
|
{
|
||||||
|
"value_name": "L30_SPEED", //变量名称,自定义
|
||||||
|
"value_type": 3, //变量类型,BOOL = 1,INT8 = 2,INT16,INT32,UINT8,UINT16,UINT32,DOUBLE,FLOAT = 9
|
||||||
|
"wordlen": "WORD", //以WORD方式传输
|
||||||
|
"amount": 1 //默认是1,代表读取1个数据类型长度
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value_name": "L30_TORQUE", //变量名称,自定义
|
||||||
|
"value_type": 9, //变量类型,BOOL = 1,INT8 = 2,INT16,INT32,UINT8,UINT16,UINT32,DOUBLE,FLOAT = 9
|
||||||
|
"wordlen": 2, //以WORD方式传输
|
||||||
|
"amount": 1 //默认是1,代表读取1个数据类型长度
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value_name": "D", //变量名称,自定义
|
||||||
|
"value_type": 3, //变量类型,BOOL = 1,INT8 = 2,INT16,INT32,UINT8,UINT16,UINT32,DOUBLE,FLOAT = 9
|
||||||
|
"wordlen": 3, //以WORD方式传输
|
||||||
|
"amount": 1 //默认是1,代表读取1个数据类型长度
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## 通信测试
|
||||||
|
|
||||||
|
(1) 新增1个通信demo,命名为ab_l30erm.c;
|
||||||
|
|
||||||
|
(2) 复制modbus_tcp样例代码程序到ab_l30erm.c文件中;
|
||||||
|
|
||||||
|
(3) void **ControlABL30Test**(void) 更改函数名;
|
||||||
|
|
||||||
|
(4) PRIV_SHELL_CMD_FUNCTION(**ControlABL30Test**, AB Plc l30ermDemo**, PRIV_SHELL_CMD_MAIN_ATTR);更改测试指令;
|
||||||
|
|
||||||
|
(5) 剪裁配置完成后,用过烧写器下载至矽数通中,重启后完成测试。
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
/*
|
||||||
|
* 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 ab_l30.c
|
||||||
|
* @brief PLC ABB L30 app
|
||||||
|
* @version 3.0
|
||||||
|
* @author AIIT XUOS Lab
|
||||||
|
* @date 2023.8.27
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <control.h>
|
||||||
|
|
||||||
|
void ControlABL30Test(void)
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
uint16_t read_data_length = 0;
|
||||||
|
uint8_t read_data[1024] = {0};
|
||||||
|
ControlProtocolType CIP_protocol = ControlProtocolFind();
|
||||||
|
if (NULL == CIP_protocol) {
|
||||||
|
printf("%s get CIP protocol %p failed\n", __func__, CIP_protocol);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("%s get CIP protocol %p successfull\n", __func__, CIP_protocol);
|
||||||
|
if (CONTROL_REGISTERED == CIP_protocol->protocol_status) {
|
||||||
|
ControlProtocolOpen(CIP_protocol);
|
||||||
|
|
||||||
|
for (;;) {
|
||||||
|
read_data_length = ControlProtocolRead(CIP_protocol, read_data, sizeof(read_data));
|
||||||
|
printf("%s read [%d] CIP data %d using receipe file\n", __func__, i, read_data_length);
|
||||||
|
i++;
|
||||||
|
PrivTaskDelay(1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
//ControlProtocolClose(CIP_protocol);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
PRIV_SHELL_CMD_FUNCTION(ControlABL30Test, Ab Plc CIP Demo, PRIV_SHELL_CMD_MAIN_ATTR);
|
|
@ -0,0 +1,52 @@
|
||||||
|
/*
|
||||||
|
* 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 ab_micro850.c
|
||||||
|
* @brief PLC AB MICRO850 app
|
||||||
|
* @version 3.0
|
||||||
|
* @author AIIT XUOS Lab
|
||||||
|
* @date 2023.10.5
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <control.h>
|
||||||
|
|
||||||
|
void ControlAB850Test(void)
|
||||||
|
{
|
||||||
|
int i, j = 0;
|
||||||
|
int read_data_length = 0;
|
||||||
|
uint8_t read_data[128] = {0};
|
||||||
|
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(ControlAB850Test, AB Plc MICRO850 Demo, PRIV_SHELL_CMD_MAIN_ATTR);
|
After Width: | Height: | Size: 2.3 MiB |
After Width: | Height: | Size: 2.6 MiB |
After Width: | Height: | Size: 14 KiB |
|
@ -0,0 +1,34 @@
|
||||||
|
{
|
||||||
|
"device_id": "ab_l30",
|
||||||
|
"device_name": "robot",
|
||||||
|
"communication_type": 0,
|
||||||
|
"socket_config": {
|
||||||
|
"plc_ip": "192.168.250.57",
|
||||||
|
"local_ip": "192.168.250.123",
|
||||||
|
"gateway": "192.168.250.1",
|
||||||
|
"netmask": "255.255.255.0",
|
||||||
|
"port": 44818
|
||||||
|
},
|
||||||
|
"protocol_type": 12,
|
||||||
|
"read_period": 100,
|
||||||
|
"read_item_list": [
|
||||||
|
{
|
||||||
|
"value_name": "L30_SPEED",
|
||||||
|
"value_type": 3,
|
||||||
|
"wordlen": "WORD",
|
||||||
|
"amount": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value_name": "L30_TORQUE",
|
||||||
|
"value_type": 9,
|
||||||
|
"wordlen": "WORD",
|
||||||
|
"amount": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value_name": "D",
|
||||||
|
"value_type": 3,
|
||||||
|
"wordlen": "WORD",
|
||||||
|
"amount": 1
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,51 @@
|
||||||
|
{
|
||||||
|
"device_id": 1,
|
||||||
|
"device_name": "AB_850",
|
||||||
|
"communication_type": 0,
|
||||||
|
"socket_config": {
|
||||||
|
"plc_ip": "192.168.250.32",
|
||||||
|
"local_ip": "192.168.250.56",
|
||||||
|
"gateway": "192.168.250.1",
|
||||||
|
"netmask": "255.255.255.0",
|
||||||
|
"port": 502
|
||||||
|
},
|
||||||
|
"protocol_type": 2,
|
||||||
|
"read_period": 100,
|
||||||
|
"read_item_list": [
|
||||||
|
{
|
||||||
|
"value_name": "D106.0",
|
||||||
|
"value_type": 1,
|
||||||
|
"function_code": 1,
|
||||||
|
"start_address": 848,
|
||||||
|
"quantity": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value_name": "D106.1",
|
||||||
|
"value_type": 1,
|
||||||
|
"function_code": 1,
|
||||||
|
"start_address":849,
|
||||||
|
"quantity": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value_name": "D100",
|
||||||
|
"value_type": 3,
|
||||||
|
"function_code": 3,
|
||||||
|
"start_address": 100,
|
||||||
|
"quantity": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value_name": "D102",
|
||||||
|
"value_type": 3,
|
||||||
|
"function_code": 3,
|
||||||
|
"start_address": 102,
|
||||||
|
"quantity": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value_name": "D103",
|
||||||
|
"value_type": 3,
|
||||||
|
"function_code": 3,
|
||||||
|
"start_address": 103,
|
||||||
|
"quantity": 1
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
SRC_FILES := abb_pm5630.c
|
||||||
|
|
||||||
|
include $(KERNEL_ROOT)/compiler.mk
|
|
@ -0,0 +1,87 @@
|
||||||
|
# ABB通信测试
|
||||||
|
|
||||||
|
[TOC]
|
||||||
|
|
||||||
|
## 通信接线及参数设置
|
||||||
|
|
||||||
|
* 网口
|
||||||
|
|
||||||
|
*Mosbus TCP协议,IP:192.168.250.58,Port:502
|
||||||
|
|
||||||
|
## 存储区
|
||||||
|
|
||||||
|
- 存储区MW区
|
||||||
|
|
||||||
|
## JSON配方设计
|
||||||
|
|
||||||
|
* 共测试Word和real共2种类型数据,real型数据有2个Word组成,以下为JSON文件解释。
|
||||||
|
|
||||||
|
- ```json
|
||||||
|
{
|
||||||
|
"device_id": 1, //设备ID默认是1,此参数无效
|
||||||
|
"device_name": "ABB_PM5630", //设备名称,自定义
|
||||||
|
"communication_type": 0, //通讯协议类型 0是以太网,1是串口
|
||||||
|
"socket_config": { //以太网配置
|
||||||
|
"plc_ip": "192.168.250.58", //PLC的IP地址
|
||||||
|
"local_ip": "192.168.250.233", //矽达通IP地址设定
|
||||||
|
"gateway": "192.168.250.1", //矽达通的网关地址设定
|
||||||
|
"netmask": "255.255.255.0", //矽达通子网掩码设定
|
||||||
|
"port":502 //端口号设定
|
||||||
|
},
|
||||||
|
"protocol_type": 2, //通讯协议,2代表modbus-tcp协议
|
||||||
|
"read_period": 100, //交互周期ms
|
||||||
|
"read_item_list": [
|
||||||
|
{
|
||||||
|
"value_name": "MW0", //变量名称,自定义
|
||||||
|
"value_type": 3, //变量类型,BOOL = 1,INT8 = 2,INT16,INT32,UINT8,UINT16,UINT32,DOUBLE,FLOAT = 9
|
||||||
|
"function_code": 3, //功能码。3是读
|
||||||
|
"start_address": 0, //起始地址
|
||||||
|
"data_length": 1 //默认是1,代表读取1个数据类型长度
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value_name": "MW1", //变量名称,自定义
|
||||||
|
"value_type": 3, //变量类型,BOOL = 1,INT8 = 2,INT16,INT32,UINT8,UINT16,UINT32,DOUBLE,FLOAT = 9
|
||||||
|
"function_code": 3, //功能码。3是读
|
||||||
|
"start_address": 1, //起始地址偏移1位
|
||||||
|
"data_length": 1 //默认是1,代表读取1个数据类型长度
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value_name": "MW10", //变量名称,自定义
|
||||||
|
"value_type": 3, //变量类型,BOOL = 1,INT8 = 2,INT16,INT32,UINT8,UINT16,UINT32,DOUBLE,FLOAT = 9
|
||||||
|
"function_code": 3, //功能码。3是读
|
||||||
|
"start_address": 10, //起始地址偏移10位
|
||||||
|
"data_length": 1 //默认是1,代表读取1个数据类型长度
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value_name": "MD20_1", //变量名称,自定义
|
||||||
|
"value_type": 3, //变量类型,BOOL = 1,INT8 = 2,INT16,INT32,UINT8,UINT16,UINT32,DOUBLE,FLOAT = 9
|
||||||
|
"function_code": 3, //功能码。3是读
|
||||||
|
"start_address": 20, //起始地址偏移20位
|
||||||
|
"data_length": 1 //默认是1,代表读取1个数据类型长度
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value_name": "MD20_2", //变量名称,自定义,MD20_1和MD20_2组成real型数据
|
||||||
|
"value_type": 3, //变量类型,BOOL = 1,INT8 = 2,INT16,INT32,UINT8,UINT16,UINT32,DOUBLE,FLOAT = 9
|
||||||
|
"function_code": 3, //功能码。3是读
|
||||||
|
"start_address": 21, //起始地址偏移21位
|
||||||
|
"data_length": 1 //默认是1,代表读取1个数据类型长度
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## 通信测试
|
||||||
|
|
||||||
|
(1) 新增1个通信demo,命名为abb_pm5630.c;
|
||||||
|
|
||||||
|
(2) 复制modbus_tcp样例代码程序到abb_pm5630.c文件中;
|
||||||
|
|
||||||
|
(3) void **ControlABBPM5630Test**(void) 更改函数名;
|
||||||
|
|
||||||
|
(4) PRIV_SHELL_CMD_FUNCTION(**ControlABBPM5630Test**, ABB Plc PM5630 Demo**, PRIV_SHELL_CMD_MAIN_ATTR);更改测试指令;
|
||||||
|
|
||||||
|
(5) 剪裁配置完成后,用过烧写器下载至矽数通中,重启后完成测试。
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,52 @@
|
||||||
|
/*
|
||||||
|
* 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 abb_pm5630.c
|
||||||
|
* @brief PLC ABB pm5630 app
|
||||||
|
* @version 3.0
|
||||||
|
* @author AIIT XUOS Lab
|
||||||
|
* @date 2023.10.20
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <control.h>
|
||||||
|
|
||||||
|
void ControlABBPM5630Test(void)
|
||||||
|
{
|
||||||
|
int i, j = 0;
|
||||||
|
int read_data_length = 0;
|
||||||
|
uint8_t read_data[128] = {0};
|
||||||
|
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(ControlABBPM5630Test, ABB Plc PM5630 Demo, PRIV_SHELL_CMD_MAIN_ATTR);
|
After Width: | Height: | Size: 2.7 MiB |
|
@ -0,0 +1,51 @@
|
||||||
|
{
|
||||||
|
"device_id": 1,
|
||||||
|
"device_name": "ABB_PM5630",
|
||||||
|
"communication_type": 0,
|
||||||
|
"socket_config": {
|
||||||
|
"plc_ip": "192.168.250.32",
|
||||||
|
"local_ip": "192.168.250.58",
|
||||||
|
"gateway": "192.168.250.1",
|
||||||
|
"netmask": "255.255.255.0",
|
||||||
|
"port": 502
|
||||||
|
},
|
||||||
|
"protocol_type": 2,
|
||||||
|
"read_period": 100,
|
||||||
|
"read_item_list": [
|
||||||
|
{
|
||||||
|
"value_name": "MW0",
|
||||||
|
"value_type": 3,
|
||||||
|
"function_code": 3,
|
||||||
|
"start_address": 0,
|
||||||
|
"quantity": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value_name": "MW1",
|
||||||
|
"value_type": 3,
|
||||||
|
"function_code": 3,
|
||||||
|
"start_address":1,
|
||||||
|
"quantity": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value_name": "MW10",
|
||||||
|
"value_type": 3,
|
||||||
|
"function_code": 3,
|
||||||
|
"start_address": 10,
|
||||||
|
"quantity": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value_name": "MD20_1",
|
||||||
|
"value_type": 3,
|
||||||
|
"function_code": 3,
|
||||||
|
"start_address":20,
|
||||||
|
"quantity": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value_name": "MD20_2",
|
||||||
|
"value_type": 3,
|
||||||
|
"function_code": 3,
|
||||||
|
"start_address":21,
|
||||||
|
"quantity": 1
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
After Width: | Height: | Size: 3.0 MiB |
|
@ -1,22 +1,48 @@
|
||||||
# 台达 DVP通信测试
|
# 台达 PLC与矽达通ARM通信测试
|
||||||
|
|
||||||
[TOC]
|
[TOC]
|
||||||
|
|
||||||
## 通信接线及参数设置
|
## 台达DVP与矽达通ARM通信处测试
|
||||||
|
|
||||||
|
### 通信接线及参数设置
|
||||||
|
|
||||||
* 网口
|
* 网口
|
||||||
* 通过自带 RJ45 网口连接
|
* 通过自带 RJ45 网口连接
|
||||||
* 网口参数:IP:192.168.250.27 Port:502
|
* 网口参数:IP:192.168.250.27 Port:502
|
||||||
* 测试的协议:Modbus TCP
|
* 测试的协议:Modbus TCP
|
||||||
|
|
||||||
## 存储区
|
### 存储区
|
||||||
|
|
||||||
- 含M,D,X,Y。台达PLC中 各存储区地址和Modbus地址有明确的对应表,详见台达DVP协议解析测试文档。
|
- 含M,D,X,Y。台达PLC中 各存储区地址和Modbus地址有明确的对应表,详见台达DVP协议解析测试文档。
|
||||||
|
|
||||||
## 通信测试
|
### 通信测试
|
||||||
|
|
||||||
- 共测试BOOL,INT16,INT32,FLOAT 共四种类型数据。
|
- 共测试BOOL,INT16,INT32,FLOAT 共四种类型数据。
|
||||||
- 测试D区,M区和Y区。
|
- 测试D区,M区和Y区。
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## 台达AS332T与矽达通ARM通信处测试
|
||||||
|
|
||||||
|
### 通信接线及参数设置
|
||||||
|
|
||||||
|
* 网口
|
||||||
|
* 通过自带 RJ45 网口连接
|
||||||
|
* 网口参数:IP:192.168.250.5 Port:502
|
||||||
|
* 测试的协议:Modbus TCP
|
||||||
|
|
||||||
|
### 存储区
|
||||||
|
|
||||||
|
- 含M,D,X,Y。台达PLC中 各存储区地址和Modbus地址有明确的对应表,详见台达AS332T协议解析测试文档。
|
||||||
|
|
||||||
|
### 通信测试结果
|
||||||
|
|
||||||
|
- 共测试BOOL,INT16,INT32,FLOAT 共四种类型数据。
|
||||||
|
- 测试D区,M区和Y区。
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2022 AIIT XUOS Lab
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2022 AIIT XUOS Lab
|
* Copyright (c) 2022 AIIT XUOS Lab
|
||||||
* XiUOS is licensed under Mulan PSL v2.
|
* XiUOS is licensed under Mulan PSL v2.
|
||||||
|
@ -15,9 +17,53 @@
|
||||||
* @brief PLC DELTA AS332T app
|
* @brief PLC DELTA AS332T app
|
||||||
* @version 3.0
|
* @version 3.0
|
||||||
* @author AIIT XUOS Lab
|
* @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);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
After Width: | Height: | Size: 123 KiB |
After Width: | Height: | Size: 171 KiB |
After Width: | Height: | Size: 6.8 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 14 KiB |
|
@ -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
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
SRC_FILES := fatek_fbs_24mc_uart.c
|
||||||
|
|
||||||
|
include $(KERNEL_ROOT)/compiler.mk
|
|
@ -0,0 +1,42 @@
|
||||||
|
# 永宏通信测试
|
||||||
|
|
||||||
|
[TOC]
|
||||||
|
|
||||||
|
## 永宏FBs-24MCT2-AC通信测试
|
||||||
|
|
||||||
|
### 通信接线及参数设置
|
||||||
|
|
||||||
|
* 网口和串口
|
||||||
|
* FBS-24MCT2自带圆口232,用于程序的下载。
|
||||||
|
* 可本体拓展FBs-CBES用于Modbus TCP,永宏私有协议永宏协议等通信。板卡默认IP:192.168.2.3.端口号500,永宏协议
|
||||||
|
* 通过本体拓展FBs-CM22通信模板,可用于Modbus RTU及永宏协议通信。串口接线:+接485A;-接485B。
|
||||||
|
* 串口模块MODBUS RTU通信参数配置:通信速率:9600;数据位:8bit;停止位:1bit;校验:偶校验
|
||||||
|
* 串口模块永宏协议通信参数配置:通信速率:9600;数据位:8bit;停止位:1bit;校验:偶校验
|
||||||
|
* 终端与PLC通信测试,PC编程软件与PLC不能处于联机状态。
|
||||||
|
|
||||||
|
|
||||||
|
### 存储区
|
||||||
|
|
||||||
|
- 存储区 X,Y,R,D区等。
|
||||||
|
|
||||||
|
### 通信测试
|
||||||
|
|
||||||
|
- 共测试BOOL,INT16等类型数据。
|
||||||
|
|
||||||
|
|
||||||
|
- 测试Y区,R区及D区数据。
|
||||||
|
|
||||||
|
|
||||||
|
- 测试截图:
|
||||||
|
|
||||||
|
测试PLC环境搭建:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
解析完成的配方为:
|
||||||
|
|
||||||
|

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

|
|
@ -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);
|
||||||
|
|
||||||
|
|
After Width: | Height: | Size: 172 KiB |
|
@ -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
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
After Width: | Height: | Size: 2.1 MiB |
After Width: | Height: | Size: 3.1 MiB |
|
@ -1,3 +1,3 @@
|
||||||
SRC_FILES := inovance_am401_cpu1608tn_ethernet.c inovance_am401_cpu1608tn_uart.c
|
SRC_FILES := inovance_am401_cpu1608tn_ethernet.c inovance_am401_cpu1608tn_uart.c inovance_H3U_cpu3232MT_ethernet.c
|
||||||
|
|
||||||
include $(KERNEL_ROOT)/compiler.mk
|
include $(KERNEL_ROOT)/compiler.mk
|
After Width: | Height: | Size: 200 KiB |
|
@ -0,0 +1,52 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2024 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 inovance_H3U_cpu3232MT_ethernet.c
|
||||||
|
* @brief PLC Inovance H3U-3232MT app
|
||||||
|
* @version 3.0
|
||||||
|
* @author AIIT XUOS Lab
|
||||||
|
* @date 2024.08.06
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <control.h>
|
||||||
|
|
||||||
|
void ControlInovanceH3UCPU3232MTTest(void)
|
||||||
|
{
|
||||||
|
int i, j = 0;
|
||||||
|
int read_data_length = 0;
|
||||||
|
uint8_t read_data[128] = {0};
|
||||||
|
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(ControlInovanceH3UCPU3232MTTest, Inovance PLC N3UCPU3232MT Demo, PRIV_SHELL_CMD_MAIN_ATTR);
|
|
@ -0,0 +1,30 @@
|
||||||
|
{
|
||||||
|
"device_id": 1,
|
||||||
|
"device_name": "Ino_H3U3232MT",
|
||||||
|
"communication_type": 0,
|
||||||
|
"socket_config": {
|
||||||
|
"plc_ip": "192.168.250.55",
|
||||||
|
"local_ip": "192.168.250.147",
|
||||||
|
"gateway": "192.168.250.252",
|
||||||
|
"netmask": "255.255.255.0",
|
||||||
|
"port": 502
|
||||||
|
},
|
||||||
|
"protocol_type": 2,
|
||||||
|
"read_period": 300,
|
||||||
|
"read_item_list": [
|
||||||
|
{
|
||||||
|
"value_name": "M8000",
|
||||||
|
"value_type": 1,
|
||||||
|
"function_code": 1,
|
||||||
|
"start_address": 8000,
|
||||||
|
"quantity": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value_name": "D120",
|
||||||
|
"value_type": 3,
|
||||||
|
"function_code": 3,
|
||||||
|
"start_address": 120,
|
||||||
|
"quantity": 1
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
SRC_FILES := koyo_nk1cpu40.c
|
||||||
|
|
||||||
|
include $(KERNEL_ROOT)/compiler.mk
|
After Width: | Height: | Size: 1.7 MiB |
|
@ -0,0 +1,52 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2024 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 koyo_nk1cpu40.c
|
||||||
|
* @brief PLC AB MICRO850 app
|
||||||
|
* @version 3.0
|
||||||
|
* @author AIIT XUOS Lab
|
||||||
|
* @date 2024.07.03
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <control.h>
|
||||||
|
|
||||||
|
void ControlKoyoNK1CPU40Test(void)
|
||||||
|
{
|
||||||
|
int i, j = 0;
|
||||||
|
int read_data_length = 0;
|
||||||
|
uint8_t read_data[128] = {0};
|
||||||
|
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(ControlKoyoNK1CPU40Test, Koyo Plc NK1CPU40 Demo, PRIV_SHELL_CMD_MAIN_ATTR);
|
|
@ -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
|
include $(KERNEL_ROOT)/compiler.mk
|
||||||
|
|
|
@ -1,24 +1,88 @@
|
||||||
# 三菱 FX2N通信测试
|
# 三菱通信测试
|
||||||
|
|
||||||
[TOC]
|
[TOC]
|
||||||
|
|
||||||
## 通信接线及参数设置
|
## 三菱FX2N通信测试
|
||||||
|
|
||||||
|
### 通信接线及参数设置
|
||||||
|
|
||||||
* 串口
|
* 串口
|
||||||
* FX2N自带8针圆口422,用于程序的下载。全系列不支持网口,且需购买串口拓展模块FX2N-485-BD用于通信测试。
|
* FX2N自带8针圆口422,用于程序的下载。全系列不支持网口,且需购买串口拓展模块FX2N-485-BD用于通信测试。
|
||||||
* 接线:RDA和SDA短接,引出A;RDB与SDB短接,引出B。
|
* 接线:RDA和SDA短接,引出A;RDB与SDB短接,引出B。
|
||||||
* 串口模块支持MC-1C协议,通信速率:9600;数据位:7bit;停止位:1bit;校验:偶校验
|
* 串口模块支持MC-1C协议,通信速率:9600;数据位:7bit;停止位:1bit;校验:偶校验
|
||||||
|
|
||||||
## 存储区
|
### 存储区
|
||||||
|
|
||||||
- 存储区 I,Q,M,D区。
|
- 存储区 I,Q,M,D区。
|
||||||
|
|
||||||
## 通信测试
|
### 通信测试
|
||||||
|
|
||||||
- 共测试BOOL,INT16,FLOAT共三种类型数据。
|
- 共测试BOOL,INT16,FLOAT共三种类型数据。
|
||||||
|
|
||||||
|
|
||||||
- 测试M区及D区数据。
|
- 测试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区数据。
|
||||||
|
|
||||||
|
- 测试截图:
|
||||||
|
|
||||||
|
解析完成的配方为
|
||||||
|
|
||||||
|

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

|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## 三菱Q03UDV通信测试
|
||||||
|
|
||||||
|
### 通信接线及参数设置
|
||||||
|
|
||||||
|
* 接口
|
||||||
|
* 本次测试通过Q03UDV拓展的模块QJ71E71_100模块的网口模块进行MC—3E通信测试。网口模块IP:192.168.250.21 端口号:4000
|
||||||
|
* 本次测试还可通过Q03UDV自身网口进行MC—3E通信测试。网口模块IP:192.168.250.22 端口号:6000
|
||||||
|
|
||||||
|
### 存储区
|
||||||
|
|
||||||
|
- 存储区 I,Q,M,D区。
|
||||||
|
|
||||||
|
### 通信测试
|
||||||
|
|
||||||
|
- 共测试BOOL,INT16,FLOAT共三种类型数据。
|
||||||
|
|
||||||
|
|
||||||
|
- 测试M区及D区数据。
|
||||||
|
|
||||||
|
- 测试截图:
|
||||||
|
|
||||||
|
扩展模块解析完成的配方为
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
CPU自带网口解析完成的配方为
|
||||||
|
|
||||||
|

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

|
||||||
|
|
After Width: | Height: | Size: 2.8 MiB |
After Width: | Height: | Size: 1.4 MiB |
After Width: | Height: | Size: 158 KiB |
After Width: | Height: | Size: 164 KiB |
After Width: | Height: | Size: 6.9 KiB |
After Width: | Height: | Size: 156 KiB |
After Width: | Height: | Size: 5.6 KiB |
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 6.8 KiB |
|
@ -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
|
||||||
|
}
|
||||||
|
|
||||||
|
]
|
||||||
|
}
|
|
@ -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
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -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_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);
|
||||||
|
|
||||||
|
|
|
@ -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);
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -18,6 +18,34 @@
|
||||||
* @date 2022.9.27
|
* @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);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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环境搭建:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
解析完成的配方为:
|
||||||
|
|
||||||
|

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

|
After Width: | Height: | Size: 200 KiB |
After Width: | Height: | Size: 182 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 6.4 KiB |
|
@ -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
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -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
|
||||||
|
}
|
||||||
|
|
||||||
|
]
|
||||||
|
}
|
|
@ -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);
|
||||||
|
|
||||||
|
|
|
@ -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
|
include $(KERNEL_ROOT)/compiler.mk
|
||||||
|
|
|
@ -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
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -18,3 +18,28 @@
|
||||||
* @date 2023.3.27
|
* @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);
|
|
@ -22,9 +22,13 @@ extern void ApplicationOtaTaskInit(void);
|
||||||
extern int OtaTask(void);
|
extern int OtaTask(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef APPLICATION_WEBSERVER
|
||||||
|
extern int webserver(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
printf("Hello, world! \n");
|
printf("\nHello, world!\n");
|
||||||
FrameworkInit();
|
FrameworkInit();
|
||||||
#ifdef APPLICATION_OTA
|
#ifdef APPLICATION_OTA
|
||||||
ApplicationOtaTaskInit();
|
ApplicationOtaTaskInit();
|
||||||
|
@ -33,6 +37,11 @@ int main(void)
|
||||||
#ifdef OTA_BY_PLATFORM
|
#ifdef OTA_BY_PLATFORM
|
||||||
OtaTask();
|
OtaTask();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef APPLICATION_WEBSERVER
|
||||||
|
webserver();
|
||||||
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
// int cppmain(void);
|
// int cppmain(void);
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
menu "ota app "
|
|
||||||
menuconfig APPLICATION_OTA
|
|
||||||
bool "Using app bin ota"
|
|
||||||
default n
|
|
||||||
|
|
||||||
|
|
||||||
endmenu
|
|