Rockwell Automation 1747-PCINT API Software for 1746 I/O User Manual
Page 45
Developing Applications
3–19
Publication 1747-6.5.3 Junel 1998
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; initinfo.OutputImageSize += ((iocfg.SlotCfg[i].OutputSize+1) / 2) * 2; } Any remaining shared memory can be allocated for host retentive data, which is the This constant specifies the total number of bytes available for the three segment initinfo.HostRetentiveDataSize = OCSEGMENTSIZELIMIt - initinfo.OutputImageSize - initinfo.InputImageSize; If the I/O configuration changes and causes the image sizes to change, the maximum
if ( numslots > 31 ) numslots = 31;
initinfo.OutputImageSize = initinfo.InputImageSize = 0;
for ( i=1 ; i
initinfo.InputImageSize += ((iocfg.SlotCfg[i].InputSize+1) / 2) * 2;
portion of the dual port RAM that you can use to store data in case power fails. If
the application doesn’t need host retentive data, set its size to 0. If the application
needs host retentive data, the application can determine the amount of memory
available by using the OCSEGMENTSIZELIMIT constant.
sizes. To calculate the maximum memory available for the host retentive data, use
this formula:
memory available for Host Retentive Data will change accordingly, and information
stored in the Host Retentive Data memory may be overwritten.