Write Parameters with MC_WriteParameter
MC_WriteParameter is used to write a value to a specific parameter of the selected axis. Parameter is written on the rising edge of the Execute input.
-
LS_Connect must be executed before this function block can be used.
-
The examples in this topic can be found in the XMC_SingleAxis_FBs.zip downloadable from Example Applications.

Element Name | Element Type | Description |
---|---|---|
Execute | Input | Edge detected request to execute the function block. |
Axis | Input/Output | Axis reference variable. This can not be a constant. |
ParameterNumber | Input | Specify the number of the parameter to write. See Parameter Number table for parameter numbers. |
Value | Input | Value to write to the parameter. |
ExecutionMode | Input |
0 – Change the parameter immediately. 1 – Change the parameter after the currently executing function block is done. |
Done | Output | Indicates function block has written to the parameter successfully. |
Busy | Output | Indicates the function block is currently being executed. |
Error | Output | Indicates whether an error occurs or not. |
ErrorID | Output | Error Identification number. |

No. | Parameter | Item | Note | OS** |
---|---|---|---|---|
0 | Basic Setting | Unit | 0: pulse, 1: mm, 2: inch, 3:degree | - |
1 | 1 Pulse per revolution | 1 ~ 4,294,967,295[pulse] | - | |
2 | 1 Travel per rotation | 0.000000001 ~ 4,294,967,295 [Unit] | - | |
3 | Speed command unit | 0: Unit/sec, 1: Unit/min, 2: rpm | - | |
4 | Speed limit value | LREAL Positive number [Unit/s, rpm] Change according to Unit, Pulses per rotation, Travel per rotation, Speed command unit | - | |
5 | Emergency stop deceleration | 0 or LREAL Positive number [Unit/s2] | - | |
6 | Encoder select | 0:Incremental Encoder,1:Absolute Encoder | - | |
7 | Gear ratio (Motor) | 1 ~ 65,535 | - | |
8 | Gear ratio (Machine) | 1 ~ 65,535 | - | |
9 | Operation mode of the reverse rotation | 0: Deceleration stop, 1: Prompt stop | - | |
46 | Position Control Range Expansion | 0: Disable, 1: Enable | - | |
47 | Operation mode of Speed Control | 0: CSP(Cyclic Sync. Position), 1: CSV(Cyclic Sync. Velocity) | - | |
48 | Coordinate Systems Operation maximum allowable acceleration | 0 or LREAL Positive number [Unit/s2] | - | |
49 | Coordinate Systems Operation maximum allowable deceleration | 0 or LREAL Positive number [Unit/s2] | - | |
27 | NC Spindle Control Setting | Identifying range to reach the spindle rotation command speed | 0~100% | - |
28 | Identifying RPM to reach the spindle rotation zero speed | 0 ~ 100rpm | - | |
30 | NC Spindle | Select the Spindle Encoder |
0: Not Use 1: Motor ENC 2: Built-in ENC1 3: Built-in ENC2 4: EtherCAT ENC |
V1.30 |
10 | Expansion Setting | S/W upper limit | LREAL* [units] | - |
11 | S/W low limit | LREAL* [units] | - | |
12 | Infinite running repeat position | LREAL Positive number [Unit] | - | |
13 | Infinite running repeat | 0:disabled,1:enabled | - | |
14 | Command Inposition range | 0 or Long real (LREAL) positive number*1) [Unit] | - | |
15 | Exceeding value of tracking error | 0 or Long real (LREAL) positive number*1) [Unit] | - | |
16 | Current position compensation amount | 0 or Long real (LREAL) positive number*1) [Unit] | - | |
17 | Current speed filter time constant | 0 ~ 100 | - | |
18 | Error reset monitoring time | 1 ~ 1000 [ms] | - | |
19 | S/W limit during speed control | 0: Not detect , 1: detect | - | |
20 | Tracking error level | 0: Warning, 1: Alarm | - | |
21 | Jog high speed | LREAL Positive number (Jog low speed ~speed limit ) [Unit/s] | - | |
22 | Jog low speed | LREAL Positive number ( < Jog high speed) [Unit/s] | - | |
23 | JOG Acceleration | 0 or LREAL Positive number [Unit/s2] | - | |
24 | JOG Deceleration | 0 or LREAL Positive number [Unit/s2] | - | |
25 | JOG Jerk | 0 or LREAL Positive number [Unit/s3] | - | |
26 | Override mode | 0: Specified by ratio, 1: Specified by unit | - | |
29 | Backlash compensation amount | 0 or Long real (LREAL) positive number*1) [Unit] | V1.30 | |
31 | Axis Setting | Number of pulses per rotation of the spindle EtherCAT encoder | 1 ~ 4294967295 | V1.30 |
32 | Spindle EtherCAT encoder position variable | 0: I device, 1: M device | V1.30 | |
33 | Spindle EtherCAT encoder position address | 0~4095 (Spindle EtherCAT encoder position variable = 0: I) 0~524287 (Spindle EtherCAT encoder position variable = 1: M) | V1.30 | |
34 | The P Gain of the Spindle Positioning Mode | 1~500 Hz | V1.30 | |
35 | The Feed Forward Gain of the Spindle Positioning Mode | 0~100 % | V1.30 | |
36 | NC Spindle Home Setting | How to conduct the homing operation | 0: Servo drive supported, 33:Reverse direction, Z phase, 34: Forward direction, Z phase, 35: Set the homing of the current position | V1.30 |
37 | Switch navigation speed of the homing operation | LREAL Positive number | V1.30 | |
38 | Zero navigation speed of the homing operation | Zero navigation speed of the origin operation ≤ Switch navigation speed of the origin ≤ Limit value of speed | V1.30 | |
39 | Acceleration/deceleration of the homing operation | 0 or LREAL Positive number [Unit/s2] | V1.30 | |
40 | Z phase variable | 0: I device, 1: M device | V1.30 | |
41 | Z phase address |
0~131071 (Z phase variable = 0: I) 0~16777215 (Z phase variable = 0: M) |
V1.30 | |
42 | Orientation velocity | Long real (LREAL) positive number*) (≤ Limit value of speed) | V1.30 | |
43 | Orientation direction | 0:forward direction , 1:reverse direction | V1.30 | |
44 | Orientation offset | 0~360 | V1.30 | |
100 | Built-in Encoder Setting | Encoder 1 unit | 0: pulse, 1: mm, 2: inch, 3:degree | - |
101 | Encoder 1 pulse per rotation | 1 ~ 4,294,967,295[pulse] | - | |
102 | Encoder 1 travel per rotation | 0.000000001 ~ 4,294,967,295 [Unit] | - | |
103 | Encoder 1 pulse input |
0:CW/CCW 1 multiplier, 1:PULSE/DIR 1 multiplier 2: Pulse/Dir 2 multiplier, 3: Phase A/B 1 multiplier 4: Phase A/ B 2 multiplier, 5: Phase A/B 4 multiplier |
- | |
104 | Encoder 1 max. value | (Encoder1 min. value + 1) ~ 2147483647 | - | |
105 | Encoder 1 Min. value | -2147483648~(Encoder1 Max. value-1) | - | |
106 | Encoder 1 input filter value |
0: Disable 1: 500kPPS 2: 200kPPS 3: 100kPPS 4: 10kPPS 5: 1kPPS 6: 0.1kPPS |
- | |
107 | Encoder 1 Speed unit | 0: Unit/sec, 1: Unit/min, 2: rpm | V1.10 | |
108 | Encoder 1 position filter time constant | 0 ~ 1000 ms | V1.10 | |
109 | Encoder 1 Position Latch | 0: Disable, 1: Able | V1.40 | |
200 | Encoder 2 unit | 0: pulse, 1: mm, 2: inch, 3:degree | - | |
201 | Encoder 2 1 pulse per rotation | 1 ~ 4,294,967,295[pulse] | - | |
202 | Encoder 2 1 travel per rotation | 0.000000001 ~ 4,294,967,295 [Unit] | - | |
203 | Encoder 2 pulse input |
0:CW/CCW 1 multiplier 1:PULSE/DIR 1 multiplier 2: Pulse/Dir 2 multiplier 3: Phase A/B 1 multiplier 4: Phase A/ B 2 multiplier 5: Phase A/B 4 multiplier |
- | |
204 | Encoder 2 max. value | (Encoder2 min. value + 2) ~ 2147483647 | - | |
205 | Encoder 2 Min. value | -2147483648~(Encoder2 Max. value-1) | - | |
206 | Encoder 2 input filter value |
0: Disable 1: 500kPPS 2: 200kPPS 3: 100kPPS 4: 10kPPS 5: 1kPPS 6: 0.1kPPS |
- | |
207 | Encoder 2 Speed unit | 0: Unit/sec, 1: Unit/min, 2: rpm | V1.10 | |
208 | Encoder 2 position filter time constant | 0 ~ 1000 ms | V1.10 | |
209 | Encoder 2 Position Latch | 0: Disable, 1: Able | V1.40 |
Notes:
* - LREAL range: 2.2250738585072e-308 ~ 1.79769313486232e+308, LREAL positive range: 0 < x ≤1.79769313486232e+308
** - OS version is the version information to which the parameter is applicable.

//Set axis reference
Axis1 := 1;
IF (_AX01_RDY) THEN
//Example of MC_WriteParameter fb
INST_WRITEPARAMETER(Execute:=Execute_Write, Axis:=Axis1,
ParameterNumber:=INST_WRITEPARAMETER.ParameterNumber,
Value:=INST_WRITEPARAMETER.Value,
ExecutionMode:=INST_WRITEPARAMETER.ExecutionMode,
ErrorID=>INST_WRITEPARAMETER.ErrorID);
END_IF;
LM519