ProSoft Technology MVI69-ADM User Manual

Page 311

Advertising
background image

MVI-ADM ♦ 'C' Programmable

Side-Connect API Library Functions

'C' Programmable Application Development Module

Developer's Guide

ProSoft Technology, Inc.

Page 311 of 342

February 20, 2013

An attempt to read past the end of a data table file will result in a return code of

MVISC_ERR_XFERFAIL or MVISC_ERR_PCCCFAIL. If the PLC is in RUN mode when this read

is attempted, the PLC-5 will be faulted. Care should be taken not to exceed the boundaries of the
PLC-5 data tables. See MVIsc_GetPLCFileInfo to determine valid data table boundaries.

Return Value

MVISC_SUCCESS

The data was read successfully

MVISC_ERR_NOACCESS

handle does not have access

MVISC_ERR_BADPARAM

Parameter contains invalid value

MVISC_ERR_PLCTIMEOUT

PLC-5 did not respond

MVISC_ERR_XFERFAIL

PLC-5 returned an error

MVISC_ERR_PCCCFAIL

PCCC error occurred

Example

HANDLE Handle;
float f[3];
WORD scantime;
short acc;
int rc;
/* Read 3 floating-point values starting at element 5 of float file 8 (F8:5 -
F8:7), asynchronously */
rc = MVIsc_ReadPLC(Handle, f, 8, 5, 0, 3, MVISC_DTYP_FLOAT,
MVISC_ASYNC_ACCESS);
if (rc != MVISC_SUCCESS)
printf("ERROR: MVIsc_ReadPLC failed");
/* Read the last program scan time from the status file (S2:8), synchronously
*/
rc = MVIscReadPLC(Handle, &scantime, 2, 8, 0, 1, MVISC_DTYP_WORD,
MVISC_SYNC_ACCESS);
if (rc != MVISC_SUCCESS)
printf("ERROR: MVIsc_ReadPLC failed");
/* Read the accumulated value from timer 2 of timer file 4 (T4:2.ACC),
synchronously */
rc = MVIscReadPLC(Handle, &acc, 4, 2, MVISC_SUBEL_T_ACC, 1,
MVISC_DTYP_WORD, MVISC_SYNC_ACCESS);
if (rc != MVISC_SUCCESS)
printf("ERROR: MVIsc_ReadPLC failed");

Advertising