Arithmetic instructions, floating-point contact comparison instructions, ZPLC call ZBasic instructions, comment instructions //, and other instructions.
The following is a detailed explanation with pictures and text:
First, create a new folder on your computer to save the project you are about to create. Open the ZDevelop programming software. The ZDevelop software version used for this example is V3.00.02. For the latest software version, please refer to [link/reference needed].
Click to download : The latest version of ZDevelop software
Video Tutorial : How to Develop a ZPLC Motion Controller Program?
1. Create a new project
Menu bar: "File" → "New Project".
After clicking "New Project", the "Save As" interface will pop up. Select a folder to open, enter a file name and save the project with the extension ".zpj".
2. Create a new file
Menu bar: "File" → "New File".
After clicking "New File", the following pop-up window will appear. Select PLC as the new file type and confirm. It supports mixed programming of Basic/Plc/HMI.
3. Set the file to run automatically
Double-click the location on the right side of the file where it will run automatically, and enter the task number "0".
4. Editing Program
Select the pane, enter the command, operands, operand numbers, and then confirm.
If the instruction format is correct and the ladder diagram is successfully entered, the cursor will automatically move one space to the right. If the instruction format is incorrect, a pop-up window will appear to prompt the user.
Alternatively, click the symbol directly in the ladder diagram toolbar to bring up the "PLC Instruction Input Window" as shown below. Enter the instruction, operand, operand number, and then confirm.
Command input can be selected directly, from the drop-down list, or from the list of commonly used commands on the left.
Once the program is written, click the "Save File" button, and the newly created PLC file will be automatically saved to the folder containing the project zpj.
5. Connect to the controller or emulator
Edit the program in the program input window, click "Controller" → "Connect". If there is no controller, you can choose to connect to the simulator for simulation. Click "Connect" → "Connect to Simulator". In this example, we choose to connect to the simulator for operation. The command and output window will print the following information when the connection is successful: Connected to Controller: ZMC4xx-Simu Version: 4.80-20180104.
Choose to connect to the controller via serial port or Ethernet port. After selecting the matching serial port parameters or Ethernet port IP address, click Connect.
6. Download the program
Click the "↓ram" button (download to RAM) or the "↓rom" button (download to ROM) in the menu bar. A successful download will be indicated in the command and output window. At the same time, the program will be downloaded to the controller and run automatically.
Programs downloaded to RAM are not saved after a power outage, while programs downloaded to ROM are saved. Programs downloaded to ROM will automatically run according to their task number the next time the controller is connected.
7. Start debugging
Click "Debug" → "Start/Stop Debugging" in the menu bar to open the Tasks and Monitoring window.
The task window is used to view the running status of multiple tasks and the task line number, while the monitor window is used to monitor information such as axis parameters, custom variables, and input/output status.
8. Oscilloscope sampling
Open the oscilloscope window by going to "View" → "Oscilloscope" in the menu bar, as shown in the image below:
Open "Settings," select the number of channels to be sampled, depth, interval, and other parameters, then confirm. Here, we choose to sample five channels:
Curve 0 axis 0 position
Curve 1 Axis 1 Position
Interpolation synthesis speed of curve 2 axis 0
Vector velocity of curve 3 axis 0
Component vector velocity of curve 4 axis 1
After setting up, click the "Start" button.
Close the X0 rising edge contact to transmit the motion distance parameters of axis 0 and axis 1 to the data register for storage.
Closing contact X1 generates a rising edge pulse, M0 turns on and latches itself, simultaneously triggering the oscilloscope sampling command and the MOVE linear interpolation command to execute, resulting in the waveform shown in the figure below. Contact X2 is used to quickly stop the axis movement.
The trajectory in XY mode is as follows:
Press the X2 button while the axis is running to get the waveform shown in the figure below. The interpolation motion will quickly stop the axis according to the parameters set by FASTDEC.
9. PLC Ladder Diagram Demonstration Program
Corresponding statement list program:
//Axis parameter initialization
LD M8002
ZRST M0 M10
LD M8002
BASE k0 k1
EXE @UNITS= 100,100
EXE @ATYPE = 1,1
EXE @SPEED=200,200
EXE @ACCEL=1000,1000
EXE @DECEL=1000,1000
EXE @SRAMP=200,200
EXE @DPOS=0,0
EXE @MPOS=0,0
EXE @FASTDEC=20000,20000
// Linear interpolation motion
LDP X0
DEMOV K300 D0
DEMOV K400 D2
// Start operation on the rising edge of IN1, stop operation quickly when IN2 is pressed.
LDP X1
OR M0
ANI M1
ANI X2
OUT M0
EXEP @TRIGGER
MOVE D0 D2
LD M8100
PLS M1
END
That concludes today's sharing of ZPLC motion controller program development from ZhengMotion Technology. For more exciting content, please follow our official WeChat account.
This article was originally created by Zheng Motion Assistant. We welcome everyone to reprint it for mutual learning and to improve China's intelligent manufacturing capabilities. Copyright belongs to Zheng Motion Technology. Please indicate the source if you reprint this article.
Regarding positive motion techniques
Zheng Motion Technology is a national high-tech enterprise specializing in the research and application of motion control technology. It mainly engages in the research, development, production, sales and service of a series of products such as motion controllers, motion control cards, IO expansion modules and motion display and control all-in-one machines.
The company has gathered outstanding talents from companies such as Huawei and ZTE. While adhering to independent innovation, it actively collaborates with major universities to dedicate itself to the research and application of motion control technology. It is one of the fastest-growing companies in the domestic industrial control field and also one of the companies in China that has fully mastered the core technologies of motion control and real-time industrial control software platform technology.