MC_CamIn
Description
This function block is used to either initiate a new MC_CamIn move or to resume a previously programmed MC_CamIn move. Refer to MC_CamStartPos and MC_CamResumePos for information on positioning the slave axis prior to calling MC_CamIn.
There are two common options to stop camming after MC_CamIn has been called.
- MC_CamOut will continue motion at the instantaneous final actual velocity of the slave axis when it is called, and axis motion will continue at that final actual velocity.
- MC_Halt (with buffer mode input = 0) will decelerate axis motion to 0 speed and stop motion.
The master / slave relationship between the two axes is ended when MC_CamOut or MC_Halt is called.
-
-
Ending camming is also possible with other single axis function blocks such as MC_MoveRelative and MC_MoveAbsolute.
-
- This function block starts a motion-related action and therefore stores data for calculations and error checking. Please see Calling Function Blocks Multiple Times in the Same Cycle if you are using a dual-core controller.
Arguments
For more detail on how inputs and outputs work, refer to PLCopen Function Blocks - General Rules
Input
Execute | Description | Requests to queue the CamIn move |
Data type | BOOL | |
Range | 0, 1 | |
Unit | n/a | |
Master | Description | Name of a declared instance of the AXIS_REF library function (for more details, About Axis Name and Number) |
Data type | AXIS_REF | |
Range | 1 - 256 | |
Unit | n/a | |
Slave | Description | AXIS_REF.AXIS_NUM is the slave axis number |
Data type | AXIS_REF | |
Range |
1-256 |
|
Unit | n/a | |
MasterOffset | Description | Profile shift along the master axis. This input is not used if the StartMode input is set to 1 for Resume Mode. |
Data type | LREAL | |
Range | — | |
Unit | User unit | |
SlaveOffset | Description | Profile shift along the slave axis. This input is not used if the StartMode input is set to 1 for Resume Mode. |
Data type | LREAL | |
Range | — | |
Unit | User unit | |
MasterScaling | Description | Master axis profile range. This input is not used if the StartMode input is set to 1 for Resume Mode. Scaling must be a positive value that is greater than 0. |
Data type | LREAL | |
Range | — | |
Unit | User unit | |
SlaveScaling | Description | Slave axis profile range. This input is not used if the StartMode input is set to 1 for Resume Mode. Scaling must be a positive value that is greater than 0. |
Data type | LREAL | |
Range | — | |
Unit | User unit | |
Startmode | Description |
Starting mode of the cam profile.
This input indicates whether the axis should start a MC_CamIn move as an initial cam start (StartMode = 0) or if the axis should resume the most recently programmed MC_CamIn move (StartMode = 1).
It should be noted that in the case of Resume Mode (StartMode = 1) that the inputs MasterOffset, SlaveOffset, MasterScaling, and SlaveScaling are not used. The function block will use the values that were in effect during the most recently programmed MC_CamIn move for the slave axis. |
Data type | INT | |
Range | [0,1] | |
Unit | n/a | |
CamTableID | Description | ID number of the profile to be used with MC_CamIn |
Data type | INT | |
Range | — | |
Unit | n/a | |
BufferMode | Description | The Buffer mode for CamIn block. Valid values include: For more information see Buffer Modes. MC_BUFFER_MODE_BUFFERED may only be used when an endpoint is sepcified with the previous move. This limits the use of MC_BUFFER_MODE_BUFFERED to when the previous move is a point-to-point move (MC_MoveAbsolute or MC_MoveRelative). MC_BUFFER_MODE_ABORT may be used to abort an existing camming, gearing, point-to-point, or velocities move. |
Data type | SINT | |
Range | MC_BUFFER_MODE_ABORT, MC_BUFFER_MODE_BUFFERED | |
Unit | n/a |
Output
InSync | Description | Indicates the slave axis is in sync with the profile |
Data type | BOOL | |
Range | 0, 1 | |
Unit | n/a | |
Busy | Description | Indicates this function block is executing |
Data type | BOOL | |
Range | 0, 1 | |
Unit | n/a | |
Active | Description | Indicates this move is the Active move |
Data type | BOOL | |
Range | 0, 1 | |
Unit | n/a | |
CommandAborted | Description | Indicates the move was aborted |
Data type | BOOL | |
Range | 0, 1 | |
Unit | n/a | |
Error | Description | Indicates an invalid input, or the move was terminated due to an error |
Data type | BOOL | |
Range | 0, 1 | |
Unit | n/a | |
ErrorID | Description | Indicates the error if the Error output is high. |
Data type | INT | |
Range | — | |
Unit | n/a | |
EndOfProfile | Description | Indicates the end of profile has been reached. If the profile is periodic this output is set to ON for one ladder scan. If the profile is not periodic, the output remains ON while outside the range of the profile. |
Data type | BOOL | |
Range | 0, 1 | |
Unit | n/a |
Usage
The slave axis immediately locks on to the Cam Table profile.
The Master Offset is used to shift the profile along the master axis.
The Master Scaling defines the range of the profile along the master axis.
The Slave Offset is used to shift the profile along the Slave axis.
The Slave Scaling defines the range of the profile along the slave axis.
If the profile is periodic, when the end of profile reached, the profile continues at the start of the profile. The EndOfProfile output is ON for 1 ladder scan.
If the profile is not periodic, when the end of profile is reached, the slave axis stops and remains at the end of the profile until the master axis returns to within the profile range as defined by MasterScaling. The EndOfProfile output remains ON anytime the master axis is outside of the profile range.
Adjustments computation is done as follows:
When cam is first started, offsets are adjusted if necessary
- If slave is not absolute, then slave offset = slave offset + starting position
- If master is not absolute, then master offset = master offset + starting position.
- Master position for profile = master position - master offset
- Use master position for profile table to obtain slave profile position
- Slave commanded position = slave profile position + slave offset
Dynamically Changing a Cam Profile
MC_CamIn can be used to dynamically change from one cam profile to another. Care must be taken when doing this to avoid unexpected motion.
-
-
Some tips for dynamically changing cam profiles:
- Verify that the first cam’s last position and the replacement cam’s first position are the same. Note: Offsets as set byMC_CamTblSelect will affect actual cam position.
- Verify that the first cam’s last velocity and the replacement cam’s first velocity do not cause any unexpected motion.
- Jumps can be eliminated by defining the present cam as Cyclic and defining the replacement cam as an Absolute Master and Slave, as set by the MC_CamTblSelect inputs. This eliminates any possible small error accumulating when the cam is switched.
Related Functions
Examples
Structured Text
(* MC_CamIn ST example *) //Inst_MC_CamIn is an instance of MC_CamIn
Inst_MC_CamIn( CamStartBool, Axis1, Axis2, 0.0, 0.0, 360.0, 360.0, 0, CamTableID, 0 );
Ladder Diagram
The three following examples utilizes the screen shot below showing the cam profile “MyProfile”
Figure 7-139: MC_CamIn examples
Example 1
Profile |
MyProfile |
|
Cycle |
NO |
|
MasterAbsolute |
YES |
|
SlaveAbsolute |
YES |
|
MasterOffset |
0.0 |
|
SlaveOffset |
0.0 |
|
MasterScaling |
360.0 |
|
SlaveScaling |
360.0 |
|
|
|
|
Initial Master position |
0.0 |
|
Initial Slave position |
180.0 |
After MC_CamTblSelect
and MC_CamIn
are programmed with the above parameters, the slave axis is locked on to the profile. Since both have zero offsets, the profile is not shifted in either axis. The initial condition of the master axis at position 0, yields a slave command position of 180.0. As the master axis moves positive, the slave position follows the profile. When the master position is at 90.0, the slave is commanded to 324.0 (see curve below where in = 90, out = 324). The slave follows the profile as the master axis moves until the master axis reaches a position of 360.0. At this time the slave is commanded to 180.0.
If the master were to continue to move past 360.0 the slave commanded position would remain at 180.0 since the Cyclic input is false. If the master moves negative and its position returns to less than 360.0, then the slave follows the profile again.
Example 2
Profile |
MyProfile |
|
Cycle |
YES |
|
MasterAbsolute |
NO |
|
SlaveAbsolute |
NO |
|
MasterOffset |
0.0 |
|
SlaveOffset |
0.0 |
|
MasterScaling |
360.0 |
|
SlaveScaling |
360.0 |
|
|
|
|
Initial Master position |
180 |
|
Initial Slave position |
90.0 |
After MC_CamTblSelect
and MC_CamIn
are programmed with the above parameters, the slave axis is locked on to the profile. Since the both axes have zero offsets, the profile is not shifted in either axis. Neither the MasterAbsolute nor SlaveAbsolute input is on, so the profile is relative to the axes initial positions. Specifically, the initial condition of the master axis at position 180 would represent a master profile position of 0 (180-180). This yields a slave command position of 270 (180 + 90). As the master axis moves positive, the slave position follows the profile. When the master position is at 270, the slave is commanded to 414.0 (324 + 90). The slave follows the profile as the master axis moves until the master axis reaches a position of 540. At this time the slave is commanded to 270.0 (180 + 90).
If the master continues to move past 540.0, the slave commanded position follows the profile from the beginning since the Cyclic input is TRUE. When the master reaches a position of 630, the slave is commanded to a position of 414.0 (324 + 90).
Example 3
Profile |
MyProfile |
|
Cycle |
NO |
|
MasterAbsolute |
YES |
|
SlaveAbsolute |
YES |
|
MasterOffset |
90 |
|
SlaveOffset |
-180 |
|
MasterScaling |
360.0 |
|
SlaveScaling |
360.0 |
|
|
|
|
Initial Master position |
180 |
|
Initial Slave position |
144 |
After MC_CamTblSelect
and MC_CamIn
are programmed with the above parameters, the slave axis is locked on to the profile. Since the both axes have offsets, the profile is shifted along both axes. Specifically the master axis is shifted 90, and the slave axis is shifted -180. Initially the master axis position of 180 yields a master position for the profile calculation of 90 (master position 180 - Master offset 90), which yields a slave command position of 144 (slave profile command 324 + slave offset (-180)). As the master axis moves positive, the slave position follows the profile. When the master axis position is at 270, the master position for profile calculation is 180 (270 - 90). This yields a slave command position of 0 (180 + (-180)).
The slave follows the profile as the master axis moves until the master axis reaches a position of 450. The master axis position of 450 yields a master position for profile calculation of 360 (450 - 90). The slave command position is 0 (180 + (-180)).
When the master reaches a position of 450, the slave commanded position remains at 0 since the Cyclic input is false.