ProSoft Technology MVI69-ADM User Manual

Page 55

Advertising
background image

MVI-ADM ♦ 'C' Programmable

Understanding the MVI-ADM API

'C' Programmable Application Development Module

Developer's Guide

ProSoft Technology, Inc.

Page 55 of 342

February 20, 2013

MVI69

The MVI69 stores its configuration in EEPROM, downloaded via the debug port.
The EEPROM has 129 KB of configuration space. The function

ReadCfg()

parses the file and qualifies the configuration data. The configuration file uses
headings in square brackets to define the sections. Each item is parsed using the
ADM RAM file functions. The file is searched for a configuration item. If a match
is found, the value is saved into a variable. Boundary checking is then performed
on the data. An example of a configuration item search follows:

ptr= ADM_RAM_find_Section (adm_handle, "[Port]");
ports[0].stopbits = ADM_RAM_GetInt(adm_handle, "[Port]");
switch(ports[0].stopbits)
{
case 1:
ports[0].stopbits = STOPBITS1;
case 2:
ports[0].stopbits = STOPBITS2;
break;
default:
ports[0].CfgErr |= 0x0100;
ports[0].stopbits = STOPBITS1;
}

Here the file is being parsed for "Stop Bits" under the heading of [Port]. Refer to
the example code for a sample configuration file.

Because a pointer to a function is used by the ADM API to access this function,
the name can be anything the developer wishes. However, the function must
take the same arguments and the same return value.

MVI71

In the case of the MVI71, the function

ProcessCfg()

checks the data values

transferred from the configuration file in the PLC processor. If configuration
values are added to the configuration structure in the PLC, then the logic to
perform boundary checking on the added data must be added to

ProcessCfg()

.

Advertising