Wiki source code of 3 Demo

Last modified by Theodore Xu on 2025/01/21 11:58

Show last authors
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]]
8
9 = 2 VD1/VD2 Servo Position control =
10
11 This case uses three commonly used PLC positioning instructions to implement the servo position control mode actions.
12
13 == VD1 I/O wiring ==
14
15 (% class="wikigeneratedid" id="H" %)
16 [[image:image-20220729134512-1.png]]
17
18 == VD2 I/O wiring ==
19
20 [[image:image-20220729134540-2.png]]
21
22 == Parameter setting ==
23
24 **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;
25
26 |=**Code**|=**Parameter Name**|=**Property**|=(((
27 **Effective**
28
29 **Time**
30 )))|=**Range**|=**Function**|=**Unit**|=**Default**
31 |P0-1|Control mode (default setting)|At stop|Power-on again|1~~10|(((
32 1: Position control mode
33
34 2: Speed control mode
35
36 3: Torque control mode
37 )))|-|1
38
39 **Step 2**: Set the value of function code P0-4, 0 is forward rotation, 1 is reverse rotation
40
41 |=**Code**|=**Parameter Name**|=**Property**|=(((
42 **Effective**
43
44 **Time**
45 )))|=**Range**|=**Function**|=**Unit**|=**Default**
46 |P0-4|(((
47 Rotating direction
48
49 selection
50 )))|At stop|(((
51 Power-on
52
53 again
54 )))|0~~1|(((
55 Forward direction:viewed from the motor shaft.
56
57 0: CW direction as the forward direction
58
59 1: CCW direction as the
60
61 forward direction
62 )))|-|0
63
64 **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.
65
66 |=**Code**|=**Function**|=**Effective time**|=**Default**|=**Range**|=**Description**
67 |P13-1|Virtual VDI_1 input value|▲|0|0-1|(((
68 VDI1 input level:
69
70 0: low level. 1: high level.
71 )))
72
73 **Step 4**: Set the value of the function code P13-1 to choose whether VDI1 is valid at high or low levels.
74
75 (% class="box infomessage" %)
76 (((
77 **✎Note:** the value of function code P6-02 should be set to 1. Only in this way can the motor rotate.
78 )))
79
80 |=**Code**|=**Function**|=**Effective time**|=**Default**|=**Range**|=**Description**|=**Unit**
81 |P6-02|DI_1 function selection|△|1|0-16|(((
82 1: SON, Servo ON
83
84 2: A-CLR, Fault and warning clear
85
86 3: POT, Forward limit switch
87
88 4: NOT, Reverse limit switch
89
90 5: ZCLAMP, Zero speed clamp
91
92 6: CL, Clear the position deviation
93
94 7: C-SIGN, Instruction negation
95
96 8: E-STOP, Emergency stop
97
98 9: GEAR-SEL, Electronic gear switching 1
99
100 10: GAIN-SEL, Gain switch
101
102 11: INH, Position reference inhibited
103
104 12: VSSEL, Damer control switch(not implemented yet)
105
106 13: INSPD1, Internal speed command selection 1(not implemented yet)
107
108 14: INSPD2, Internal speed command selection 2(not implemented yet)
109
110 15: INSPD3, Internal speed command selection 3(not implemented yet)
111
112 16: J-SEL, Inertia ratio switch(not implemented yet)
113 )))|
114
115 == PLC Project ==
116
117 [[image:image-20220729134604-3.png]]
118
119 == Explanation ==
120
121 The program uses M0,M1,M2 as the switch button of three modes of actions.
122
123 When M0 is turned on, the Y0 servo motor rotates 5000 pulses in the direction of Y3.
124
125 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.
126
127 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.
128
129 ----
130
131 == PLC demos download ==
132
133 [[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]]
134
135 = 3 VD2 Multi-position mode =
136
137 == Version ==
138
139 (% class="wikigeneratedid" %)
140 Only SA(absolute servo) series servo can support multi-position mode.
141
142 Only firmware version U2-4 is 1.10 or more can support multi-position mode.
143
144 (% style="text-align:center" %)
145 [[image:1639116818619-611.png||height="355" width="800" class="img-thumbnail"]]
146
147 == Demo: control 2 internal position ==
148
149 **Parameter**
150
151 * P0-1=1 position mode
152 * P0-16=10000 one circle pulse of motor
153 * P1-6=1 Position source: Internal position mode
154 * P6-2=20 enabe signle of intenal position mode
155 * P6-3, P6-4 depend on your requirement
156 * P6-5=21
157 * P6-6,P6-7 depend on your reuqirement
158 * P6-8=22
159 * P6-9,P6-10 depend on your reuqirement
160
161 If you select P6-4=VDI1,P6-7= VDI2,P6-10= VDI3,please control trigger virtual port with P13 group parameter
162
163 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]]
164
165 As below:
166
167 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.
168
169 |=**DI function code**|=**Function name**|=**Function**
170 |21|Internal multi-position selection 1|To form a multi-position operation position number
171 |22|Internal multi-position selection 2|To form a multi-position operation position number
172 |23|Internal multi-position selection 3|To form a multi-position operation position number
173 |24|Internal multi-position selection 4|To form a multi-position operation position number
174
175 Table 6-16 DI function code
176
177 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.
178
179 |=**Internal multi-position position selection 4**|=**Internal multi-position position selection 3**|=(((
180 **Internal multi-position position selection 3**
181 )))|=(((
182 **Internal multi-position position selection 3**
183 )))|=**Operating position number**
184 |0|0|0|0|1
185 |0|0|0|1|2
186 |0|0|1|0|3
187 |(% colspan="5" %)…………
188 |1|1|1|1|16
189
190 Table 6-17 Correspondence between position selection and position number in internal multi-position