At the end of this article, there are 55 practical case materials.
Introduction: In automated equipment, weight sensors are often used to detect whether materials are qualified. If qualified, they are packaged; if not, they are rejected. The weight sensor typically provides an analog signal to the PLC, which then evaluates the signal to determine if the material is qualified. So, how should this program be written?
Control Requirements:
There is a production line that requires weight detection for products, with a standard weight of 30g. A weight within plus or minus 2g is considered qualified, and automatic packaging must be implemented.
(1) The system runs when the start button is pressed.
(2) When the weight sensor (2-10V corresponding to 0-50g) detects an object, if it is not qualified, cylinder 2 is energized to reject it; if qualified, cylinder 1 is energized to proceed with packaging.
(3) After packaging 10 items, cylinder 3 is energized to implement the box-changing function.
1. Create a new DB data block.

3. Program Writing
Program segment 1 implements the system startup function (the stop button is normally closed).
Program segment 2 converts the analog value from the weight sensor into actual engineering units.
Program segment 3 determines which cylinder to actuate through comparison instructions. The action condition for cylinder 2 includes a greater than or equal to 1.0 to avoid cylinder 2 actuating when there is no weight, i.e., equal to 0.




Recently, many friends have requested case books, stating that reading articles on mobile devices is not very convenient. I have taken the time to organize all 55 practical cases, which are quite typical, including cylinder control programs, alarm programs, program frameworks, motion control program encapsulation, analog control of frequency converters, communication, and other practical cases.If you need them, you can add me on WeChat: biao467524527. If you cannot add me, feel free to message me.


Previous Recommendations
Programming Ideas: Random Start and Stop Case for 7 Motors
Mastering Three Practical Programming Methods for Device Mode Switching Control
Three Recommended Programming Cases to Enhance Your Programming Thinking
Common PLC Programming Errors and Solutions
Focus on This 20% of Instructions to Solve 80% of Programming Problems
Using SCL Language to Write a Three-Color Light Control Case
SCL Writing Control Case for Servo Motors
How to Prompt Timely Alarms When PLC and Touch Screen Communication is Interrupted
SCL Language Writing Timed Start and Stop Device Case
Comparison of Ladder Diagram and SCL for Motor Forward Start and Reverse Stop Programs
Two PLCs Communicating via S7 to Control Frequency Converters with SCL Programming Cases
SCL Language Writing Valve Control Case
How to Use SCL Language to Write Cylinder Control Programs?
A Comprehensive Explanation of FOR Loop Usage and Techniques in SCL Statements
Resolving PLC Communication Failures is Not Difficult; the Key is to Find the Right Method!