Wiki source code of 3 Demo

Last modified by xingzhi lin on 2026/02/11 16:34

Hide last authors
Wecon 1.1 1 = **1. Application** =
2
3 |**Name**|**Explanation**|**Download **
4 |1. communication with  HMI|This demo shows most parameter of servo,user could debug servo parameter in HMI directly|[[Download>>https://ftp.we-con.com.cn/Download/WIKI/Servo/Demo/VD2-HMI%20Modbus%20Communication%20v2.0.zip]]
5 |2. Position control with PLC|This demo shows how to control servo position by WECON PLC|[[Download>>url:https://drive.google.com/drive/folders/1E4MbCoTnX_KFatgARqIIQ2ikswCYUDZv?usp=sharing]]
6 |3. Position control with HMI&PLC| |[[Download>>https://drive.google.com/file/d/1vAE8nP_RhEVnjd5pAfJELs19dBmjXs3D/view?usp=sharing]]
7 |4. Single Position mode control with HMI |This demo shows Servo with HMI use the internal location function to running single positioning.|[[Download>>https://ftp.we-con.com.cn/Download/WIKI/Servo/Demo/VD2-HMI%20Single%20Position%20mode.zip]]
Theodore Xu 3.1 8 |(((
9 5. DO P-COIN Positioning completed
10 )))|VD2 communicate with LX5V use internal position mode. When the positioning is completed, the DO output signal.|[[Download>>https://ftp.we-con.com.cn/Download/WIKI/Servo/Demo/VD2-LX5V%20DO%20P-COIN%20Positioning%20completed.zip]]
Wecon 1.1 11
12 = 2 VD1/VD2 Servo Position control =
13
xingzhi lin 4.1 14 This case uses three commonly used PLC positioning instructions to implement the servo position control mode actions.
Wecon 1.1 15
16 == VD1 I/O wiring ==
17
18 (% class="wikigeneratedid" id="H" %)
19 [[image:image-20220729134512-1.png]]
20
21 == VD2 I/O wiring ==
22
23 [[image:image-20220729134540-2.png]]
24
25 == Parameter setting ==
26
27 **Step 1**: Power on the servo, set the M key on the panel of the servo drive, set the value of function code P0-1 to 1, and 1 is the position control mode;
28
29 |=**Code**|=**Parameter Name**|=**Property**|=(((
30 **Effective**
31
32 **Time**
33 )))|=**Range**|=**Function**|=**Unit**|=**Default**
34 |P0-1|Control mode (default setting)|At stop|Power-on again|1~~10|(((
35 1: Position control mode
36
37 2: Speed control mode
38
39 3: Torque control mode
40 )))|-|1
41
42 **Step 2**: Set the value of function code P0-4, 0 is forward rotation, 1 is reverse rotation
43
44 |=**Code**|=**Parameter Name**|=**Property**|=(((
45 **Effective**
46
47 **Time**
48 )))|=**Range**|=**Function**|=**Unit**|=**Default**
49 |P0-4|(((
50 Rotating direction
51
52 selection
53 )))|At stop|(((
54 Power-on
55
56 again
57 )))|0~~1|(((
58 Forward direction:viewed from the motor shaft.
59
60 0: CW direction as the forward direction
61
62 1: CCW direction as the
63
64 forward direction
65 )))|-|0
66
67 **Step 3**: Set the value of function code P6-04 to 1. 0 is the hardware DI_1 channel, which requires wiring; 1 is the virtual DI_1 channel,no wiring is required.
68
69 |=**Code**|=**Function**|=**Effective time**|=**Default**|=**Range**|=**Description**
70 |P13-1|Virtual VDI_1 input value|▲|0|0-1|(((
71 VDI1 input level:
72
73 0: low level. 1: high level.
74 )))
75
76 **Step 4**: Set the value of the function code P13-1 to choose whether VDI1 is valid at high or low levels.
77
78 (% class="box infomessage" %)
79 (((
80 **✎Note:** the value of function code P6-02 should be set to 1. Only in this way can the motor rotate.
81 )))
82
83 |=**Code**|=**Function**|=**Effective time**|=**Default**|=**Range**|=**Description**|=**Unit**
84 |P6-02|DI_1 function selection|△|1|0-16|(((
85 1: SON, Servo ON
86
87 2: A-CLR, Fault and warning clear
88
89 3: POT, Forward limit switch
90
91 4: NOT, Reverse limit switch
92
93 5: ZCLAMP, Zero speed clamp
94
95 6: CL, Clear the position deviation
96
97 7: C-SIGN, Instruction negation
98
99 8: E-STOP, Emergency stop
100
101 9: GEAR-SEL, Electronic gear switching 1
102
103 10: GAIN-SEL, Gain switch
104
105 11: INH, Position reference inhibited
106
107 12: VSSEL, Damer control switch(not implemented yet)
108
109 13: INSPD1, Internal speed command selection 1(not implemented yet)
110
111 14: INSPD2, Internal speed command selection 2(not implemented yet)
112
113 15: INSPD3, Internal speed command selection 3(not implemented yet)
114
115 16: J-SEL, Inertia ratio switch(not implemented yet)
116 )))|
117
118 == PLC Project ==
119
120 [[image:image-20220729134604-3.png]]
121
122 == Explanation ==
123
124 The program uses M0,M1,M2 as the switch button of three modes of actions.
125
126 When M0 is turned on, the Y0 servo motor rotates 5000 pulses in the direction of Y3.
127
128 When M1 is turned on, the Y0 servo motor rotates 20,000 pulses at the speed of 4,000 pulses, and Y3 represents the direction of the motor.
129
130 When M2 is turned on, the Y0 servo motor moves to the absolute position of 2000 at the speed of 4000 pulses, and Y3 represents the direction of the motor.
131
132 ----
133
134 == PLC demos download ==
135
136 [[Position control mode>>url:http://backup.we-con.site/wiki/servo/download/3.%20Demos/01%20VD1%2FVD2%20Servo%20Position%20control/WebHome/Position%20control%20mode.wcp?rev=1.1]]
137
138 = 3 VD2 Multi-position mode =
139
140 == Version ==
141
142 (% class="wikigeneratedid" %)
143 Only SA(absolute servo) series servo can support multi-position mode.
144
145 Only firmware version U2-4 is 1.10 or more can support multi-position mode.
146
147 (% style="text-align:center" %)
148 [[image:1639116818619-611.png||height="355" width="800" class="img-thumbnail"]]
149
150 == Demo: control 2 internal position ==
151
152 **Parameter**
153
154 * P0-1=1 position mode
155 * P0-16=10000 one circle pulse of motor
156 * P1-6=1 Position source: Internal position mode
157 * P6-2=20 enabe signle of intenal position mode
158 * P6-3, P6-4 depend on your requirement
159 * P6-5=21
160 * P6-6,P6-7 depend on your reuqirement
161 * P6-8=22
162 * P6-9,P6-10 depend on your reuqirement
163
164 If you select P6-4=VDI1,P6-7= VDI2,P6-10= VDI3,please control trigger virtual port with P13 group parameter
165
166 Please check detail information about 21 22 23 24 command in the [[6.2.1 Position instruction input setting>>url:http://docs.we-con.com.cn/wiki/servo/view/2.%20User%20Manual/VD2%20SA%20Series%20User%20Manual/06%20Operation/#H6.2.1Positioninstructioninputsetting]]
167
168 As below:
169
170 In this operation mode, the next operation position number can be set when operating the current position number. There is no waiting time between each position, and the interval time is determined by the instruction delay of the host computer. The operationg position number is determined by the DI terminal logic, and the related function codes are shown in Table 6-16.Table 6-16.
171
172 |=**DI function code**|=**Function name**|=**Function**
173 |21|Internal multi-position selection 1|To form a multi-position operation position number
174 |22|Internal multi-position selection 2|To form a multi-position operation position number
175 |23|Internal multi-position selection 3|To form a multi-position operation position number
176 |24|Internal multi-position selection 4|To form a multi-position operation position number
177
178 Table 6-16 DI function code
179
180 The multi-position position number is a 4-digit binary number, and the DI terminal logic is level valid. When the input level is valid, the position selection bit value is 1, otherwise it is 0. Table6-17 shows the correspondence between the position bits 1~~4 of the internal multi-position and the position number.
181
182 |=**Internal multi-position position selection 4**|=**Internal multi-position position selection 3**|=(((
183 **Internal multi-position position selection 3**
184 )))|=(((
185 **Internal multi-position position selection 3**
186 )))|=**Operating position number**
187 |0|0|0|0|1
188 |0|0|0|1|2
189 |0|0|1|0|3
190 |(% colspan="5" %)…………
191 |1|1|1|1|16
192
193 Table 6-17 Correspondence between position selection and position number in internal multi-position