How to Use a CAM Curve

The CAM functionality is only available in combination with the kernel Function Block CMC_MOTION_KERNEL_REAL CMC_MOTION_KERNEL_REAL.

General usage

The usage of a CAM function is based on the following elements:

  • CAM table defined with the data type MC_PProfile.
  • An instance of the Function Block MC_CamTableSelect MC_CamTableSelect.
  • An instance of the Function Block MCA_CAM_EXTRA (optional) MCA_CAM_EXTRA.
  • An instance of Function Block MC_CamIn MC_CamIn.
  • An instance of Function Block MC_CamOut MC_CamOut.
  1. Declare a CAM table as an array of the data type MC_PProfile in the program.

  2. Write data to this array.

  3. Use the address of the CAM table at the input CamTable of the Function Block MC_CamTableSelect.

  4. Execute the Function Block MC_CamTableSelect to process the data of the CAM table with the Function Block’s input parameters

  5. Additionally you can execute the Function Block MCA_CAM_EXTRA for optional parameters after the processing of the Function Block MC_CamTableSelect.

  6. Execute the Function Block MC_CamIn to start the slave axis movement according to the CAM table data and parameters.

    The axis will operate in the axis state Synchronized Motion.

  7. To leave the axis state you can execute the Function Block MC_CamOut.

    The axis state will switch to state Continuous Motion and maintains its last velocity as long as there is no other command.

  8. You can also use any other motion command interrupt the Synchronized Motion.

CAM table

CAM data is done with one table (two dimensional – describing master and slave positions together).

The data of the elements (array of data type MC_PProfile) can either be assigned within the declaration or can be assigned during runtime before the execution of the Function Block MC_CamTableSelect.

It can be filled with data in the following ways:

  • To use a predefined variable list.
  • To calculate the values within the program (before using the MC_CamTableSelect).
  • To send values by any communication access to the PLC.

In order to use the new data it is necessary to execute the Function Block MC_CamTableSelect again. In case the CAM table is executed the Function Block MC_CamTableSelect may not be executed.

Elements of the data type MC_PProfile: Central Motion Control (PLC-Based)

The inputs MasterSyncPosition and MasterSyncDistance of the Function Block MC_CamIn can be used to define a distance to synchronize the slave axis onto the CAM table during the start. In case master axis moves with negative velocity the parameter MasterSyncDistance can be negative. The MasterSyncPosition should always be within the range of the CAM table master position.

MasterSyncDistance = 0 will deactivate the synchronization. In this case the slave axis should be moved on the CAM curve before MC_CamIn is executed, otherwise a following error can occure.

../_images/791bf632b505366a0a331390001a2b76

CAM profile illustration

The master position in the CAM table must be strictly monotonic rising.

The length of a CAM table is just restricted by the memory size of the PLC. When long tables are used, it is recommended to call CamTableSelect in a task with lower priority as it will need a considerable computing time.

It is possible to hold several CamTables as a pool and to switch from one to another. This has to be done at matching positions as no means for synchronization are available.

The offset and scaling values (except the time-scale) are transferred continuously. This will allow to follow a “Moving Target” by adjusting these values.

The parameters at MC_CamTableSelect, MC_CamIn and function and MCA_CAM_EXTRA also modify the behavior:

Parameter MC_CamTableSelect Type Default value Comment
MasterAbsolute BOOL FALSE

TRUE=Master_position from MC_PProfile equals the master axis absolute position.

FALSE=CAM is executed relative to the master axis actual position at start.

SlaveAbsolute BOOL FALSE

TRUE=interpolation_point from MC_PProfile equals the slave axis absolute position.

FALSE=CAM is started from actual slave position. The values “interpolation_point” are relative to the slave axis position at start.

iType

Central Motion Control (PLC-Based)

MC_ABB_iTypes_ENUM   Interpolationtype.
Number_of_pairs INT   Number of points used in TimePosition Array.
Parameter MC_CamIn Type Default value Comment
MasterOffset LREAL 0

Just used with MasterAbsolute=TRUE, ignored otherwise.

Used position for cam-table is: Master axis position-Masteroffset.

SlaveOffset LREAL 0 Just used with SlaveAbsolute=TRUE, ignored otherwise. Used position is slave axis position=interpolation_point+Slaveoffset.
MasterScaling LREAL 1 The position used for interpolation is multiplied by MasterScaling, e.g MasterScaling=2”the scaled master will pass the position range with double velocity and within the half distance compared to it’s real velocity and position.
SlaveScaling LREAL 1 Interpolation result is multiplied by SlaveScaling, e.g SlaveScaling=2: Slave axis will run twice the distance.
MasterSyncPosition LREAL 0

Start synchronization at master axis position=MasterSyncPosition-MasterStartDistance+MasterOffset, meet the CamTable at master axis position=MasterSyncPosition.

In case of MasterAbsolute=FALSE: start at “actualPosition+MasterSyncPosition-MasterStartDistance”, meet the CamTable at “actualPosition+MasterSyncPosition”!!! It is just possible to use the “sync” mechanism when the axis is in StandStill on start.

MasterStartDistance LREAL 0 A negative value will create a reverse synchronization mode, which means the master should move in negative direction to synchronize. It is independent from the REVERSE-Bit which indicates how to end the movement.
These 2 parameters are “extras” to be written with the MCA_CAM_EXTRA function. When the parameters are used, the MCA_CAM_EXTRA has to be called after the MC_CamTableSelect.
PERIODIC BOOL TRUE for master “Modulo”, FALSE for master linear axis CamTable will not reach “EndOfProfile” but will be repeated periodically. When the master is a linear axis, it has to move forward and backward within the CamTable position range, but even when it leaves this position range, the CamTable will stay active.
REVERSE BOOL FALSE Just necessary when a CamTable is NOT “periodic” and will run in reverse direction (master with negative velocity) REVERSE=FALSE, the CamTable is ready when the master leaves the position range in positive direction, e.g. when it moves from 359º to 0º on a rollover axes REVERSE=TRUE, the CamTable is ready when the master leaves the position range in negative direction.

Example for CAM curve

../_images/24de53dfb51ea7e10a33139001ded927

In this example, the slave will run from 0 to 2000 while the master runs from 0 to 1000. The slave will start and end with velocity=0, no matter which velocity the master has during start. The slave will reach the maximum velocity when it is at position 1000 and the master is at position 500.

../_images/bd28fdf12c04ff690a331390004c68f1