Summary of common instructions and program segments for PLC control servo

Publisher:PositiveEnergyLatest update time:2024-07-09 Source: elecfansKeywords:PLC Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

DZRN return to origin command

DZRN K20000 K3000 X12 Y0

This is a return to origin instruction. K20000 indicates the pulse frequency at the beginning of the return to origin. When the rising edge of X12 is detected, the pulse output frequency drops to 3000. When the falling edge of X12 is detected again, the pulse output stops. The pulse output terminal is Y0.

DDRVI relative positioning instruction

x2-------DDRVI K10000 K1000 Y0 Y2

It means: when X2 is turned on, 10,000 pulses are sent to Y0 at a frequency of 1KHz, starting from the current position. The direction of the motor is positive, and it is reflected on Y2.

Generally, the most commonly used mode for servo motors is position control. Don’t be scared by the wiring in the manual. CN1 is the control port, and CN2 is the encoder feedback port. Don’t worry about it, there are dedicated lines for them.

In fact, only four wires, 32, 33, 34, and 35, are needed to control cn1. These four wires are divided into two groups, 32 and 33 are used as pulse inputs, and 34 and 35 are used as direction inputs.

For example: we connect 32 (plus+) to +24v, 33 (plus-) to 0V, 34 (dir+) to +24v, and 35 (dir-) to 0V, and we have the simplest servo system. Did you notice that three external wires are actually enough? We connect 32 and 34 together and share the positive pole of the power supply.

However, the servo is controlled by pulses. Our circuit only sends one pulse to the servo, and this set of servos has 10,000 pulses/turn, so it only turns 360/10,000, almost like it doesn't move. To make it move continuously, it needs to be given continuous pulses. The faster the pulse, the faster it turns. The more pulses, the more it turns. Then PLC is used.

I am using Mitsubishi PLC here: FX1s and Fx1n both provide 24V DC power supply, the lead-out terminals are 24+ and COM, at the output end, Y0 corresponds to COM0, Y1 corresponds to COM1, Y2Y3 to Y5 correspond to COM2 (I take Fx1s14mr 8 inputs and 6 outputs as an example). When Y0 has output, COM0 is connected to Y0 (internal, said to be a field effect transistor), and similarly when Y2 has output, COM2 is connected to Y2, so we can control the on and off of Y0 and Y2 to generate a pulse signal (0101010101) and a direction signal (0000001111111). Generating pulses is not easy, just use a timer to perform alt (alt is a command of Mitsubishi PLC, alt y0, each time it is executed, Y0 flips).

Simpler and more powerful DRVA and DRVI.

DDRVA: absolute position driver ddrva s1 s2 d1 d2

s1: position (simply understood as the number of pulses relative to the origin, between positive and negative 999999)

s2: frequency (the speed of sending pulses, the higher the speed, the faster it is, do not exceed the maximum speed, generally 10k, of course, it cannot be lower than a certain value, it is related to acceleration and deceleration, and the maximum speed, refer to the programming manual for details)

d1: output pulse out port, we use y0

d2: output direction out port, we use y2

DDRVI: Relative position drive, the usage is the same, the only difference is S1: simply understood as the number of pulses relative to the current position.

Some people may say that it seems troublesome, why not use alt? alt is simple, but I don't see many people use alt to drive servo.

The advantage of DDRVA is that there is no need to deal with the pulse direction, that is, we don’t need to care whether Y2 is positive or negative. We only need to tell s1 whether it is positive or negative. If it is positive, y2 will automatically output. If it is negative, y2 will not output, and the servo will reverse automatically.

In addition, when we use DDRVA and DDRVI, PLC can help us record the pulses emitted by using its special registers, like this: ddrva k1000 k500 y0 y2 (drive the servo motor to move a distance of 1000 pulses at a speed of 500 pulses per second. The expression is not accurate, please understand it yourself). Then D8140 is 1000, and D8141 is still 0, because it is the high 16 bits. When the low 16 bits of D8140 are full (16 bits, if it is to be full, it is estimated to be 665535), D8141 will be used.

Note: Fx1s only has high-speed outputs y0 and y1, so in order to effectively utilize resources (sometimes to control two servos), non-high-speed direction signals are given to y2 and y3. Generally, y0 and y2 are paired, and y1 and y3 are paired.


Keywords:PLC Reference address:Summary of common instructions and program segments for PLC control servo

Previous article:What is motor calibration? How does motor calibration work?
Next article:Basic structure/working principle/advantages/application areas of linear motors

Recommended ReadingLatest update time:2024-11-16 11:53

Narrowband PLC ICs for Industrial Control
One thing that seems to happen over and over again in our industry is a new product area emerges that creates a lot of excitement in the engineering world, then languishes in dark, dry corners for years. This technology sounds so good! We could revolutionize our products with it. Then the technology languishes and l
[Embedded]
Narrowband PLC ICs for Industrial Control
What kind of PLC fault can use the time error organization block?
Time error organization block (OB80) The operating system of the S7-300 CPU calls OB80 whenever an error occurs while executing an OB. Such errors include: exceeding the cycle time, an acknowledgement error while executing an OB, advancing the time so that the start time of the OB is skipp
[Embedded]
What kind of PLC fault can use the time error organization block?
What is the difference between Mitsubishi plcfx2n and fx3u
Mitsubishi PLC FX2N and FX3U are two very popular programmable logic controllers (PLCs) that are widely used in industrial automation. Although they are similar in some aspects, there are also some significant differences between them. The following is an analysis of these two PLCs. Basic performance diffe
[Embedded]
Siemens touch screen and S7-1200/1500PLC time synchronization function
Functional description: To have the same time of day for the entire plant, you can use time synchronization to synchronize the times of the plant components. One system component must act as a clock so that all components of the plant run at the same time. The component that acts as a clock is called the time m
[Embedded]
Siemens touch screen and S7-1200/1500PLC time synchronization function
Basic links and rules of PLC ladder diagram programming
PLC ladder programming is a graphical language used in computer control systems. It is developed to facilitate engineers in program design and maintenance. Similar to other programming languages, PLC ladder programming language also has certain syntax and rules, but it is simpler and clearer than high-level programm
[Embedded]
The role of Mitsubishi FX series PLC expansion module configuration in software
Mitsubishi FX series PLC (Programmable Logic Controller) is a controller widely used in the field of industrial automation. It has powerful functions and flexibility to meet various industrial automation needs. In practical applications, in order to meet different control requirements, it is usually necessary to exp
[Embedded]
Basic knowledge of PLC programming: ladder diagram and control circuit
Compared with general computer languages, the software programming language of PLC has obvious characteristics. It is different from both high-level languages ​​and general assembly languages, and must meet the requirements of easy writing and debugging. Early PLCs only supported ladder diagram programmin
[Embedded]
Basic knowledge of PLC programming: ladder diagram and control circuit
Public variables and local variables of Siemens PLC
① Variable V (only for S7-200): In S7-200, the internal variable of PLC is marked with the English letter V. Its function is similar to that of internal registers, which can be used to store the intermediate operation results of PLC program, but the number of variables that can be used is greater. The content of int
[Embedded]
Latest Embedded Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号