forked from xuos/xiuos
new a demo named omron_cp1l.c
This commit is contained in:
parent
0ebfda21f7
commit
572cbd201a
|
@ -11,9 +11,38 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file omron_cj2m.c
|
* @file omron_.cp1l.c
|
||||||
* @brief PLC OMRON CJ2M app
|
* @brief PLC OMRON CP1L app
|
||||||
* @version 3.0
|
* @version 3.0
|
||||||
* @author AIIT XUOS Lab
|
* @author AIIT XUOS Lab
|
||||||
* @date 2022.9.27
|
* @date 2023.2.10
|
||||||
*/
|
*/
|
||||||
|
#include <control.h>
|
||||||
|
|
||||||
|
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);
|
Loading…
Reference in New Issue