diff --git a/APP_Framework/Applications/control_app/plc_demo/omron/omron_cp1l.c b/APP_Framework/Applications/control_app/plc_demo/omron/omron_cp1l.c index 08c4366f6..814af8f3b 100644 --- a/APP_Framework/Applications/control_app/plc_demo/omron/omron_cp1l.c +++ b/APP_Framework/Applications/control_app/plc_demo/omron/omron_cp1l.c @@ -11,9 +11,38 @@ */ /** - * @file omron_cj2m.c - * @brief PLC OMRON CJ2M app + * @file omron_.cp1l.c + * @brief PLC OMRON CP1L app * @version 3.0 * @author AIIT XUOS Lab - * @date 2022.9.27 + * @date 2023.2.10 */ +#include + +void ControlOmronCP1LTest(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(ControlOmronCP1LTest, Omron Plc FINS Demo, PRIV_SHELL_CMD_MAIN_ATTR); \ No newline at end of file