Exporting and Importing Cams
The BasicMotion_CamExportAndImport.project
sample project is located in the installation directory of CODESYS under ..\CODESYS SoftMotion\Examples
.
The example shows how to export and import a cam.
Structure of the application
The application consists of the PLC_PRG
program and a CamEditor
cam.
PLC_PRG
The program consists of a simple state machine where a cam is created in IEC code in the
STATE_CREATE_CAM
state. For more information, see the following: Creating Cams Programmatically.Then this cam is exported in the
STATE_EXPORT_CAM
state using the SMC_WriteCAM function block and then imported in theSTATE_START_IMPORT_CAM
state using the SMC_ReadCAM function block.CamEditor
The cam does not have any meaning at first because it is not used in the application. The exported cam from
PLC_PRG
can be imported into the cam editor. This is a manual step which is described in the following section.
Commissioning
Build the application and download it to a controller.
Start the application.
The
PLC_PRG
program generates the cam and exports it to thePlcLogic
directory of the controller.You can also display and edit the exported cam in the cam editor. To do this, open the
CamEditor
cam and import the cam using the Read Cam Online File command.After you have made changes, you can export the modified cam using the Write Cam Online File command. This cam can be read into the IEC code with the
SMC_ReadCAM
function block and used in the application.