Mitsubishi Electric MELSEC iQ-R C Series Programming Manual page 55

Controller module
Table of Contents

Advertisement

A default value is stored in input variables, output variables, and public variables by creating an MCFB
instance. Programming can be shortened by setting input variables only for variables required to be changed
from the default value.
Execution procedure
The following shows the procedure for executing the Enable-type MCFB (MC_Power) using a motion module dedicated class.
The procedure is the same as when executing the Execute-type MCFB. Before using the motion module dedicated class,
make sure to fully understand the MCFB specifications which correspond to each instruction class.
When executing an Enable-type MCFB
Set 'TRUE' for the input variable 'Enable' and then execute the FB. After that, wait for the output variable 'ReadyStatus' to
change to 'TRUE.'
Then, set 'FALSE' for the 'Enable' and wait for the 'ReadyStatus' to change to 'FALSE.'
void mcPower_Test (void){
short sRet = 0;
unsigned short usData = 0;
/*Generate an MCFB instance*/
MC_Power mcPower;
/*Turn ON the PLC READY of motion module*/
sRet = CCPU_Y_Out_BitEx( 0, 0x0000, TRUE);
if( sRet != 0 ){
return;
}
taskDelay(10);
/*Motion module preparation completed*/
sRet = CCPU_X_In_BitEx( 0, 0x0000, &usData);
if( (sRet != 0) || (sData == FALSE) ){
return;
}
/*Set I/O variables and input variables of a member variable*/
mcPower.Axis.AxisNo = 1;
mcPower.Axis.StartIO = 0x0000;
mcPower.ServoON = TRUE;
/*Servo ON*/
/*Set I/O variables and input variables to the motion module and execute the MCFB*/
sRet = mcPower.SetEnable(TRUE);
if( sRet != 0 ){
return;
}
/*Refresh I/O variables, output variables, and public variables*/
while(1){
sRet = mcPower.RefreshLabels();
/*Check that the MCFB processing is completed*/
if( sRet == 0 ){
if( mcPower.Error ==FALSE){
if(mcPower.ReadyStatus == TRUE){
break;
}
}else{
break;
}
}else{
return;
}
1 COMMON ITEMS
1.4 Motion Module Dedicated Class
1
53

Advertisement

Table of Contents
loading

Table of Contents