Publication 1756-RM004B-EN-P - October 2000
MVI Backplane API 3-15
The MVIbp_ReceiveMessage function retrieves data written to the MVI
module by the processor via a MSG instruction. The MSG instruction
must be configured as shown in table 3.E. The MSG instruction
implements a ‘put attribute’ command to the MVI module’s assembly
object. The MSG instruction will fail if a message has already been
written to the MVI module but the application has not yet retrieved the
message via MVIbp_ReceiveMessage.
Return Value:
MVI_SUCCESS a message has been received
MVI_ERR_NOACCESS
handle
does not have access.
MVI_ERR_TIMEOUT timeout occurred before message 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[250];
WORD length;
length = 250; // 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_GetIOConfig
MVIbp_SendMessage
MVIbp_ReceiveMessage
Table 3.E - 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 module