ProSoft Technology MVI69-ADM User Manual

Page 65

Advertising
background image

MVI-ADM ♦ 'C' Programmable

Understanding the MVI-ADM API

'C' Programmable Application Development Module

Developer's Guide

ProSoft Technology, Inc.

Page 65 of 342

February 20, 2013

For example, if bi-directional messaging is used, at least two words of output and
two words of input image must be reserved for messaging.

Direct I/O access begins at the first word of the input and output images (word 0).
If only one direction of messaging data flow is enabled, that messaging control
word is always the last word of the total image size (refer to the
MVIbp_SetIOConfig (page 208) function). If both directions of messaging data
flow are enabled, the SendMessage (from the MVI to the Controller) control word
is the last word of the total image size, and the ReceiveMessage (from the
Controller to the MVI) control word is the word before the last word of the total
image size.

Messaging
For large amounts of data (that is, data that is too large to fit into the module’s
input or output image), the Messaging functions provide a data transfer
mechanism that is very simple for the module application to use. Large amounts
of data may be transferred to and from the control processor with a single
function call, with the transfer protocol handled by the API.

The main disadvantage of this method is that the control processor code is more
complex.

Example ladder logic code is provided to illustrate how the messaging protocol
may be implemented on the control processor.

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

Messaging Protocol

The API messaging protocol has been designed to be as simple as possible,
while providing the necessary controls for reliable data transfer between the
module and the control processor. The protocol is completely handled by the
API, and is therefore transparent to the module application. However, the
protocol must be implemented in the control processor’s code. For this reason,
details of the protocol are presented here.

The protocol utilizes two control words for each direction of data flow: the Input
Control Word, which is written by the module and read by the processor, and the
Output Control Word, which is written by the processor and read by the module.
The location of these control words depends upon how the module is configured
by the user. If only one direction of messaging data flow is enabled, that
messaging control word is always the last word of the total image size (refer to
the MVIbp_SetIOConfig (page 208) function).

If both directions of messaging data flow are enabled, the SendMessage (from
the MVI to the Controller) control word is the last word of the total image size and
the ReceiveMessage (from the Controller to the MVI) control word is the word
before the last word of the total image size.

Advertising