Rockwell Automation Publication 1789-UM002K-EN-P - January 2015
117
Develop External Routines
Chapter 7
How the Project Stores and Downloads an External Routine
To use an external routine, you must associate (also known as ‘map’) a DLL file to
an external routine that you create in the Controller Organizer of a project (as
shown in
). You choose the DLL file that contains the function you
want to execute. The Logix Designer application makes a copy of that DLL and
stores it in the external routine folder located in the project directory, in a sub-
folder named the same as the project file. For example, if the project
MyProject.ACD is in C:\Users\<username>\Documents\Studio5000\Projects,
mapping a DLL to that project stores a copy of the DLL file in the directory:
C:\Users\<username>\Documents\Studio5000\Projects\ExternalRoutines\My
Project\.
When you download the project to the controller, the mapped DLL is also
downloaded to the target controller and a copy of the DLL is placed in the slot
directory of the controller. For example, if you download MyProject.ACD to a
controller in slot 4, the external routine DLL file is downloaded to the location
C:\Program Files\Rockwell Automation\SoftLogix 5800\Data\slot04 on the
SoftLogix controller.
Because this process creates copies of the original DLL file, you can execute
different versions of the same DLL on SoftLogix controllers in different slots of
the same virtual chassis. The DLL used by a controller in one slot is completely
independent of the DLL used by a controller in another slot. For this reason, if
you update a DLL, you re-map the DLL in each project and re-download the
updated projects to the appropriate controllers.
Linking an individual DLL file to a specific controller and slot can be useful for
debugging changes or testing new versions of an external routine. You can load
different versions into controllers in different slots without having to actually
update controllers that are performing plant control.
Create Synchronous, Single-
threaded External Routines
This type of external routine runs synchronously in the process space of the
control engine. Use this type of routine when the execution time of the function
does not significantly impact the overall ladder scan time or cause a watchdog
fault in the controller. A watchdog fault is a major fault that occurs because a scan
of the routine did not complete within the expected amount of time.
Create a Visual Studio Project
Complete these steps to create a project in Visual Studio.
IMPORTANT
If you want to use a copy of a project on another workstation, take care when
making a copy of a project that includes an external routine. In addition to the
ACD file, you must also copy the external routines folder that contains all of the
DLL files associated with that ACD file.