beautypg.com

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

Page 127

background image

Publication 1747-UM002A-US-P - June 2000

Library of Routines 6-67

A system typically has at least 10 milliseconds, and possibly as much
as 50 milliseconds or more between the power fail interrupt and the
loss of power. The duration of this interval is a function of the power
supply and system configuration, and it varies from system to system.
You might need to experiment to determine the typical value for a
particular system.

Data is copied to the host retentive data partition at the rate of
approximately 1K bytes per millisecond.

Declare

bufptr

as static if the OC_SetupPowerFail function is used

other than in

main( )

; otherwise random data will be sent to the host

retentive data area.

Return Value:

Considerations:

Supported in the DOS API library only.

Example:

This example is for DOS only.

HANDLE

Handle;

BYTE

buffer1[100];

BYTE

buffer2[100];

int

retcode;

void PowerFailSave( void )/* power fail callback routine */

{

len = 100;

OC_WriteRtcSRAM( buffer2, 0, &len );/* Put data in protected

area */

}

retcode =

OC_SetupPowerFailAction( Handle, buffer1, 0,

100, PowerFailSave );

Name:

Value:

Description:

SUCCESS

0

power fail action was registered successfully

ERR_OCACCESS

2

handle

does not have access to scanner

ERR_OCINIT

5

scanner has not been initialized, see OC_InitScanner

ERR_OCPARAM

8

parameter contains invalid value

This manual is related to the following products: