Unauthorized use of TwinCAT CAM Design

TwinCAT CAM Design is a powerful cam editor provided by Beckhoff. It is easy to use, but each development computer that needs to use this tool must purchase a license to use it. Even in TwinCAT 3, there is no trial version license available.Unauthorized users can use TwinCAT CAM Design to edit curves, but the curves cannot be saved, so they cannot be activated to the controller. Therefore, users must generate a cam table in the PLC program.This article introduces a method that combines TwinCAT CAM Design and PLC programs to generate the ideal cam curve.

1.     background introduce

TwinCAT CAM Design is a cam editor provided by Beckhoff, which provides a visual interface for editing cam curves. This interface is integrated as a TwinCAT plug-in under the Motion project in the TwinCAT development environment.The curves edited in TwinCAT CAM Design are saved in the TwinCAT project, and when the project is activated for configuration, the cam curves are also downloaded to the controller for calling by function blocks such as MC_CamIn in the PLC program.In TwinCAT CAM Design, not only can multiple methods be selected to smooth the position curves of the master and slave axes, but also second-order and third-order curves can be displayed.When the master axis moves at a constant speed, whether the speed and acceleration of the slave axis are continuous and smooth directly affects whether the final mechanical motion is stable. Therefore, observing second-order and third-order cam curves can help identify and avoid problems in a timely manner.This tool is powerful and easy to use, but requires purchase of a license to use. Even in TwinCAT 3, there is no trial version license available.Unauthorized users can use TwinCAT CAM Design to edit curves, but the curves cannot be saved, so they cannot be activated to the controller, so users must generate a cam table in the PLC program. This article introduces a method to generate ideal cam curves by combining TwinCAT CAM Design and PLC programs.

2.     Read the curve downloaded from the cam editor with PLC code



Although TwinCAT CAM Design unauthorized users cannot save curves, they can download curves. Using this feature, the PLC program can read in the edited and confirmed ideal curve.For those with a large number of points, additional code can be written to save the file, while for those with fewer points, the key point information can even be "hand-copied".The relevant process is as follows:

• Add a Slave under Motion / NC Task / Table

If you do not have authorization, the system will prompt "No License-No Possibility to store modified cam data permanently".Just ignore it and click "OK" directly.

• Edit a curve

It includes a stationary segment, an acceleration segment, and a uniform speed segment.The acceleration segment can be achieved with the "Aumtomatic" function to obtain a smooth curve.




Download the curve to the target controller

Confirm that the target controller is in the Running mode before downloading the cam curve to do it.



Click "Download", and normally the system will not give any prompt.

• Read the cam table from the PLC

Declaring variables and function block instances:



Edit the generated table of keypoints, with type 22, which is "Motion Function";assign pArray to ADR (Table3), and then you can see the readback results in the array Table3.

Read the cam table No. 3 and place it on CamTable3



Read the cam table from the PLC




Comparing the information of several key points in TwinCAT Cam Design, it can be seen that the reading is correct:



Although there are many types defined in MC_MotionFunctionType, the most commonly used are 1 and 15, the former for linear connections and the latter for automatic smoothing.


3.     Verify the cam curve written by PLC with the cam editor

Define and initialize the cam table data in the PLC program, and write it to the cam table

Declaring variables and function block instances:

 

Definition of the size of a cam  watch


Edit the generated table of key points, with type 22, "Motion Function";pArray is assigned to ADR (Table1), the key point information for the cam table 


Specify the key information in Table 1, and write CamTable1 to the No. 1 cam table:



• Upload the cam table in TwinCAT Cam Design

First create a new cam table, and then use Change Id to change it to match the Table ID written in the PLC program:



• On the newly created cam shaft interface, click upload



The system prompts that the current data will be overwritten, click "OK"



Compare the uploaded curve key point information with the assignment in the PLC program

Uploaded cam curve key points:

Key information of Table1 in PLC


Note

For complex or high-point cam tables, it is recommended to save them as different files using a writer after completing and reading them into the PLC.The subsequent PLC program can then read the different files to populate the data in the CamTable.