Industrial Automation
Industrial Automation | Europe


Main > Product Type > Software > Programming
Minimize Text   Default    Enlarge Text


CJ2M-MD211/MD212 Function Block For Move Sequence


This article provides details for the use and application of the Move Sequence function block.  Using this function block with the CJ2M-MD21/MD212 provides an easy means of controlling a servo's position in a sequential manner.

This function block can be of particular use in PLC-based motion control applications often found in packaging machinery. To download a machine case study of a packaging application that controls servos with the CJ2-Series Pulse Output Unit, visit the packaging solutions area.


Name Sequential Positioning: MD_CPU120_MoveSequence
Basic Function Performs positioning sequentially.
Originates from Tsunagi Lab Europe
Created by OEE-HQ HvB (creation and testing)
File Name MD_CPU120_MoveSequence_DINT.cxf
Applicable models CPU Unit CJ2M-CPU Unit version 2.0 or higher with max. two
CJ2M-MD211 (NPN) or
CJ2M-MD212 (PNP)
CX-Programmer Version 9.1.2 or higher
Conditions for usage None.
Function Description When Start (Execute) turns ON, positioning will be consecutively performed on the output specified with the Axis No. (Axis) using Operation Data (Operation modes, ABS/INC modes, Acceleration rate, Deceleration rate, Target frequency, and Position command in DM Area starting from the First operation data word (DataAreaNo).
The number of starting operation data should be selected by specifying Starting operation No. (OperationNo).
Sequential positioning will be continued reading Operation Data in DM Area from the number set in First Operation Data word (DataAreaNo) until Operation mode (word n, bit 00 to 03) becomes 0 Hex (Single positioning mode).
The Positioning completed (Done) will turn ON when positioning by this FB is completed. It will not turn ON when another instance causes a deceleration stop, or when an error interrupts an operation.
The Operation No. in execution (ExecutionNo) reflects the Operation No. currently being executed.
When an operation is stopped with a deceleration stop or an emergency stop, Abort (CommandAborted) will turn ON.
When an error flag in the unit is detected, the Error flag (Error) will be turned ON if the operation data is invalid due to some errors such as commands out of range.
The Error flag (Error) will be turned ON and Error code (ErrorID) will be output when an error related to this FB occurs. They will not be set with an error for other FBs or other instances.
These statuses, Positioning completed (Done)/ Abort (CommandAborted)/ Error flag (Error)/ Error code (ErrorID), will be reset when Start (Execute) is turned OFF. If Start (Execute) was turned OFF before positioning is completed, the status will be set for at least one cycle when a corresponding condition occurs.


Kind of FB definition Connect Always ON type
  Connect the EN input to the Always ON Flag (P_ON).
  The same instance cannot be used in two or more places.
FB Precautions • Executing another FB or instance during execution of this FB will cause the multiple start function. In operations using the multiple start function, this FB does not detect interruptions, which may allow this FB’s processing to interrupt processing of another FB or instance. To cancel this FB’s processing, do so by stopping the operation with a deceleration stop and confirming that Abort (CommandAborted) is ON. For details, refer to the manual listed in ‘Related manuals’ in the following page.
• To cancel this FB’s processing, use INI(880) instruction or ACC(888) instruction (discrete).
Using Deceleration stop FB of FBL (MD_CPU061_Stop_REAL/MD_CPU062_Stop_DINT) may not stop an axis as the deceleration stop command is multiply-started due to this FB.
When using ACC(888) instruction (discrete) to stop an axis, execute ACC(888) instruction (discrete) until an axis stops completely. Refer to ‘Application example’.
• When using the Pulse output 0&1 or 2&3 simultaneously, use the same Pulse output method for them.
• Do not execute the following FB for a same axis while executing this FB. The processing of the following FB does not operate normally as it is multiply-started due to this FB.

The MD_CPU* function blocks are offered 'as is' and may serve as a basis for development. Users should previously test its adequacy to the final application.

Omron can not be held responsible in case of malfunction.

EN input condition  • Connect the EN input to the Always ON Flag (P_ON).
 • If a different type of bit is connected to EN, the FB outputs will be maintained when the connected bit is turned OFF.
Restrictions other ■ Operation Data Setting
• Set Operation Data in the DM Area.
• This FB cannot be executed when an origin is not established. Even when using only Relative Movement, it cannot be executed without establishing an origin.
• This FB cannot be started when the pulse output specified in “Axis No.” outputs pulse.
• An operation data will cause an error if the target position is out of the following range, -2,147,483,648 to +2,147,483,647.
• 7 consecutive words of the DM Area are used as one Operation Data containing Operation modes, ABS/INC modes, Acceleration rate, Deceleration rate, Target frequency, and Position command.
• When the Sequential position mode is selected, the following operation data is referred. When Operation modes, ABS/INC modes or Position command causes an error, the operation will stop at one data before the invalid one. When Acceleration rate, Deceleration rate or Target frequency causes an error, the operation will stop at an invalid data.
Ex.1: When the setting value in the Operation Data 8 is valid with the Sequential position mode, and the Operation mode in the Operation Data 9 contains an invalid data, an operation will stop at the Operation data 8.
Ex.2: When the setting value in the Operation Data 8 is valid with the Sequential position mode, and the Target frequency in the Operation Data 9 contains an invalid data, an operation will stop at the Operation data 9.
• If a constant speed cannot be maintained in sequential positioning, an error will occur.
• An operation will be stopped with deceleration when an error, such as Limit input, occurs.
Operation Data Word Name Setting range
 n+000  Bit 00 to 03 Operation mode 0(Hex) Single positioning mode
1(Hex) Sequential position mode
 Bit 04 t0 07 ABS/INC mode 0(Hex) Relative pulse output
1(Hex) Absolute pules output
 Bit 08 to 15 (Not used) Fixed at 00(Hex)
 n+001  Acceleration rate
1 to 65535Hz (0001 to FFFF Hex)
 n+002 Deceleration rate 1 to 65535Hz (0001 to FFFF Hex)
 n+003  Target frequency (lower word) 1 to 100000Hz (0000001 to 000186A0 Hex)
 n+004  Target frequency (upper word)
 n+005  Position command (lower word) Absolute: -2,147,483,648 to +2,147,483,647 (80000000 to 7FFFFFFF Hex)
Relative: -2,147,483,648 to +2,147,483,647 (80000001 to 7FFFFFFF Hex) (+: CW, -: CCW)
n+006 Position command (upper word)
 n+007 Operation, ABS/INC modes  Same as Operation Data 1
n+008 Acceleration rate
n+009 Deceleration rate
n+010 Target frequency (lower word)
n+011 Target frequency (upper word)
n+012 Position command (lower word)
n+013 Position command (upper word)
 ... ...  
 n+441 Operation, ABS/INC modes  Same as Operation Data 1.
Note that, however, Single positioning mode is used even if the Sequential position mode is set in the Operation mode (Selecting the Sequential position mode does not cause an error, though).
n+442 Acceleration rate
n+443 Deceleration rate
n+444 Target frequency (lower word)
n+445 Target frequency (upper word)
n+446 Position command (lower word)
n+447 Position command (upper word)
Application example Set the operation data referring to settings of Operation Data in ‘Restrictions Other’.
When the Start trigger turns from OFF to ON, the Servomotor connected to the Pulse output 0 on the CJ2M-MD21* Unit will start operating based on the specified Operation Data.
When an operation is to be stopped intentionally with an Emergency stop switch, Bit X is turned ON.

CH No. Data Description
DM01000 #0001 Sequential position mode/ Relative pulse output Operation data 01
DM01001 &100 Acceleration rate
DM01002 &100 Deceleration rate
DM01003, DM01004 &1000 Target frequency (lower /upper word)
DM01005, DM01006 +3000 Position command (lower /upper word)
DM01007 #0001 Sequential position mode/ Relative pulse output Operation data 02
DM01008 &1000 Acceleration rate
DM01009 &1000 Deceleration rate
DM01010, DM01011 &5000 Target frequency (lower /upper word)
DM01012, DM01013 +10000 Position command (lower /upper word)
DM01014 #0001 Sequential position mode/ Relative pulse output Operation data 03
DM01015 &1000 Acceleration rate
DM01016 &1000 Deceleration rate
DM01017, DM01018 &10000 Target frequency (lower /upper word)
DM01019, DM01020 -20000 Position command (lower /upper word)
DM01021 #0001 Sequential position mode/ Relative pulse output Operation data 04
DM01022 &1000 Acceleration rate
DM01023 &1000 Deceleration rate
DM01024, DM01025 &3000 Target frequency (lower /upper word)
DM01026, DM01027 -5000 Position command (lower /upper word)
DM01028 #0010 Sequential position mode/ Relative pulse output Operation data 05
DM01029 &10 Acceleration rate
DM01030 &10 Deceleration rate
DM01031, DM01032 &3000 Target frequency (lower /upper word)
DM01033, DM01034 +1000 Position command (lower /upper word)
Related manuals CJ2M Pulse I/O User Manual (W486)
CJ2 Hardware User Manual (W472)
  • Variable Table 

Input Variables

Name Variable name Data type Default Range Description
EN EN BOOL     1 (ON): Starts FB
0 (OFF): Does not start FB
Axis No. Axis INT &0 &0 to 3 &0: Pulse output 0, &1: Pulse output 1
&2: Pulse output 2, &3: Pulse output 3
First Operation Data word DataAreaNo INT &0 &0 to &32767 Specify the first address of the words in the DM Area containing Operation Data.
Start Execute BOOL 0 (OFF)   OFF -> ON (rising edge) starts sequential positioning
Starting operation No. OperationNo INT &1 &1 to &64 Specify the Operation Data No., based on which sequential positioning is started.
Pulse output method OutPulseSelect INT &0 &0 to &1 &0: CW/CCW output
&1: Pulse + direction output

Output Variables

Name Variable name Data type Range Description
ENO ENO BOOL   1 (ON): FB operating normally
0 (OFF): FB not operating normally
Positioning completed Done BOOL   1 (ON) indicates that sequential positioning is completed
Abort CommandAborted BOOL   1 (ON): Aborted
Error flag Error BOOL   1 (ON) indicates that an error has occurred in the FB.
Error code (May be omitted) ErrorID WORD   The error code of the error occurred in the FB will be output. For details of the errors, refer to the sections of the manual listed in the Related manuals above. When the specified Axis No. is out of the range, #0000 will be output.
Operation No. in execution ExecutionNo INT   &0: Start (Execute) = 0 or Positioning completed (Done) = 1
&1 to &64: Indicates the Operation Data No. currently being executed.

Revision History

Version Date Contents
1.00 17-Feb-2012 Based on Function Block: _NCCPU120_MoveSequence


This article is a reference that explains the function block functions. It does not explain the operational limitations of Units, components, or combinations of Units and components. Always read and understand the Operation Manuals for the system’s Units and other components before using them.



Comments (View All Comments / Add Comment)

Related Articles
No related articles found.
Created 2012-02-17
Modified 2014-03-13
Views 4977


You are not logged in.