Backplane api synchronization functions – ProSoft Technology MVI69-ADM User Manual

Page 210

Advertising
background image

Backplane API Functions

MVI-ADM ♦ 'C' Programmable

Developer's Guide

'C' Programmable Application Development Module

Page 210 of 342

ProSoft Technology, Inc.

February 20, 2013

8.3

Backplane API Synchronization Functions

MVIbp_WaitForInputScan

Syntax

int MVIbp_WaitForInputScan(MVIHANDLE handle, WORD timeout);

Parameters

handle

Handle returned by previous call to MVIbp_Open

timeout

Maximum number of milliseconds to wait for scan

Description
MVIbp_WaitForInputScan allows an application to synchronize with the scan of
the module’s input image. This function will return immediately after the input
image has been read. This function may also be used by a module application to
determine if the Flex I/O bus is active.

handle must be a valid handle returned from MVIbp_Open.

timeout specifies the number of milliseconds that the function will wait for the
input scan to occur.

Notes: There is no distinction in the MVI94 module between input and output scans. Therefore, the
MVIbp_WaitForInputScan and MVIbp_WaitForOutputScan functions will perform exactly the same

function and are interchangeable.

The scan time of the Flex I/O bus varies according to the number of modules installed. If the MVI-

ADM module is the only module present, then it will be scanned approximately every 200

microseconds. The maximum scan time for a full rack of 8 modules is approximately 1.6

milliseconds. Note that the scan time referred to here is not the PLC scan time, but the Flex I/O bus
scan time. The PLC scan time will depend upon which Flex adapter is used and how it is

configured.

MVI56 Note: This function is not supported for the MVI56 and will return

MVI_ERR_NOTSUPPORTED.

MVI94 Note: There is no distinction in the MVI94 module between input and output scans.
Therefore, the MVIbp_WaitForInputScan and MVIbp_WaitForOutputScan functions will perform

exactly the same function and are interchangeable.

Return Value

MVI_SUCCESS

The input scan has occurred.

MVI_ERR_NOACCESS

handle does not have access

MVI_ERR_TIMEOUT

The timeout expired before an input scan occurred.

Example

MVIHANDLE Handle;
/* Wait here until input scan, 50ms timeout */
rc = MVIbp_WaitForInputScan(Handle, 50);
if (rc == MVI_ERR_TIMEOUT)
printf("Input scan did not occur within 50 milliseconds\n");
else

Advertising