Development of multi-channel analog PLC based on embedded PLC chipset
2026-04-06 06:22:33··#1
Today, industrial control products have evolved to a stage that pursues personalization and differentiation. Traditional PLC products can no longer meet the increasingly segmented market demands. To address these needs, embedded PLC products have emerged. I. Embedded PLC An embedded PLC integrates PLC system software within a controller, customizing hardware according to user control requirements. It solves object control problems using PLC application methods. It consists of two parts: embedded PLC system software and the chip itself. 1. Embedded PLC System Software The embedded PLC system software embeds PLC language (ladder diagram language) and CAN bus into the microcontroller, enabling microcontroller product development to shift from assembly language to PLC ladder diagram language, and providing CAN bus interconnection capabilities. The system software has the following characteristics: 1. It uses ladder logic language as its kernel and adds an interrupt management system, enabling hard real-time operation that PLCs cannot achieve; 2. It enhances computing power by adding CANBUS function libraries, floating-point libraries, expert self-tuning PID, embedded WEB, etc., enriching the functions of the PLC; 3. It provides an open extension structure, supporting the wiring of third-party development extension units; 4. It adds network interconnection functionality, enabling remote monitoring after loading a dedicated browser on the remote end. The system software consists of three parts: ① Embedded PLC kernel: It completes basic functions such as real-time task scheduling, ladder logic language interpretation, execution, and communication, and provides secondary development driver interfaces; ② Secondary development driver: Through the plug-in tasks provided by the system software, various personalized and differentiated driver programs are developed using the kernel; ③ Terminal application: Refers to ladder logic language programs for process flow control. 2. The EASY CORE 1.00 embedded PLC chipset is a core chipset loaded with embedded PLC system software. As a hardware platform loaded with system software, it can be used to design general-purpose and special-purpose PLCs. 1) Chipset Basic Performance: ① Power Supply: +5V 200mA, 5-year RAM power-off protection. ② CPU: C8051F040. ③ Embedded Expansion Capabilities: · 32 I/O: Reusable as SPI, I2C interface, external interrupt, external counter, AD, etc. · 4 AD: 12-bit precision, 100 KPS. · 2 DA: 12-bit precision, 100 KPS. ④ Communication Interfaces: · CANBUS: System software management, using the CANSet tool software to build a CANBUS bus network. · UART0: System software management, used for ladder diagram programming and monitoring, supports HMI and user driver download. · UART1: System software management, used for downloading CANBUS network parameters, building RS485 networks, and supporting third-party device interconnection. II. Application Development Based on the core chipset with loaded system software, we can develop our own embedded PLC products according to process requirements. The following is an introduction to a 16-channel analog PLC product (which can input standard signals or thermocouple signals) developed based on an embedded PLC chipset. 1. Hardware Design AI0 is an AD conversion channel within the chipset. P1.0-P1.4 are used as channel control lines for analog switches to switch between the 16 analog signal channels. (1) Signal Acquisition Circuit The analog signal amplification circuit is constructed using the high-precision amplifier OP07 from AD company. OP07 has low input offset voltage (10uV), low drift voltage (0.2uV/℃) and a wide range of supply voltage (±3V-±18V), which can well meet the requirements of this product. Here, OP07 is powered by ±5V, and R18 and R79 are used as zero-adjustment resistors. The output voltage is given by the following formula: Vout=Vin(1+R98/R56). (2) Signal selection circuit: The 16-channel analog switch CD4067 is selected to form the signal selection circuit. A, B, C, D, and INH are connected to the P1.0-P1.4 pins of the chipset as channel selection control signals for the analog switch. The OUT pin is connected to the AIN0 of the chipset, which is the first AD conversion channel. 2. Software development: The embedded PLC is developed based on the Cygnal C8051f040 chip, so the secondary program development uses 51 assembly language. The compiler selected for development is KEIL C51, because it can generate the .HEX file we need. The kernel provides seven user embedded program interfaces. We only need to fully understand the functions of each interface to carry out secondary development. We need to be familiar with the following: a. Kernel functions b. Kernel structure c. Kernel task management d. Kernel memory space allocation. Since the system software has added the functions of 232 communication, 485 communication and CAN communication, the development of the secondary drive software of the 16-channel analog PLC mainly focuses on the AD conversion of analog quantities and the real-time refresh of AD values in the PLC resource area. (1) Program planning T4 interrupt: Complete the AD conversion and 16-channel switching program USER_SCAN: refresh the AD value in the PLC resource area. The AD conversion process is as follows: each channel is sampled 16 times continuously, and after sampling, the sum is obtained, and then the AD conversion of the next channel is started. The refresh process of the AD value in the PLC resource area is as follows: it is performed at the end of the ladder diagram scan cycle, and the average of the sum of each AD value is placed in the corresponding position in the PLC resource area. (2) Program code 3. Embedding of driver The above program is compiled in KEIL C51. Using the download tool software "DOWNHEX", the generated .HEX file is downloaded to the fixed address of the chipset through the serial port, so that the kernel can call it, thereby completing the development of the secondary driver. At this point, the development of the 16-channel analog PLC is basically completed. III. Functional Introduction The multi-channel analog network node developed based on embedded PLC has the following functions: 1. Acquiring multiple thermocouple signals from industrial sites; 2. Supporting multiple human-machine interfaces such as Mitsubishi and Delta; 3. Supporting ladder diagram programming (86 instructions); 4. Supporting CANbus interconnection (multi-machine parallel operation or expansion unit connection), etc. Here is a brief introduction to the ladder diagram function application of this network node. The embedded PLC system software has a built-in temperature conversion function, which converts the AD value corresponding to the thermocouple millivolt signal into a temperature value. It is suitable for thermocouple input signals of any scale and can be applied to different temperature control applications. Combined with PID regulation, the controlled temperature accuracy can reach ±1℃. IV. Conclusion The example of the PLC product developed by the author using an embedded PLC chipset demonstrates that, based on the principle of customizable hardware and software, the developed product can well meet the personalized needs of users, save hardware costs, shorten the R&D cycle, and obtain many powerful functions. It is believed that its emergence will inevitably lead PLC manufacturers to produce more and more PLCs that are closer to the end market.