For those interested in learning PLC programming, to solidify your programming foundation and avoid frequent modifications later, it's crucial to adhere to programming rules from the outset and cultivate good habits. This will save time and improve programming efficiency in the future. In business operations, equipment modifications are inevitable. Sometimes, to save company funds, we need to undertake some modifications ourselves. If we choose to use a PLC as the control device, it's recommended to follow these rules.
Step 1: Read the product instruction manual
First, read the safety guidelines to understand which actuators might cause personal injury, which mechanisms are most prone to collision, and how to handle emergencies. Before designing, thoroughly understand all the equipment's circuit diagrams, pneumatic and hydraulic circuit diagrams, assembly drawings, etc., to gain a comprehensive understanding of the equipment and its operating procedures. This will allow you to form a general concept in your mind. Also, understand the characteristics, usage methods, and debugging methods of each existing component in the equipment to avoid using incorrect signals during programming.
Step 2: Check the I/O input/output points according to the instruction manual.
There are many ways to check I/O, but you must check them one by one according to the addresses provided in the manual, and only do so under absolutely safe conditions.
Checking the input points: Generally, input signals are nothing more than various sensors, such as capacitive, inductive, photoelectric, piezoresistive, ultrasonic, magnetic, and limit switch sensors. Checking these components is relatively simple; according to the component's specifications, place the workpiece on the workstation or move the actuator to check if the sensor has a signal. Of course, different equipment may use different testing methods, depending on the specific situation.
Checking Output Points: Assuming a basic understanding of the equipment's workflow, extra caution must be taken when checking output signals. For electrically driven products, ensure the equipment will not be impacted before energizing the actuator's drive and checking if the actuator can move. For hydraulic or pneumatic actuators, similarly, manually energize the directional valve under safe conditions to control the actuator's movement. Regardless of the actuator's drive method, always consult the component's manual when checking output signals. Not all actuators can be tested by energizing; sometimes, individual output signals may not be testable manually. Exercise extreme caution before proceeding.
Whether it's an input or output device, when the sensor receives a signal or the actuator's drive is powered on, it's essential to simultaneously check if the I/O module indicator lights on the PLC are also illuminated. In many devices, input/output signals are connected to the PLC via terminal blocks. Sometimes, the terminal block indicator light shows a signal, but the corresponding address on the PLC doesn't. This could be due to an internal break in the connecting wires, easily overlooked during equipment troubleshooting; this point requires special attention. After measuring the input/output signals, promptly record the measured addresses to ensure consistency with the manual. If discrepancies exist, verify the measurement again. If multiple measurements still don't match, contact the equipment manufacturer for consultation, ensuring thorough confirmation of each input/output point during programming.
Step 3: Open the programming software, configure the hardware, and write the I/O addresses into the symbol table.
Although different PLCs use different programming software, the programming steps are generally the same. The first step is hardware configuration, which involves establishing the hardware configuration and corresponding communication configuration based on the actual PLC type. After the hardware configuration is complete, the I/O addresses previously recorded on paper are written into the symbol table of the software. Different software may have different definitions for the symbol table, but they generally have this function, and ensuring the accuracy of the symbol table is crucial. When writing the symbol table, not only should the absolute addresses of the device inputs and outputs be written correctly, but it is also best to name each address and add comments. This will greatly facilitate subsequent programming. It will be unnecessary to look up the absolute address every time during programming; simply enter the named address.
Step 4: Write the program flowchart
Before programming, always write out the program flowchart on a draft. A complete program should include a main program, a stop program, an emergency stop program, a reset program, etc. If the software allows, each program should be written in a "block" format, meaning one program is one block, and each block can be called as needed. PLCs excel at handling sequential control programs, where the main flow is the core. Ensure the correctness of the flow and carefully check it on a draft. If there are problems with the main flow, when the program is executed by the PLC, it may cause collisions, damaging equipment or posing a danger to personnel.
Step 5: Write the program in the software.
Once the main process is confirmed to be working correctly, you can begin writing the program in the software. Furthermore, pay close attention to the correctness of the stop, emergency stop, and reset procedures, especially the stop and emergency stop procedures. These are the most critical procedures related to personal and equipment safety and should not be underestimated. Ensure that under any circumstances, executing the stop or emergency stop procedure will absolutely not cause personal injury. One more small detail: experienced technicians always use normally closed contacts in their programs when handling emergency stop buttons; this is something to be aware of.
Step 6: Debug the program
The debugging process can be divided into two aspects.
1. If conditions permit, or if you have exceptional logical abilities, you can first use the software's simulation function to test, but many complex programs are difficult to verify through software simulation to determine if they are correct.
2. Download the program to the PLC for online debugging. If the equipment does not move or malfunctions during operation, do not modify the program immediately. It is likely that the sensors are not properly calibrated. Only modify the program after confirming that the sensors are working correctly.
Step 7: After debugging, edit the program again.
In the previous debugging step, since the program was modified, it is necessary to check or edit the program again before downloading the final program to the PLC.
Step 8: Save the program and make a backup.
Previously, we downloaded the final debugged and modified program to the PLC. If the PLC executes the program without any errors, we uploaded the program to the computer PC and then compressed it into a compressed file. This makes it less susceptible to virus infection. If conditions permit, the program can also be burned onto a CD.
Step 9: Complete the report
After completing the programming, you should fill out a final debugging report, recording all the problems encountered and any difficulties the program faced. This is because you may forget some of the programming techniques over time, and it also helps other colleagues understand the program you wrote.