I. Introduction to PLC Positioning and Servo Control System
The PLC sends drive pulses to the servo driver, and the movement speed is controlled by changing the pulse frequency, while the movement amount is changed by changing the number of pulses.
The servo drive is the actuator that controls the motor to move when it receives a signal from the PLC, and uses a position encoder for precise positioning.
1. Basic unit for positioning control
A single FX3U CPU can power three servo drives. The PLC's pulse output terminals are fixed: Y0, Y1, and Y2. Refer to the module's manual for details on whether pulse output is available. The remaining terminals serve as direction outputs. The maximum output pulse frequency is 100kHz.
2. FX3UPLC Special Adapter Expansion Unit
The pulse output Y of the basic unit is inactive; pulses can only be output by using the input Y of the extended unit via a special adapter.
3. PLC input terminal internal circuit (sinking input)
4. PLC output terminal internal circuit
Y0 can provide the pulse frequency and pulse count. Y4 outputs the direction. This is achieved through positioning instructions and does not require separate programming of Y4.
II. FX3U-PLC Positioning Control Instructions
(I) Origin Regression Command: ZRN
First, move rapidly at speed S1. When reaching the nearest point S3, switch to crawling speed S2, with D as the output. The origin return command can only be used in the positive direction from the origin; it cannot be used in the reverse direction.
2. The execution process of the origin regression instruction ZRN
3. Explanation of the origin return command ZRN, velocity change process, and zeroing signal.
1) Selection of the clear signal at the Y0 pulse output terminal (1)
M8341=ON; Clear signal valid
M8464=OFF; Clear signal output is now active.
Y4 - Fixed output terminal for clear signal.
2) Selection of the clear signal at the Y0 pulse output terminal (2)
M8341=ON; Clear signal valid
M8464=ON; Clear signal output specifies validity.
D8464 - Clear signal designator register.
example:
In the diagram above, when the execution conditions are met, M8341=1, M8464=1, and Y20 is switched to D8464.
Note: If H0028 is set, the corresponding Y028 will result in a calculation error because Y028 does not exist.
3) The zeroing signal output is fixed (consistent with the pulse output).
4) The reset signal output terminal can be specified (any option can be selected).
4. Setting the maximum speed for positioning commands
The maximum speed limits the maximum pulse frequency output by the PLC, which is the upper limit frequency of the positioning command.
The output is 32 bits, so two registers are needed.
5. Setting the base speed (minimum speed) of the positioning command
For motors with the same servo speed, the base speed is typically set to 0Hz.
For stepper motors, set the base speed ≠ 0Hz, otherwise the stepper motor will lose steps.
6. Setting the acceleration time for positioning commands
Acceleration time refers to the time required to accelerate from the base speed to the maximum speed. Setting the acceleration time appropriately can help avoid motor shock.
7. Setting the deceleration time for positioning commands
8. Explanation of the positioning command flags (corresponding to the YO pulse output flags)
The flags of the location command indicate the status of the location command during execution.
1) M8340 pulse output monitoring flag
For Y0 to have pulse output, M8340 should be set to ON.
When the output pulse at Y0 terminal stops, M8340 = off.
2) M8348 positioning instruction driver
When an instruction is input, M8348 is set to on. Even if the instruction execution has finished, if the instruction input condition is still active, then M8348 remains on.
M8348 = OFF only when instruction input is disconnected.
3) M8349 pulse stop command
YO terminal pulse output stop flag
When M8349 is on, the pulse output at the Y0 terminal immediately stops.
To output a pulse again: M8349=off, the instruction input condition changes from OFF to ON again, and it starts again.
Application: In emergency situations, such as when the emergency stop button is pressed, using M8349=ON will immediately terminate the pulse output and stop the motor. This is only the emergency stop on the PLC side, but it is best to connect the emergency stop button to the servo drive side.
4) M8029 positioning command execution normal end flag bit
It is a flag shared by a location command.
When the positioning command finishes executing normally, the M8029 sends out a pulse with a long scan cycle.
5) M8329 instruction execution exception end flag bit
It is a flag shared by positioning commands.
If the worktable encounters a limit switch in its direction of movement, the motor decelerates and stops, the M8329 sends a pulse signal with a long scan cycle, and terminates instruction execution.
6) Current value registers: D8341, D8340
The current value registers D8341 and D8340 record and store the position of the worktable relative to the origin in real time. When the positioning command outputs a forward rotation pulse, the value in the current value register increases; when the positioning command outputs a reverse rotation pulse, the value in the current value register decreases.
Once the PLC is powered off, the current value register is cleared. Therefore, after powering on, it is essential to restore the mechanical position of the working machine to the origin, i.e., execute the return-to-origin instruction.
If the PLC uses a battery as a backup power source for the registers, only one origin return instruction needs to be executed at the beginning.
9. Forward and reverse limit switches
Two sets of limit switches are used here: limit switch 1 is connected to the PLC, and limit switch 2 is connected to the servo driver for protection.
When the limit flag is ON, the motor decelerates and stops.
Y1M8353M8354
Y2M8363M8364
Y3M8373M8374
10. The near-point signal at the Y0 pulse output terminal can be logically inverted.
M8345=off is logical, i=on signal is valid.
M8345=ON indicates negative logic, i=OFF signal is valid.
(ii) Origin Regression Command with DOG Search: DSZR
The zero-point input signal is a Z-phase pulse; one pulse is output for every one revolution of the motor.
The mechanical origin and the electrical origin must be aligned.
When the X near point signal is received, the speed is reduced to crawling speed, and the machine enters the DOG zone. After contacting the zero point signal, the machine stops running.
Let's take a simple look at a regression procedure to understand it together: