forked from xuos/xiuos
add simens 1200plc test app and json
This commit is contained in:
parent
048796080a
commit
d2ec2ba096
|
@ -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);
|
|
@ -1,20 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2022 AIIT XUOS Lab
|
|
||||||
* XiUOS is licensed under Mulan PSL v2.
|
|
||||||
* You can use this software according to the terms and conditions of the Mulan PSL v2.
|
|
||||||
* You may obtain a copy of Mulan PSL v2 at:
|
|
||||||
* http://license.coscl.org.cn/MulanPSL2
|
|
||||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
|
||||||
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
|
||||||
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
|
||||||
* See the Mulan PSL v2 for more details.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @file siemens_s7_300.c
|
|
||||||
* @brief PLC SIEMENS S7-300 app
|
|
||||||
* @version 3.0
|
|
||||||
* @author AIIT XUOS Lab
|
|
||||||
* @date 2023.3.27
|
|
||||||
*/
|
|
||||||
|
|
Loading…
Reference in New Issue