forked from xuos/xiuos
Add S7 protocol and a S7 App demo
This commit is contained in:
parent
ba7e1a0d3b
commit
94c6631a24
|
@ -18,3 +18,28 @@
|
|||
* @date 2023.3.27
|
||||
*/
|
||||
|
||||
#include <control.h>
|
||||
void ControlS71500Test(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(ControlS71500Test, Siemens Plc S7_1512 Demo, PRIV_SHELL_CMD_MAIN_ATTR);
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"device_id": 1,
|
||||
"device_name": "打包机",
|
||||
"device_name": "demo",
|
||||
"communication_type": 0,
|
||||
"socket_config": {
|
||||
"plc_ip": "192.168.250.2",
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue