Thread Content
Learning microcontrollers or the C language is very helpful for improving programming skills. If one only learns the basics of C language, it’s enough to pass exams, but it’s still insufficient – practical programming experience is needed. Microcontrollers are different; they are programmed in C language, with each function handling a specific task, and the variables within those functions are local variables. If you want to retain the value of a variable across successive scanning cycles, you need to define a static variable. Why not use global variables? Static and local variables are only valid within the function in which they are defined, which allows for a better isolation of their scope of validity. Global variables, on the other hand, are valid within all functions, so it’s best to define as few global variables as possible. Also, pointers in C are truly a great feature; they greatly improve efficiency. Those who haven’t learned the aforementioned two types of programming, namely PLC or DCS programming, only use ladder diagrams and function block diagrams; the number of intermediate variables that can be defined is limited, and it generally involves handling input and output points.
Our company has people who understand Zhejiang University’s Zhongkong system, but almost none understand Siemens’ system. The new college graduates haven’t learned it, and the veteran employees are unable to learn it on their own. If there is someone who knows how to use it, then learning from them face to face is fast, but if they have to learn on their own, they need to have a very strong ability to self-learn. Moreover, Siemens programming emphasizes modular programming, which is different from Zhejiang University’s ZDKS DCS, as it is user-friendly and easy to master. The threshold to learning Siemens is high, so naturally fewer people manage to learn it. It would be much better if someone brought it. If you learn about microcontrollers, it involves learning about the underlying hardware implementation of PLCs, as well as function-based modular programming, which is very useful for learning PLC/DCS systems. With Modbus, you can implement functions using blocks; it deals with the hardware at the low level using C language, handling the communication details there.
Learning *microcontrollers is indeed very helpful for improving programming skills. By programming microcontrollers in C language, one can gain a deeper understanding of concepts such as functions, variable scope, and pointers. Compared to superficial learning* used only for exams, this kind of practice enhances understanding and application better. In microcontroller programming, it is a good programming practice to use static variables to store local state and avoid using global variables in order to reduce errors and improve code quality. At the same time, the use of pointers can significantly improve the efficiency and flexibility of programs. If one has no experience with microcontrollers or the C language, although using the ladder diagrams and function block diagrams of PLCs or DCS is simple, it presents limitations when dealing with complex logic. .
Siemens and Zhongkong focus on modularization in different ways. The programming system of Zhongkong is easy to use; for additional functions such as recipe management, it is necessary to purchase plugins or batches. Currently, there is a push toward using domestic control systems, and in the future, companies like Zhongkong and LISI will gradually take over the market. As long as one has a good understanding of logic, programming simply involves learning the software. With Siemens’ CFC and FBD formats, no extensive programming skills are required; only ST requires higher levels of programming expertise
That statement syntax is quite difficult, but it is the language commonly used with S7-300 CPUs. During the 1200 and 1500 eras, ST was widely used in TIA Portal; it is easy to learn, does not require knowledge of hardware, and yet offers powerful functions. The statement table is used with function blocks to improve efficiency. I have seen a custom-designed function block on the computer in the workshop, one that is used for processing analog signals. Normally, people use separate system function blocks to process the signals of each channel, but this function block handles everything in one single block. It calculates the engineering value based on the upper and lower limits of the engineering values as well as the upper and lower limits of the input values, and it then outputs an alarm signal based on these limits. Wait, background data blocks are essentially arrays of multiple structures; therefore, by using a loop instruction, it’s possible to process N such arrays. No matter how many you want to add, it can all be handled within a single functional block. Efficiency has improved a lot.
It’s indeed convenient for small businesses or manufacturers of complete sets of equipment. For large companies, there are standard process templates required for configuration; in order to facilitate maintenance by future staff and reduce the learning cost for newcomers, it’s generally not allowed to write code on one’s own. Either the code written by individuals is standardized within the company, or standard solutions are used. When we first started learning microcontrollers, we began with assembly language to understand logic, and later we didn’t use C anymore, only using a few simple loop statements when working with ST. This is very useful for contractors, but somewhat so-so for clients
The ST language is good for using arrays, loops, and pointers; it’s possible to use a program to traverse all arrays. Using assembly language for microcontrollers was something that happened 20 years ago; the experienced microcontroller instructor upstairs started working with assembly language back then, and it was for microcontrollers that could only have their program burned in once. Few people use assembly these days, unless it is necessary for work. Developing a large microcontroller program using assembly language is a nightmare. Only certain parts of the program can be written in assembly language.