MLMotionInit

PLCopen motion icon Pipe Network motion icon

 Function - Initializes the motion library.

Inputs

Input

Data Type

Range

Unit

Default

Description

Enable

BOOL

FALSE, TRUE

N/A

FALSE

Enable function.

BasePeriod

LREAL

Minimum: 125

Microseconds

1000

Duration of one motion cycle.

  • With the EtherCAT Motion Bus:
    • The EtherCAT cycle time overrides the BasePeriod argument (the cycle time is defined in the EtherCAT Master Settings tab).
    • The EtherCAT cycle time becomes the base cycle time for the Motion Engine.
  • Without the EtherCAT Motion Bus:
    • The BasePeriod argument establishes the base cycle time (in microseconds) for the Motion Engine when running simulations

Outputs

Output

Data Type

Range

Unit

Description

Q

BOOL

FALSE, TRUE

N/A

  • Output is set to high with initial successful execution.
  • It remains high until the function does NOT execute successfully.

Remarks

  • Must be called before any other Motion Library function.
  • Returns TRUE if the function succeeded.

FBD Language Example

FFLD Language Example

IL Language Example

Not available.

ST Language Example

//Initialization code to start EtherCAT network.

//First initialize network with MLMotionInit command

//Then wait for command to finish by monitoring MLMotionStatus output

//Once initialized, create any cam profiles and PLCopen or Pipenetwork devices

//Then call MLMotionStart and monitor MLMotionStatus again before beginning rest of program

FirstCycle := TRUE;



On FirstCycle DO //Initialize the motion engine

MLMotionInit( 1000);

END_DO;



MotionEngineStatus := MLMotionStatus();//Check the current status of the motion engine

//Once motion engine is initialized, create CAM profiles and defined Axis, then start the motion engine

ON MotionEngineStatus = MLSTATUS_INITIALISED DO

Profiles( MLPR_CREATE_PROFILES );

PLCopen( 0 );

MLMotionStart();

END_DO;



IF MotionEngineStatus = MLSTATUS_RUNNING THEN

bMotionEngineStarted := TRUE;

ELSE

bMotionEngineStarted := FALSE;

END_IF;