Skip to main content

Kollmorgen Support Network

Cam Profile Creation in PLC code | 26 Jun 2014 | |

Cam Profile Creation in PLC code

Attached is a demo program showing an example of how to use cam creation function blocks to build a completely new profile while a program is running.  The main function required is MLProfileBuild located in the function block library under Motion/Common > Profiles.  This will create a new cam profile, and the main inputs are two custom structures.  One determines the profile properties such as the input and output scaling and offsets.  The other is an array (the dimension is the number of points that you want) that contains the master point, slave point, instantaneous velocity, and instantaneous acceleration for every desired cam point.  In the example program, I create a 3 point cam profile, and preset these arrays in the "Main" SFC program in the P1 tab of step 3.

I then have a case statement in the "MotionControl" program that if the user presses the change cam button on the built in control panel, it goes through a sequence to change a cam.  Two of the points I make the user can edit, to change the dwell length of the cam and the distance the slave moves.  The sequence involves calling the MLProfileBuild function and waiting for it to complete, calling the MC_CamTblSelect function and waiting for it to finish, calling the MC_CamIn function whenever I want to switch cams (you might want logic to wait until the end of one cam before switching to another) and finally calling MLProfileRelease on the previous cam profile that was running.  We only have memory set aside for 256 cam profiles at once, but if you are constantly creating new ones you can run out of this memory quickly.  That is why we have the ProfileRelease function to clear out a memory slot that can then be reused by calling a profile build function.  This demo program switches out between two cam profiles, one is always active and the other is being built.  You will probably need to do the same if you have one axis with a cam that is constantly changing.

About this Article

Joe Parks