Oc_readsram, Oc_readsram -52 – Rockwell Automation 1747-PCIS API Software - Open Controller User Manual
Page 112

Publication 1747-UM002A-US-P - June 2000
6-52 Library of Routines
Return Value:
Considerations:
Supported in the DOS API library and the Windows NT API library
Example:
HANDLE
Handle;
WORD
outputdata[2];
int
retcode;
retcode =
OC_ReadOutputImage( Handle, NULL, 6, 0, 2,
outputdata );
/* Read slot 6 data, first 2 words, directly from the output
image */
/* table to outputdata buffer */
OC_ReadSRAM
OC_ReadSRAM reads data from the battery-backed user memory.
Syntax:
int
OC_ReadSRAM(HANDLE Handle, BYTE *bufptr,
DWORD offset, DWORD length);
Description:
The battery-backed memory may be used to store important data that
needs to be preserved in the event of a power failure. The size of the
available memory in bytes may be obtained using OC_GetDeviceInfo.
handle
must be a valid handle returned from OC_OpenScanner.
bufptr
points to a buffer to be receive the data.
offset
specifies
Name:
Value:
Description:
SUCCESS
0
output image was read successfully
ERR_OCACCESS
2
handle
does not have access to scanner
ERR_OCPARAM
8
parameter contains invalid value
ERR_OCSCANCFG
14
scanner has not been configured
ERR_OCSLOT
12
slot number is invalid
IMPORTANT
It is recommended that the integrity of data stored in
the user memory be verified by some means. The
OC_CalculateCRC function may be used to generate
a 16-bit CRC that may be used for this purpose.