Return value: considerations, Example – Rockwell Automation 1747-PCIS API Software - Open Controller User Manual
Page 113

Publication 1747-UM002A-US-P - June 2000
Library of Routines 6-53
the offset within the memroy to begin reading.
length
specifiies the
number of bytes to be read.
If
offset
+
length
points past the end of the memory, no bytes
will be written and ERR_OCPRAM will be returned.
Return Value:
Considerations:
Supported in the Windows NT API library only.
Example:
Byte
buf[100] / * buffer of 100 bytes of important
data * /
HANDLE handle;
Word crc, crc_saved;
/* Read 100 bytes of data from offset 0 in SRAM */
OC_ReadSRAM(handle, buf, 0, 100);
/* Calculate CRC */
OC_CalculateCRC(buf, 100, &crc);
/* Read saved CRC at offset 100 in SRAM */
OC_ReadSRAM(handle, &crc_saved, 100, 2);
/* Check CRC */
if (crc != saved_crc)
printf(“ERROR: Data is corrupted.\n”);
Name:
Description:
SUCCESS
data was read successfully
ERR_OCACCESS
handle
does not have access to scanner
ERR_OCPARAM
offset+length
points past the end of the memory