130
Rockwell Automation Publication 1789-UM002K-EN-P - January 2015
Chapter 7
Develop External Routines
Build and Download External
Routines
Before you build an external routine, make sure that RA_ExternalRoutines.h is in
the include path for the project. Then, follow these steps.
1.
Build the project.
2.
Map the external routines into a project.
3.
Download the project to a SoftLogix controller.
The external routine DLL is downloaded as a part of the
project download.
Update an Existing External
Routine
To update an existing external routine do the following.
1.
Edit the source code in Visual Studio software.
2.
Rebuild the project.
3.
Re-map the external routines into a project.
If you re-map one function from a DLL, all of the other functions that you
use from the same DLL are also re-mapped. When a DLL is re-mapped, a
re-verification is done on all of the routines that reference the DLL.
Routines that reference a DLL different from the one re-mapped are
unaffected by this process.
4.
Re-download the project to the SoftLogix controller.
The external routines must be re-mapped and the project must be re-downloaded
to the controller for the changes to be made in the SoftLogix controller.
Create Multi-threaded
External Routines
The following example shows an external routine that creates threads to do the
majority of the processing. Consider using this approach when the amount of
time required to execute is large enough that it causes a watchdog fault in the
controller. Applications that have disk I/O or, as in the following example, play
*.wav files, are created in this manner.
The following example also shows how to synchronize the threads with the
controller so that they can react properly to changes of state in the controller.