Oc_writesram, Oc_writesram -80 – Rockwell Automation 1747-PCIS API Software - Open Controller User Manual

Page 140

Advertising
background image

Publication 1747-UM002A-US-P - June 2000

6-80 Library of Routines

Considerations:

Supported in the DOS API library and the Windows NT API library

Example:

HANDLE

Handle;

WORD

outputdata[2];

int

retcode;

outputdata[0] = 0x55AA;

outputdata[1] = 0xAA55;

retcode =

OC_WriteOutputImage( Handle, NULL, 6, 0, 2,

outputdata );

OC_WriteSRAM

OC_WriteSRAM wires data to the battery-backed user memory

Syntax:

int

OC_WriteSRAM(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 the data to be written.

offset

specifies the offset

within the memroy to begin writing.

length

specifiies the number of

bytes to be written.

If

offset

+

length

points past the end of the memory, no bytes

will be written and ERR_OCPRAM will be returned.

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.

Advertising
This manual is related to the following products: