Ladder: Servo & Motion Control Functions

Servo Ladder Functions

UniLogic provides:

COM: Servo Functions

Servo functions allow a PLC Ladder program to exchange configuration data between three entities.

Entity

Description

PLC Drive's Struct

The PLCs internal memory structure that holds a complete copy of the servo drive's parameters for a given axis

Servo Drive

The physical CANopen servo drive connected to the network

Configuration File

A file stored on the PLC file system containing a saved snapshot of a servo configuration

All operations that communicate with the drive are asynchronous: the function sets the status to ACTION_STATUS_PENDING immediately, and updates it to ACTION_STATUS_SUCCESSFUL (or an error code) when the operation completes.

These functions may be considered as groups. They are listed under COM: Servo in the Ladder Toolbox.

Group 1: Servo Configuration (Read/Write via Ladder)

These functions transfer complete configuration sets between the PLC Drive's Struct, the physical Servo Drive, and the Configuration Files stored on the PLC file system.

 

Servo Read Configuration

Data flow: Servo Drive → PLC Drive's Struct

This FB reads the complete set of parameters from the Servo Drive and stores them in the PLC Drive's Struct.

The function queries every readable parameter from the physical drive one by one. As each response arrives, the value is stored in the corresponding field of the PLC Drive's Struct. When all parameters have been read, the struct is fully up to date with the drive's actual current state.

 

Parameter Name

Purpose

A

Servo

Select the target servo axis

B

Status

Indicates the function status code

Result:

Typical use cases:

Note: This operation reads every parameter sequentially and takes time proportional to the number of parameters. It does not modify the configuration file.

 

Servo Write Configuration

Data flow: PLC Drive's Struct → Servo Drive

This FB downloads the complete set of parameters from the PLC Drive's Struct to the servo drive.

The function iterates through every writable parameter in the drive's parameter map and sends each value from the PLC Drive's Struct to the drive. Each write is acknowledged before the next is sent. When complete, the drive's configuration exactly matches what the PLC Drive's Struct holds.

 

Parameter Name

Purpose

A

Servo

Select the target servo axis

B

Status

Indicates the function status code

Result:

Typical use cases:

Note: Writes every parameter sequentially. For changing just one or a few parameters, prefer Write Parameter (Indirect) or Write Modified Parameters.

 

Servo Load Configuration From File

Data flow: Configuration File → PLC Drive's Struct

This FB loads a saved servo configuration file from the PLC file system into the PLC Drive's Struct.

The specified file is read and its parameter values are copied into the PLC Drive's Struct for that axis. The file name is also remembered internally, enabling a subsequent Store Configuration To File call to know which file to overwrite. The servo drive is not contacted during this operation.

 

Parameter Name

Purpose

A

Servo

Select the target servo axis

B

File Name

Name of the configuration file to load

C

Status

Indicates the function status code

Result:

Typical use cases:

Note: This is a file-to-memory operation only. To apply the loaded values to the physical drive, follow with Write Configuration. The file is tagged with the drive type; loading a file saved for a different drive type is rejected.

 

Servo Store Configuration To File

Data flow: PLC Drive's Struct → Configuration File

This FB saves the current contents of the PLC Drive's Struct back to the configuration file that was previously loaded.

The function takes all parameter values currently in the PLC Drive's Struct and writes them to the file on the PLC file system, overwriting the previous contents. The file name used is the one that was established by the last Load Configuration From File call.

 

Parameter Name

Purpose

A

Servo

Select the target servo axis

B

Status

Indicates the function status code

Result:

Typical use cases:

Note: A prior Load Configuration From File call is required - it establishes the target file name and the expected data size. Without it, this function returns ACTION_STATUS_NO_PREVIOUS_LOAD

 

Servo Write Modified Parameters

Data flow: Configuration File → Servo Drive (directly)

This FB applies only the parameters that differ from the default configuration to the servo drive - without going through the PLC Drive's Struct.

A pre-generated configuration file contains a compact list of which parameters were changed and what their new values are. The function reads that file and sends only those modified parameters to the drive, skipping all others. This is faster than a full configuration download when only a small number of settings differ from the baseline.

 

Parameter Name

Purpose

A

Servo

Select the target servo axis

B

File Name

Name of the modified parameters file

C

Status

Indicates the function status code

Result:

Typical use case: Apply a targeted set of user-customized settings to the drive - efficient when the majority of parameters remain at their default values.

