Rockwell-automation 1747-PCIS API Software - Open Controller Uživatelský manuál Strana 50

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 174
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 49
Publication 1747-UM002A-US-P - June 2000
3-18 Developing Applications
Determining Partition Sizes
for Shared Memory
The host application initializes the scanner by providing partitioning
information, which contains the size of memory to be reserved in the
shared memory for the input and output images. The size of memory
to be reserved for each of the images must be greater than or equal to
the number of input and output words required by each module. The
host application can’t communicate with the scanner until it has been
initialized.
The partitioning information is passed to OC_InitScanner in the
OCINIT structure, which is defined as:
typedef struct tagOCINIT {
WORD OutputImageSize; /* size in bytes */
WORD InputImageSize; /* size in bytes */
WORD HostRetentiveDataSize; /* size in bytes */
} OCINIT;
To determine the input and output image sizes, call
OC_CreateIOConfiguration with a configuration that contains the I/O
modules to be installed. OC_CreateIOConfiguration returns the
number of bytes of I/O required by each module. Or you can use
OC_GetIOConfig to use the current configuration, if one exists. The
input and output sizes are based on the number of words of I/O
required by each module. As an estimate, take the total number of
input and output words for all the modules in the system and multiply
by two to get the number of required bytes. The following code
fragment calculates the number of bytes required by the input and
output images:
OCINIT initinfo;
OCIOCFG iocfg;
int i,numslots;
/* assuming application has filled iocfg with I/O configuration */
OC_CreateIOConfiguration(&iocfg);
numslots = iocfg.Rack1Size + iocfg.Rack2Size + iocfg.Rack3Size;
if ( numslots > 31 ) numslots = 31;
initinfo.OutputImageSize = initinfo.InputImageSize = 0;
for ( i=1 ; i<numslots ; i++) {
initinfo.OutputImageSize += ((iocfg.SlotCfg[i].OutputSize+1) / 2) * 2;
initinfo.InputImageSize += ((iocfg.SlotCfg[i].InputSize+1) / 2) * 2;
}
Zobrazit stránku 49
1 2 ... 45 46 47 48 49 50 51 52 53 54 55 ... 173 174

Komentáře k této Příručce

Žádné komentáře