ProSoft Technology MVI69-ADM User Manual

Page 217

Advertising
background image

MVI-ADM ♦ 'C' Programmable

Backplane API Functions

'C' Programmable Application Development Module

Developer's Guide

ProSoft Technology, Inc.

Page 217 of 342

February 20, 2013

The MVIbp_ReceiveMessage function retrieves data written to the MVI-ADM module by the

processor via a MSG instruction. The MSG instruction must be configured as shown in table A. The

MSG instruction implements a "put attribute' command to the MVI-ADM module’s assembly object.
The MSG instruction will fail if a message has already been written to the MVI-ADM module but

application has not yet retrieved the message via MVIbp_ReceiveMessage.

MVI69 Note: At this time, messaging is not supported on the MVI69.

Receive MSG Instruction Configuration

Field

Value

Description

Message Type

CIP Generic

Specify CIP message type

Service Code

10 (Hex)

Set_Attribute_Single service

Object Type

4

Assembly object class code

Object ID

8

Output message instance number

Object Attribute

3

Data attribute

Num Elements

Application dependent

Size of message to be written

Path

Application dependent

Path to MVI-ADM module

Return Value

MVI_SUCCESS

A message has been received.

MVI_ERR_NOACCESS

handle does not have access.

MVI_ERR_TIMEOUT

The timeout occurred before a message was received.

MVI_ERR_BADPARAM

A parameter is invalid.

MVI_ERR_BADCONFIG

Receive messaging is not enabled.

MVI_ERR_MSGTOOBIG

The received message is too big for the buffer.

Example

MVIHANDLE Handle;
int rc;
WORD buffer[256];
WORD length;
length = 256; // maximum message size that can be received
// Wait up to 5 seconds for a message
rc = MVIbp_ReceiveMessage(Handle, buffer, &length, 0, 5000);
if (rc == MVI_SUCCESS)
printf("Message received. Length is %d words\n", length);

See Also
MVIbp_SetIOConfig (page 208)

MVIbp_SendMessage (page 218)

Advertising