Rockwell Automation 1747-PCIS API Software - Open Controller User Manual
Page 56

Publication 1747-UM002A-US-P - June 2000
5-2 Configuring I/O Modules
SlotCfg
contains information about each slot in the racks. The 1746
I/O PCI Interface supports as many as 31 slots, numbered 0 to 30. Slot
0 is the adapter slot (left slot of rack 1) and is invalid for scanner
functions. Each slot is described by the structure
OCSLOTCFG
:
struct {
BYTE
mix;
/* Module I/O Mix value */
BYTE
type;
/* Module Type */
BYTE
InputSize;
/* number of inputs in bytes */
BYTE
OutputSize;
/* number of outputs in bytes */
WORD
M0Size;
/* size of M0 file in words */
WORD
M1Size;
/* size of M1 file in words */
WORD
GSize;
/* size of G file in words */
WORD
*GData;
/* pointer to array of length GSize
words */
char
*Name;
/* pointer to module name string */
} OCSLOTCFG;
You can specify a module by name or by mix and type. You only
specify G data if the module uses G files (such as the 1747-SN). If the
Name
pointer is NULL, OC_CreateIOConfiguration uses
mix
and
type
to identify the module. See page 4 for the
mix
and
type
values.
OC_CreateIOConfiguration supplies the
InputSize
,
OutputSize
,
M0Size
,
M1Size
,
Gsize
, and
Name
fields.
If
Name
points to a string containing a valid module name, the module
name identifies the module. OC_CreateIOConfiguration supplies the
mix
,
type
,
InputSize
,
OutputSize
,
M0Size
,
M1Size
, and
Gsize
fields.
Initialize empty slots and slot 0 with a
mix
value of 0xFF and a
type
value of 0xFF.
If the module is not in the internal database,
OC_CreateIOConfiguration doesn’t alter the OCSLOTCFG.
To support modules not included in the internal database of modules,
the host application can initialize the
mix
,
type
,
InputSize
,
OutputSize
,
M0Size
,
M1Size
, and
GSize
before downloading the
I/O configuration to the scanner. See the I/O module’s user manual to
determine the proper configuration information.
After the OC_CreateIOConfiguration and OCGetIOConfiguration
functions return, the I/O configuration structure must be checked for
installed modules with G files. If the
Gsize
field of a non-empty slot
configuration is not zero, then the module contains a G file. If the
module contains a G file, initialize
GData
to point to an array of
Gsize
words to be loaded into the module during scanner
configuration. See the I/O module’s user manual to determine the
proper G file data.