Open Core Interface - MLPI
MLPI-MotionLogicProgrammingInterface(mlpiCore)  1.26.2
UtilIoHelper
Collaboration diagram for UtilIoHelper:

Typedefs

typedef struct MlpiIoDiagnosisFlagDecoder MlpiIoDiagnosisFlagDecoder
 

Detailed Description

This module contains some useful functions and macros for I/O handling.

Please note that this piece of source code is not directly part of the MLPI. You do not need this file to program against the MLPI. Nevertheless, at least parts of this file have been considered to be somewhat useful when using or learning to use MLPI functionality. It is therefore included without any support, but to act as sample code and source of inspiration.

Typedef Documentation

MlpiIoDiagnosisFlagDecoder

The following struct helps to decode the diagnosis flags of MlpiIoDiagnosis as given by mlpiIoReadFieldbusMasterInfo, mlpiIoReadFieldbusSlaveInfo or mlpiIoReadFieldbusSlaveInfos.

Example:
1 MLPIRESULT result = MLPI_S_OK;
2 MlpiIoFieldbusMasterInfo infoMaster;
3 
4 printf("\nWaiting for boot up of fieldbus, time out after 60 seconds...");
5 for (ULONG t=0; t<60; t++)
6 {
7  memset(&infoMaster, 0, sizeof(infoMaster));
8 
9  result = mlpiIoReadFieldbusMasterInfo(connection, "Profibus_DP_Master", &infoMaster);
10  if(MLPI_FAILED(result))
11  {
12  printf("\nCall of MLPI function failed with 0x%08x!", (unsigned) result);
13  break;
14  }
15  else
16  {
17  MlpiIoDiagnosisFlagDecoder master = infoMaster.diagnosis.flags;
18 
19  if(master._isOkay()) {
20  printf("\nReady!");
21  break;
22  }
23  else {
24  printf(".");
25  sleep(1000);
26  }
27  }
28 }