ProSoft Technology MVI69-ADM User Manual

Page 317

Advertising
background image

MVI-ADM ♦ 'C' Programmable

Side-Connect API Library Functions

'C' Programmable Application Development Module

Developer's Guide

ProSoft Technology, Inc.

Page 317 of 342

February 20, 2013

MVIsc_PLCMsgWait

Syntax

int MVIsc_PLCMsgWait(HANDLE handle, BYTE msgnum, BYTE msgtype, WORD timeout);

Parameters

handle Handle

returned by previous call to MVIsc_Open

msgnum

PLC-5 message number (0 to 31)

msgtype

Message type (read or write)

timeout

Maximum number of milliseconds to wait for message instruction

Description
MVIsc_PLCMsgWait returns the current status of the message handler specified
by msgnum.

handle must be a valid handle returned from MVIsc_Open. msgtype must be set
to MVISC_MSGTYP_READ to specify a read message, or
MVISC_MSGTYP_WRITE to specify a write message. If timeout is set to zero,
the current status of the specified message handler is returned immediately. If
timeout is not zero, the function will return when the message instruction has
been completed, or when timeout milliseconds have expired.

Return Value

MVISC_SUCCESS

The message-read or message-write instruction has completed
successfully.

MVISC_ERR_NOACCESS

handle does not have access

MVISC_ERR_BADPARAM

No message handler has been registered for msgnum.

MVISC_ERR_PLCTIMEOUT

The timeout expired before the message instruction occurred.

MVISC_ERR_PENDING

The message instruction has not yet occurred (Note: This result
code is only returned if timeout is set to zero).

Example

HANDLE Handle;
/* Wait here until message handler 1 has completed, timeout=10 seconds */
rc = MVIsc_PLCMsgWait(Handle, 1, MVISC_MSGTYP_READ, 10000);
if (rc != MVISC_SUCCESS)
printf("ERROR: MVIsc_PLCMsgWait failed");

Advertising