EasyManuals Logo

Allen-Bradley SoftLogix 5800 User Manual

Allen-Bradley SoftLogix 5800
272 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #158 background imageLoading...
Page #158 background image
158 Rockwell Automation Publication 1789-UM002K-EN-P - January 2015
Chapter 8 Program Windows Events to Monitor and Change Controller Execution
Programmatically Saving the
Controller
From an external routine or application, you can programmatically save the
current controller information (tag data values and configuration information).
A programmatic save can use these pre-defined Windows events. Replace the ‘xx’
with the 2-digit slot number where the controller resides.
Programming Example: Programmatic Save of Controller
The following example codes show how you can use all of the above events to
programmatically save the contents of a controller. This code uses printf
statements to help track progress through the application.
int savenow(int slot)
{
DWORD status;
WCHAR eventname[_MAX_PATH];
SECURITY_ATTRIBUTES sa;
PSECURITY_DESCRIPTOR pSD;
// Create a NULL DACL to allow other tasks to access the external events.
pSD = (PSECURITY_DESCRIPTOR) LocalAlloc(LPTR, SECURITY_DESCRIPTOR_MIN_LENGTH);
if (pSD == NULL)
return 1;
if (!InitializeSecurityDescriptor(pSD, SECURITY_DESCRIPTOR_REVISION))
return 1;
// Add a NULL DACL for full permission for all
if (!SetSecurityDescriptorDacl(pSD, TRUE, (PACL) NULL, FALSE))
return 1;
sa.nLength = sizeof(sa);
sa.lpSecurityDescriptor = pSD;
sa.bInheritHandle = TRUE;
// CreateEvent(security, manuallyReset, initialState, eventName);
swprintf(eventname, sa_kicksave_event_fmt, slot);
h_kicksaveEvent = CreateEvent (&sa, FALSE, FALSE, eventname);
printf("h_kicksaveEvent = %d
swprintf(eventname, sa_savepermitted_event_fmt, slot);
h_savePermittedEvent = CreateEvent (&sa, TRUE, FALSE, eventname);
printf("h_savePermittedEvent = %d
swprintf(eventname, sa_savestart_event_fmt, slot);
h_saveStartEvent = CreateEvent (&sa, TRUE, FALSE, eventname);
printf("h_saveStartEvent = %d
Windows Event Description
SOFTLOGIX_
xx_KICKSAVE This incoming event indicates that a save is to be forced in the controller in slot xx.
SOFTLOGIX_
xx_SAVEPERMITTED This outbound event indicates that a save is permitted in the controller in slot xx.
SOFTLOGIX_xx_SAVESTART This outbound event indicates that a save has started in the controller in slot xx.
SOFTLOGIX_xx_SAVEDONE This outbound event indicates that a save has completed in the controller in slot xx.
SOFTLOGIX_
xx_SAVELOCK This event is a handshake between multiple clients. Use this event to prevent multiple clients from attempting to start
a save at the same time in the controller in slot xx.

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Allen-Bradley SoftLogix 5800 and is the answer not in the manual?

Allen-Bradley SoftLogix 5800 Specifications

General IconGeneral
BrandAllen-Bradley
ModelSoftLogix 5800
CategoryController
LanguageEnglish

Related product manuals