Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

 

mst_PowerControl (IO-Link device power supply control)

Function

int16 mst_PowerControl(uint16 uiPortNo, uchar08 ucSwitch, char08 *cpErrMsg);

Description

Connected IO-Link device power supply control.

Input Parameters

  • uchar08 uiPortNo – (virtual) comport number to disconnect obtained previously from mst_Connect or mst_EthernetConnect functions
  • uchar08 ucSwitch – on/off power supply switch flag (0 - off / disable, 1 - on / enable)

Output Parameters

  • char08 *cpErrMsg – pointer to buffer to return error message (minimum 256 bytes)

Return value

ERR_NONE or negative error number.

Example

// switch off power supply
mst_PowerControl(iPortNo, 0 /* off */, cpErrMsg);
// switch on power supply
mst_PowerControl(iPortNo, 01 /* on */, cpErrMsg);

mst_GetStatus (get status of iqInterface and PD input in master mode)

Function

int16 mst_GetStatus(uint16 uiPortNo, uchar08 *pStatus, uchar08 *ucpPDInBuf, uint16 uiPDInBufSize, char08 *cpErrMsg);

Description

You can read master status with a current IO-Link state, process data input from IO-Link device and its validity using mst_GetStatus function with a pointer to master status variable and process data input buffer. You can use a bit field of type mst_StatusT (see example) to extract current IO-Link communication state, process data input validity (0 – valid, 1 - invalid) and whether a new event has come from device (0 – no events, 1 – new event). If a new event has come you can read it using mst_ReadEvent function.

Input Parameters

  • uchar08 uiPortNo – (virtual) comport number to disconnect obtained previously from mst_Connect or mst_EthernetConnect functions
  • uint16 uiPDInBufSize – size of process data input buffer ucpPDInBuf(32 bytes length is recommended)

Output Parameters

  • uchar08 *pStatus – pointer to variable where to return a status byte, it can be decoded using mst_StatusT data type (see example)
  • uchar08 *ucpPDInBuf – process data input sent by IO-Link device
  • char08 *cpErrMsg – pointer to buffer to return error message (minimum 256 bytes)

Return value

Actual size of process data input written to ucpPDInBuf or negative error number.

Example

uchar08 pdIn[32];
mst_StatusT status;
uchar08 pdInValidity;
uchar08 isNewEvent;
mst_GetStatus(iPortNo, (uchar08*)(&status), pdIn, 32, cpErrMsg);
state = (mst_StateT)(status.State);
pdInValidity = status.PDInInvalid; // 0 – valid, 1 – invalid
isNewEvent = status.Event; // 0 – no events, 1 – new event

...