Rockwell Automation 1789-L10_L30_L60 SoftLogix 5800 System User Manual User Manual

Page 116

Advertising
background image

116

Rockwell Automation Publication 1789-UM002J-EN-P - December 2012

Chapter 7

Develop External Routines

Due to the requirements of this feature it is not possible for Rockwell
Automation to safeguard and protect from certain scenarios that may interfere
with the operation of the controller and result in unpredictable behavior.

Carefully read and follow the recommendations in this chapter. This chapter
describes how to test an external routine in the Microsoft debugger and run it
under normal operation with the controller placed in ‘Test Mode’ so that outputs
are not energized. Thorough testing must be performed in Test Mode prior to
running the external routine with the controller's outputs enabled.

Because of the variety of uses for external routines, those responsible for the
application and use of this control equipment must satisfy themselves that all
necessary steps have been taken to assure that the application and use meets all
performance and safety requirements, including any applicable laws, regulations,
codes and standards. Rockwell Automation does not assume responsibility or
liability (to include intellectual property liability) for actual use of the external
routines feature in a control system application.

How the SoftLogix Controller
Executes External Routines

An external routine lets the SoftLogix controller execute a function that was
developed outside of the Logix Designer application environment. The external
routine must be a standard Windows DLL and it can contain one or more
functions. An external routine can execute synchronously or asynchronously,
depending on how the code is written in the external routine DLL. You can
develop the DLL in C or C++ and export the functions of that DLL in
C or C++.

You make these exported functions available to the SoftLogix controller by
including XML information. The XML information describes the
exported function.

Once you add an external routine to a project, the DLL is downloaded to the
SoftLogix controller when you download the project. The SoftLogix controller
loads the DLL by using a LoadLibrary Windows call during the download
process. The SoftLogix controller uses a GetProcAddress Windows call to locate
the exported function so that the function can be executed by an associated JXR
instruction in the ladder program.

The external routine is executed in the process space of the SoftLogix controller.
Spawning threads and processes are techniques you can use to make the JXR
instruction for the external routine execute asynchronous to the ladder scan. If
you spawn a thread, the external routine and the spawned thread both run in the
process space of the controller. If you spawn another process, the external routine
runs in the process space of the controller while the newly spawned process runs
in its own process space.

IMPORTANT

If proper procedures are not followed, it is possible that the controller may
respond in an unpredictable manner.

Advertising