Oc_setuppowerfail, Action -75 – Rockwell Automation 1747-PCINT API Software for 1746 I/O User Manual
Page 129

OC_SetupPowerFail Action
Library of Routines
6–75
Publication 1747-6.5.3 June 1998
OC_SetupPowerFail
Action
OC_SetupPowerFailAction registers the action to be taken when a power fail
interrupt is received from the scanner.
Syntax:
int OC_SetupPowerFailAction(HANDLE handle, BYTE *bufptr, WORD offset, WORD length, void
(*callback)() );
Parameters:
Description:
You can configure the power failure action in four ways:
•
No action (default); the power failure interrupt is ignored (
bufptr
is NULL;
callback
is NULL)
•
Copy a block of data to the host retentive data partition in dual port RAM (
bufptr
points to the data
to save;
callback
is NULL)
•
Execute a user callback function (
bufptr
is NULL;
callback
points to the routine to call)
•
Copy a block of data and execute a callback function (
bufptr
points to the data to save;
callback
points to the routine to call)
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.
Parameter:
Description:
handle
Must be a valid handle returned from OC_OpenScanner
bufptr
If
bufptr
is:
NULL
no data is copied (default)
Not NULL
at power fail
length
bytes of data are copied from
bufptr
to the host retentive data partition starting at
offset
.
offset
Specifies the offset within the host retentive data partition to begin copying
length
Number of bytes to copy
If
length
points beyond the end of the host retentive data partition, it is
truncated
callback
If
callback
is:
NULL
no callback function is executed (default)
Not NULL
the power fail interrupt routine calls this function after
copying the data to the host retentive data partition
(if configured)