Programming method of extensible three-axis control system based on PLC
Through the combination of ladder language programming, main program, and subprogram, the jump of action instructions and the call of subprograms in the PLC three-axis control system are realized, which solves the problem of not having to rewrite the program when functions are changed or added, and improves the efficiency Work efficiency.
Patent Information
- Application Number
- CN202310200715.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-06
- Publication Date
- 2024-09-06
AI Technical Summary
The existing PLC three-axis control system needs to rewrite the source program when the function of the three-axis mechanism changes or new actions are added, resulting in low work efficiency.
Using ladder diagram language programming, through the combination of main program and subprogram, and using the corresponding relationship between action instructions and flag bits, the jump of action instructions and the call of subroutines can be realized to avoid rewriting the entire program.
When the action of the three-axis mechanism changes or is added, you only need to write the corresponding subroutine and save it in the user program library. The subroutine is called through action instructions, which significantly reduces the frequency of repeated writing and modification of the source program and improves work efficiency.
Smart Images

Figure CN118605366A
Abstract
Description
[Technical field]
[0001] The invention relates to the technical field of PLC control, in particular to a programming method of an expandable three-axis control system based on PLC. [Background technology]
[0002] PLC (Programmable Logic Controller) programming has a wide range of applications, powerful functions, and is easy to use. It has become one of the main devices of contemporary industrial automation and has been widely used in all fields of industrial production. Automation equipment uses a PLC-based three-axis control system to control the three-axis mechanism to complete a series of actions such as picking up materials, transporting, unloading materials, film pasting, and gasket pasting. However, when the use function of the three-axis mechanism changes or new actions are added, it is usually necessary to rewrite the source program, which appears to be rather rigid and complicated, reducing work efficiency.
[0003] In view of this, the present invention provides a programming method for an expandable three-axis control system based on PLC to solve the above problems. [Summary of the invention]
[0004] Therefore, the purpose of the present invention is to provide a programming method for an expandable three-axis control system based on PLC, which adopts ladder diagram language programming. When the action of the three-axis mechanism within the framework of this control system changes or there are new actions, there is no need to rewrite the source program, thereby improving work efficiency.
[0005] To achieve the above object, the present invention provides a programming method for an expandable three-axis control system based on PLC, which adopts ladder diagram language programming and is applied to automation equipment with a three-axis mechanism controlled by PLC. The action instructions to be executed by the three-axis mechanism are sent through a human-machine interface connected to the PLC. The action instructions have preset numbers. The programming method comprises the following steps:
[0006] S1: Write a main program, the main program is an automatic process step that can be executed sequentially by the three-axis mechanism, and multiple automatic process steps can be written. In each automatic process step, an action instruction receiving unit and a subroutine insertion point are written, and a flag bit is preset for each of the action instruction receiving unit and the subroutine insertion point. The flag bit of the action instruction receiving unit is set in a one-to-one correspondence with the number of the action instruction in the human-machine interface, and is used to receive the corresponding action instruction and jump to the automatic process step where it is located;
[0007] S2: Write a subroutine. Multiple subroutines can be written according to the needs of the three-axis mechanism. After each subroutine is written, a preset flag is set and stored in the user program library together with the main program. Each subroutine is used to control the three-axis mechanism to complete a specific action. The flag of the subroutine is set in a one-to-one correspondence with the flag of the subroutine insertion point.
[0008] S3: Execute the automatic process step where the action instruction receiving unit corresponding to the action instruction number is located according to the number of the action instruction issued through the human-machine interface, and jump to execute the subroutine with a flag corresponding to the subroutine insertion point flag in the automatic process step, so that the called subroutine is integrated with the main program, thereby controlling the three-axis mechanism to complete the action corresponding to the action instruction.
[0009] Preferably, the action instructions include material taking action instructions, transporting action instructions, and attaching action instructions, and the main program includes:
[0010] A first automatic process step, which includes a first action instruction receiving unit and a first subroutine insertion point;
[0011] A second automatic process step, which includes a second action instruction receiving unit and a second subroutine insertion point;
[0012] A third automatic process step, which includes a third action instruction receiving unit and a third subroutine insertion point;
[0013] The subprograms include a material taking subprogram, a transporting subprogram, and an attaching subprogram;
[0014] Among them, the flag positions of the first action instruction receiving unit, the second action instruction receiving unit, and the third action instruction receiving unit are respectively set to correspond to the numbers of the material picking, transporting, and attaching action instructions; the flag positions of the first subroutine insertion point, the second subroutine insertion point, and the third subroutine insertion point are respectively set to correspond to the flag positions of the material picking subroutine, transporting subroutine, and attaching subroutine.
[0015] The present invention also provides an expandable three-axis control system based on PLC, which is used to control the action of the three-axis mechanism, including:
[0016] The main program module is used to control the automatic process steps of the three-axis mechanism to be executed sequentially;
[0017] Subroutine module, used to control the three-axis mechanism to complete specific actions;
[0018] The calling integration module is used to receive the action instruction and call the subroutine corresponding to the action, and insert the called subroutine into the main program.
[0019] The beneficial effect of the present invention is that when the action of the three-axis mechanism within the framework of the expandable three-axis control system based on PLC of the present invention changes or there are new actions, there is no need to rewrite the entire program. It is only necessary to write the changed or newly added actions into corresponding subroutines and save them in the user program library. The corresponding subroutines are called according to the action instructions to control the three-axis mechanism to complete the corresponding actions, which significantly reduces the frequency of repeated writing and modification of source programs and improves work efficiency.
Brief Description of the Drawings
[0020] Figure 1 The invention discloses a flow chart of a programming method of an expandable three-axis control system based on PLC.
[0021] Figure 2 The present invention is a block diagram of an expandable three-axis control system based on PLC.
[0022] Figure 3 This is a flowchart of the programming method steps in Example 1.
[0023] Figure 4 This is a schematic diagram of the human-machine interface in Example 1.
[0024] Figure 5 This is a schematic diagram of the user program library in Example 1.
[0025] Figure 6 It is a schematic diagram of the action process of the three-axis mechanism in Example 1. [Specific implementation method]
[0026] To further illustrate the technical means and effects of the present invention, the following is a detailed description in conjunction with the embodiments of the present invention and the accompanying drawings.
[0027] The present invention provides a programming method for an expandable three-axis control system based on a PLC, which adopts a ladder diagram language for programming and is applied to an automation device with a three-axis mechanism controlled by a PLC. The action instructions to be executed by the three-axis mechanism are sent through a human-machine interface connected to the PLC. The action instructions have preset numbers. The programming method comprises the following steps:
[0028] S1: Write a main program, the main program is an automatic process step that can be executed sequentially by the three-axis mechanism, and multiple automatic process steps can be written. In each automatic process step, an action instruction receiving unit and a subroutine insertion point are written, and a flag bit is preset for each of the action instruction receiving unit and the subroutine insertion point. The flag bit of the action instruction receiving unit is set in a one-to-one correspondence with the number of the action instruction in the human-machine interface, and is used to receive the corresponding action instruction and jump to the automatic process step where it is located;
[0029] S2: Write a subroutine. Multiple subroutines can be written according to the needs of the three-axis mechanism. After each subroutine is written, a preset flag is set and stored in the user program library together with the main program. Each subroutine is used to control the three-axis mechanism to complete a specific action. The flag of the subroutine is set in a one-to-one correspondence with the flag of the subroutine insertion point.
[0030] S3: Execute the automatic process step where the action instruction receiving unit corresponding to the action instruction number is located according to the number of the action instruction issued through the human-machine interface, and jump to execute the subroutine with a flag corresponding to the subroutine insertion point flag in the automatic process step, so that the called subroutine is integrated with the main program, thereby controlling the three-axis mechanism to complete the action corresponding to the action instruction.
[0031] The present invention also provides a PLC-based expandable three-axis control system 4 for controlling the action of a three-axis mechanism, comprising:
[0032] The main program module 40 is used to control the automatic process steps of the three-axis mechanism to be executed sequentially;
[0033] Subroutine module 41 is used to control the three-axis mechanism to complete specific actions;
[0034] The calling and integrating module 42 is used to receive an action instruction and call a subroutine corresponding to the action, and insert and integrate the called subroutine into the main program.
[0035] Example 1
[0036] The principle of the present invention is explained below in conjunction with Example 1. The automation equipment in Example 1 is used to attach labels to products. The automation equipment has a three-axis mechanism and is controlled by an expandable three-axis control system 4 based on PLC of the present invention. The operator sends action instructions through a human-machine interface 5 connected to the PLC. The human-machine interface in this embodiment is as shown in FIG. Figure 4 As shown, it includes a feeding mode selection area 50, a program line number editing area 51, a three-axis mechanism function selection area 52 and a three-axis mechanism action point teaching area 53:
[0037] Among them, the feeding mode selection area 50 is used to select the feeding mode. The feeding mode can be selected according to actual production needs, such as coil feeding, aligning machine feeding, vibration plate feeding or sheet feeding. In this embodiment 1, the label is fed by the coil feeding machine, and the PLC controls the three-axis mechanism to drive the head set on the Z axis of the three-axis mechanism to pick up, transport and attach the material. The head can be driven up and down by a cylinder and a vacuum adsorption device is provided on the head;
[0038] The program line number editing area 51 is used to manually adjust the program line number when the device is run for the first time; the three-axis action point teaching area 53 is used to perform point teaching before the device is run for the first time, that is, to save the point data of the three-axis mechanism performing the material picking, transporting, and attaching actions into the program;
[0039] The three-axis mechanism function selection area 52 is used to select the action to be performed by the three-axis mechanism and send an action instruction to the PLC, including: picking up materials, whose action instruction number is preset to 1; carrying, whose action instruction number is preset to 2; attaching, whose action instruction number is preset to 3. The programming method includes the following steps:
[0040] S100: Write a main program 104, the main program 104 is a first automatic process step 101, a second automatic process step 102, and a third automatic process step 103 that can be sequentially executed by the three-axis mechanism, in the first automatic process step 101, write a first action instruction receiving unit 1011, whose preset flag is 1, and a first subroutine insertion point 1012, whose preset flag is 10; in the second automatic process step 102, write a second action instruction receiving unit 1021, whose preset flag is 2, and a second subroutine insertion point 1022, whose preset flag is 20; in the third automatic process step 103, write a third action instruction receiving unit 1031, whose preset flag is 3, and a third subroutine insertion point 1032, whose preset flag is 30;
[0041] S200: Write subprograms 108, respectively write the material picking subprogram 105, the preset flag is 10; the transport subprogram 106, the preset flag is 20; the attachment subprogram 107, the preset flag is 30, after each of the subprograms is written, it is stored in the user program library 100 together with the main program 104, when the program is executed to any subprogram insertion point, the program can jump to the subprogram corresponding to the subprogram insertion point flag to continue execution;
[0042] S300: When a material picking action instruction is received, the first automatic process step 101 is executed, and then the execution is continued at the material picking subroutine 105, that is, the material picking subroutine 105 is called to be inserted into the first subroutine insertion point 1012 for integration; when a transport action instruction is received, the second automatic process step 102 is executed, and then the execution is continued at the transport subroutine 106, that is, the transport subroutine 106 is called to be inserted into the second subroutine insertion point 1022 for integration; when an attachment action instruction is received, the third automatic process step 103 is executed, and then the execution is continued at the attachment subroutine 107, and the attachment subroutine 107 is called to be inserted into the third subroutine insertion point 1032 for integration.
[0043] The specific operation process on the human-machine interface is as follows:
[0044] First, enter the line number 1 in the program line number editing area 51 of the human-machine interface 5, and select the material picking function in the three-axis mechanism function selection area 52, then the system 4 controls the three-axis mechanism to perform the material picking action;
[0045] After the material picking action is completed, the next line of instructions is input in the program line number editing area 51, and the transport function is selected in the three-axis mechanism function selection area 52, then the system 4 controls the three-axis mechanism to perform the transport action;
[0046] After the transporting action is completed, the next line of instructions is input in the program line number editing area 51, and the attaching function is selected in the three-axis mechanism function selection area 52, and the system 4 controls the three-axis mechanism to perform the attaching action.
[0047] Among them, during the process of performing the material picking, transporting and attaching actions, the action flow of the three-axis mechanism is as follows:
[0048] Start → The machine head reaches above the label → The cylinder drives the machine head down to take the label → The machine head vacuum absorbs the label → The cylinder drives the machine head to absorb the label and rise → The Z axis rises to a safe height → The X and Y axes move to the target attachment position → The Z axis descends → The cylinder drives the machine head to press down and attach → Disconnect the vacuum → The cylinder drives the machine head to rise → The Z axis rises to a safe height → The machine head returns to the initial position.
[0049] The beneficial effect of the present invention is that when the action of the three-axis mechanism within the framework of the expandable three-axis control system based on PLC of the present invention changes or there are new actions, there is no need to rewrite the entire program. It is only necessary to write the changed or newly added actions into corresponding subroutines and save them in the user program library. The corresponding subroutines are called according to the action instructions to control the three-axis mechanism to complete the corresponding actions, which significantly reduces the frequency of repeated writing and modification of source programs and improves work efficiency.
[0050] It should be pointed out that the present invention is not limited to the above-mentioned implementation modes, and any simple modifications, equivalent changes and modifications made to the above-mentioned embodiments by any technician familiar with the profession based on the technical solution of the present invention fall within the protection scope of the present invention.
Claims
1. A programming method for an expandable three-axis control system based on PLC, which adopts ladder diagram language programming and is applied to automation equipment with a three-axis mechanism controlled by PLC. The action instructions to be executed by the three-axis mechanism are sent through a human-machine interface connected to the PLC. The action instructions have preset numbers. It is characterized in that The method comprises: S1: Write a main program, the main program is an automatic process step that can be executed sequentially by the three-axis mechanism, and multiple automatic process steps can be written. In each automatic process step, an action instruction receiving unit and a subroutine insertion point are written, and a flag bit is preset for each of the action instruction receiving unit and the subroutine insertion point. The flag bit of the action instruction receiving unit is set in a one-to-one correspondence with the number of the action instruction in the human-machine interface, and is used to receive the corresponding action instruction and jump to the automatic process step where it is located; S2: Write a subroutine. Multiple subroutines can be written according to the needs of the three-axis mechanism. After each subroutine is written, a preset flag is set and stored in the user program library together with the main program. Each subroutine is used to control the three-axis mechanism to complete a specific action. The flag of the subroutine is set in a one-to-one correspondence with the flag of the subroutine insertion point. S3: Execute the automatic process step where the action instruction receiving unit corresponding to the action instruction number is located according to the number of the action instruction issued through the human-machine interface, and jump to execute the subroutine with a flag corresponding to the subroutine insertion point flag in the automatic process step, so that the called subroutine is integrated with the main program, thereby controlling the three-axis mechanism to complete the action corresponding to the action instruction.
2. A programming method for an expandable three-axis control system based on PLC as claimed in claim 1, Features: The action instructions include material taking action instructions, transporting action instructions, and attaching action instructions. The main program includes: A first automatic process step, which includes a first action instruction receiving unit and a first subroutine insertion point; A second automatic process step, which includes a second action instruction receiving unit and a second subroutine insertion point; A third automatic process step, which includes a third action instruction receiving unit and a third subroutine insertion point; The subprograms include a material taking subprogram, a transporting subprogram, and an attaching subprogram; Among them, the flag positions of the first action instruction receiving unit, the second action instruction receiving unit, and the third action instruction receiving unit are respectively set to correspond to the numbers of the material picking, transporting, and attaching action instructions; the flag positions of the first subroutine insertion point, the second subroutine insertion point, and the third subroutine insertion point are respectively set to correspond to the flag positions of the material picking subroutine, transporting subroutine, and attaching subroutine.
3. A scalable three-axis control system based on PLC, used to control the movement of the three-axis mechanism, It is characterized in that include: The main program module is used to control the automatic process steps of the three-axis mechanism to be executed sequentially; Subroutine module, used to control the three-axis mechanism to complete specific actions; The calling integration module is used to receive the action instruction and call the subroutine corresponding to the action, and insert the called subroutine into the main program.