Note: The modified parameters file is generated by UniLogic when the user saves a customized configuration; it must already exist on the PLC file system. The PLC Drive's Struct is not updated by this operation.

 

Group 2: Read/Write Parameters to the Servo Drive

These functions read or write a single parameter at a time. They are faster than a full configuration transfer when only a few settings need to be inspected or changed. All four functions mirror the result into the PLC Drive's Struct to keep it consistent with the drive.

 

Servo Read Parameter (Direct)

Data flow: Servo Drive → PLC Drive's Struct (single parameter)

This FB reads the current value of one specific parameter from the servo drive - identical in effect to Read Parameter (Indirect), but the parameter is identified directly rather than by group and index.

Instead of specifying a group number and parameter number that the system resolves internally, the caller passes a direct reference to the exact member within the PLC Drive's Struct that should receive the result. The function reads that parameter from the drive and writes the value straight into that struct member.

 

Parameter Name

Purpose

A

Servo Parameter

A direct reference to the specific field in the PLC Drive's Struct to read into

B

Status

Indicates the function status code

Result:

Typical use case: When the exact parameter location in the struct is already known at design time and hardcoded into the Ladder logic - no need to go through group/index resolution.

Note: Functionality equivalent to Read Parameter (Indirect); the only difference is how the parameter is addressed. The parameter must have read permission; otherwise returns ACTION_STATUS_WRONG_PERMISSION

 

Servo Read Parameter (Indirect)

Data flow: Servo Drive → PLC Drive's Struct (single parameter)

This FB reads the current value of one specific parameter from the servo drive.

The parameter is identified by its group number and parameter number within that group. The drive is queried for that single value, and the result is written back into both the caller-provided variable and the corresponding field in the PLC Drive's Struct.

 

Parameter Name

Purpose

A

Servo

Select the target servo axis

B

Group Index

The parameter group (category)

C

Parameter Index

The specific parameter within that group

D

Read Value

Where to store the result

E

Status

Indicates the function status code

Result:

Typical use case: Inspect the live value of a specific drive setting without reading the full configuration.

Note: The parameter must have read permission; otherwise returns ACTION_STATUS_WRONG_PERMISSION

 

Servo Write Parameter (Direct)

Data flow: PLC Drive's Struct → Servo Drive (single parameter)

This FB writes a new value to one specific parameter on the servo drive - identical in effect to Write Parameter (Indirect), but the parameter is identified directly rather than by group and index.

Instead of specifying a group number and parameter number, the caller passes a direct reference to the exact member within the PLC Drive's Struct whose value should be sent to the drive. The function takes the current value of that struct member and writes it to the corresponding parameter on the drive.

 

Parameter Name

Purpose

A

Servo Parameter

A direct reference to the specific field in the PLC Drive's Struct whose value to write

B

Value to Write

The new value to write to the drive

C

Status

Indicates the function status code

Result:

Typical use case: When the exact parameter location in the struct is already known at design time and hardcoded into the Ladder logic - the programmer works directly with known struct members rather than navigating via group/index.

Note: Functionality equivalent to Write Parameter (Indirect); the only difference is how the parameter is addressed. The parameter must have write permission; otherwise returns ACTION_STATUS_WRONG_PERMISSION

 

Servo Write Parameter (Indirect)

Data flow: PLC Drive's Struct → Servo Drive (single parameter)

This FB writes a new value to one specific parameter on the servo drive.

The function identifies the parameter by group and parameter number, then sends the provided value to the drive. Once the drive acknowledges, the new value is also mirrored into the PLC Drive's Struct, keeping it consistent with the drive.

 

Parameter Name

Purpose

A

Servo

Select the target servo axis

B

Group Index

The parameter group (category)

C

Parameter Index

The specific parameter within that group

D

Value to Write

The new value to write to the drive

E

Status

Indicates the function status code

Result:

Typical use case: Adjust a single drive setting (e.g., a gain or a limit) on the fly without downloading the full configuration.

Note: The parameter must have write permission; otherwise returns ACTION_STATUS_WRONG_PERMISSION

 

  • Note that the input parameters of the Read/Write Direct functions listed above must be linked to the specific parameter in the drive's struct.

Related Topics

EtherCAT Motion

CANopen Motion

Axis Structs

UMD Servo Firmware Update

MC Function Blocks

Multi-Axes MC Functions (EtherCAT)

Servo: Ready-made Motion Code

Motion: Diagnostics & Tuning

Servo Motion Complete Error Codes

Axis Homing Methods