diff --git a/APP_Framework/Applications/control_app/plc_demo/siemens/siemens_s7_1500.c b/APP_Framework/Applications/control_app/plc_demo/siemens/siemens_s7_1500.c index 15bd8f1f7..10aa2d722 100644 --- a/APP_Framework/Applications/control_app/plc_demo/siemens/siemens_s7_1500.c +++ b/APP_Framework/Applications/control_app/plc_demo/siemens/siemens_s7_1500.c @@ -18,3 +18,28 @@ * @date 2023.3.27 */ +#include +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); \ No newline at end of file diff --git a/APP_Framework/Applications/control_app/plc_demo/siemens/test_recipe_S7_1512.json b/APP_Framework/Applications/control_app/plc_demo/siemens/test_recipe_S7_1512.json index 08cb7ed04..31df9a200 100644 --- a/APP_Framework/Applications/control_app/plc_demo/siemens/test_recipe_S7_1512.json +++ b/APP_Framework/Applications/control_app/plc_demo/siemens/test_recipe_S7_1512.json @@ -1,6 +1,6 @@ { "device_id": 1, - "device_name": "打包机", + "device_name": "demo", "communication_type": 0, "socket_config": { "plc_ip": "192.168.250.2", diff --git a/APP_Framework/Framework/control/plc_protocol/s7/README.doc b/APP_Framework/Framework/control/plc_protocol/s7/README.doc new file mode 100644 index 000000000..73bff5193 Binary files /dev/null and b/APP_Framework/Framework/control/plc_protocol/s7/README.doc differ