Share this

Design of a Microcontroller-Based Ethernet Embedded Controller

2026-04-06 05:11:50 · · #1
Abstract: This paper designs the hardware structure and related software of an embedded controller based on the SX52BD network microcontroller. It designs the functional modules and related interface circuits (network communication interface circuit and control device interface circuit) of the embedded controller. The Ethernet embedded controller designed in this paper is a new type of "embedded WebServer" based on the SX52BD core. In addition to writing traditional control and communication software, it integrates traditional Web functions into the controller based on Ethernet data transmission, and provides the related protocol stack software design and Java Applet client application design. Ethernet is feasible for industrial control systems. Keywords: Ethernet; Controller; Microcontroller; Web 1 Introduction Network control systems, also known as control networks, have evolved over the past 30 years from analog signal transmission-based DCS control systems to digital, intelligent, and fully distributed fieldbus systems, bringing a profound revolution to industrial automation. With the rapid development of Intranet/Internet information technology, new fieldbus technologies and applications have become a research hotspot for researchers, aiming to solve the problem of achieving comprehensive and seamless information integration from the field control layer to the management layer, and providing a fully open basic architecture. This paper provides a detailed design of the embedded controller, an important access device for Ethernet distributed control systems. 2 Hardware Design The hardware configuration of the entire controller is shown in Figure 1. [align=center] Figure 1 Schematic diagram of controller hardware composition[/align] The entire circuit board is powered by 5V DC. It integrates a 50MHz SX52BD microprocessor, a 24C256 EEPROM chip, an RJ-45 Ethernet interface, an RS-232 interface, an RS-485 interface, a web page content download DEBUG interface, and the Ethernet control chip is the RealTek RTL8019AS. This chip is a full-duplex Ethernet controller that can operate under Ethernet II and IEEE 802.3, 10Base5, 10Base2, and 10BaseT, and is compatible with NE2000. The EEPROM is mainly used to store web pages, image files, PDF documents, etc., so there are no special requirements, and it can be freely selected. Generally, about 32 KB is sufficient; we use the 24C256 chip. The SX52 is the core chip, which controls the Ethernet controller chip RTL8019AS to complete network access. Furthermore, the communication circuit type can be selected through programming, such as RS232, RS485, and MODEM. The biggest feature of this controller design is its simple hardware architecture, allowing the expenditure originally intended for hardware costs to be used for relatively complex software development. The I/O interface can be freely expanded and configured. The application program is stored in Flash RAM or EEPROM, while frequently modified parameters and real-time data are stored in SRAM. The I/O acquisition interface hardware circuit is connected to the bus. 2.1 Microprocessor Selection: The SX52BD is a configurable controller manufactured using CMOS technology, part of the SX series. Its operating frequency can reach 50/76/100MHz, making it a high-speed computer; most of its instructions are single-cycle instructions, and its running speed can reach 20 times that of a general MCU; its flexible I/O characteristics enable it to have efficient real-time control functions. Because of its high-speed operation, the device can use software modules (virtual peripherals) to replace some of the real-time functions previously implemented in hardware, which is the most important feature of the SX series. Below are the main performance and features of the SX52BD: ① CPU performance. Based on a RISC architecture, it uses a compressed instruction set, with most instructions except for the branch instruction being single-cycle instructions; the operating frequency can reach up to 100MHz, at which point the instruction cycle is 10ns, and the internal interrupt response time is 30ns; it can perform fast platform lookup by reading code during runtime (IREAD instruction); it overcomes the slow operating speed of general MCUs, enabling the SX series' internal programs to achieve the purpose of hardware real-time control functions. ② Hardware peripheral characteristics. Internally, it includes two 16-bit timers (each with an 8-bit prescaler), operating in software clock mode, PWM mode, synchronous PWM/capture mode, and external event mode; it also features a programmable 8-bit timer/counter (RTCC) with an 8-bit prescaler and a watchdog timer (sharing the RTCC prescaler); and an internal analog comparator, which is very convenient for general applications. ③ Due to the high-speed operation of the SX series, coupled with flexible I/O functions, the device can use software modules (virtual peripherals) to replace the accurate real-time functions of hardware. Currently, most virtual peripherals are used in communication devices (such as communication interfaces and Internet connection protocols) and as high-speed signal generators and converters. ④ Programming and debugging support. The chip can be programmed online via serial or parallel ports (e.g., via oscillator pins for online serial programming), and the chip has online debugging support logic. For real-time simulation and full-process debugging, a complete development environment can be provided by a third-party tool vendor. This software support includes: readily available virtual peripheral module libraries, comprehensive virtual peripheral examples, and application toolkits for communication. SX devices offer new ideas and solutions in practical applications. On one hand, they can be applied to conventional devices such as process controllers, electronic devices/tools, safety/monitoring systems, automotive applications, power control systems, and personal communication devices. On the other hand, the SX communication controller serves as the hardware platform for the SX stack, enabling the execution of the entire TCP/IP protocol, physical layer, and related high-speed communication layer—virtual peripheral modules. Its network connectivity protocol stack tools enable the application of single-chip network servers and email devices in embedded systems. These tools include the physical layer interface of the TCP/IP network connectivity protocol, allowing for the development of low-cost embedded Internet devices. 2.2 Main Unit Circuit Design of Embedded Controller Based on SX52BD 1. Actuator Switching Circuit Controlled by SX52BD [align=center] Figure 2 Electromagnetic Switch Interface Circuit[/align] In modern automated control equipment, there is a problem of interconnection between electronic and electrical circuits. On the one hand, the control signals of the electronic circuit must be able to control the actuators of the electrical circuit (motor, electromagnet, light, etc.); on the other hand, good electrical isolation must be provided for the electronic circuit to protect the safety of the electronic circuit and personnel. Electronic relays can play this bridging role. Figure 2 is the interface circuit diagram of the electrical switch function unit of the controller that directly controls the industrial circuit using SX52BD. RELAY_A is connected to the RA3 pin of SX52BD. A total of four control switch circuits are designed on the controller motherboard, and the control signals are connected to the RA0-RA3 pins of SX52BD respectively. 2. Ethernet Access Circuit To seamlessly connect embedded devices to the Ethernet network control system, one of the first problems to be solved is the interface problem with Ethernet. How to apply general computing network interface devices to embedded network controllers? We adopted the TRL8019AS Ethernet controller manufactured by Realtek in Taiwan. It has an excellent cost performance and a considerable market share of 10MPbs network cards due to its excellent performance and low price. Its main features include: (1) Compatible with Ethernet11, IEEE802.3, 10Base5, 10Bases, and 10BaseT; (2) Supports 8-bit and 16-bit data buses; (3) Full-duplex, capable of simultaneous transmission and reception at 10MbPs, with a sleep mode to reduce power consumption; (4) Built-in 16KB SRAM for transmission and reception buffering, reducing the speed requirements of the main processor; (5) Can connect to coaxial cables and twisted pairs, and can automatically detect the connected medium; (6) 100-pin TQFP package, reducing PCB size. 3. RS-485 serial communication interface for Ethernet communication The RS-485 bus has been widely used in the control field due to its strong anti-interference ability, support for multi-node long-distance communication, high receiving sensitivity, and simple wiring. The monitoring system uses a distributed monitoring approach based on an RS-485 bus, capable of performing various monitoring and control functions in harsh field environments. The SX52BD processor has both control and communication functions. Because the SX52BD embedded Ethernet control module possesses Ethernet communication, RS-485 serial communication, and data processing capabilities, it can be used as a communication conversion node between RS-485 and industrial Ethernet. The node's role is to convert signals from sensors or actuators in the industrial field into data packets that can be transmitted over the industrial Ethernet, thereby enabling direct communication with other nodes in the field and ultimately allowing the TCP/IP protocol to operate at the field device layer of the control system. The overall block diagram of the RS-485 communication interface circuit is shown in Figure 3. Although the SX52BD embedded Ethernet control module internally supports the RS-485 serial communication format, it lacks an RS-485 driver circuit on the module itself. Therefore, we built the driver circuit ourselves on the controller template. This solution uses the high-performance interface driver chip MAX485. The MAX485 is an 8-pin, DIP-packaged device. Pin 1 (RO) is the data receiver; pin 2 (RE) is the data receive enable (active low); pin 3 (DE) is the data transmit enable; pins 6 and 7 are current loop terminals. It combines a tri-state differential line driver and a differential line receiver, sharing the A and B buses. Its transmission direction is controlled by DE and RE. When DE=1, the driver takes priority and can transmit data; the receiver is in a high-impedance state. When RE=0, the receiver takes priority and can receive data; the driver is in a high-impedance state. [align=center] Figure 3: Block diagram of RS-485 interface driver circuit[/align] 4. Digital Input/Output Circuit with Opto-Isolation Design The entire embedded controller features digital outputs and digital inputs. An embedded microprocessor is a digital signal processing system, and the control quantity it provides is a digital quantity. To prevent strong electromagnetic interference or power frequency voltage from entering the control system through the input/output channels, the entire controller is generally isolated from peripherals; this requires isolation technology. In digital isolation technology, the most commonly used isolation method is the use of opto-isolators because the transmission of optical signals is unaffected by electric and magnetic fields, effectively isolating signal interference. An opto-isolator assembles a light-emitting device and a photosensitive device together, achieving optical coupling to form an electro-optical-electrical conversion device. When a certain voltage is applied across the light-emitting diode, the diode emits light through a certain current. This light signal is then received by the photosensitive device and converted back into an electrical signal. The connection between the input and output terminals of the opto-isolator is achieved through "light," thus opto-isolator provides good electrical isolation. 3. Software Design of the Ethernet Embedded Controller The main control program within the embedded controller is written in SASM assembly language. The SX series has a total of 65 instructions, including 57 basic instructions and 8 equivalent instructions. The system development also utilizes the assembler/programmer software "SXKEY52.EXE" provided by UBICOM to achieve online software simulation, debugging, and program SIP-based programming and download. The client software is designed using HTML and Java Applets. 3.1 Software Design of the Network Protocol Stack After data packets are transmitted to the RTL8019As and MCU via the RJ-45 interface, the system's internal TCP/IP stack parses the packets and determines their flow, then performs unpacking or repacking to continue subsequent work. Clearly, the final processing result is handled by the WebServer. Typically, the TCP/IP protocol is a four-layer protocol system, including the data link layer, network layer (including IP protocol), transport layer (including TCP protocol), and application layer, each responsible for different functions. Various functional applications can be implemented based on the TCP/IP protocol. In our designed system, we mainly analyze HTTP, which is the main component protocol of the WebServer at the application layer. The implementation of other protocol functions will not be analyzed. PI includes an addressing scheme and provides addressing functions; TCP provides reliable inter-process communication between peer processes on different hosts. The entities connected to the two TCP ports are, on one end, the application process or user, and on the other end, the underlying protocol, such as the IP protocol. TCP uses a three-way handshake mechanism during connection establishment to ensure data reliability. TCP/IP communication can be easily established using the provided TCP/IP protocol packets. Once communication is established, further application function expansion can be carried out on this basis. 3.2 Software Design for RS-485 Ethernet Access The embedded controller converts the RS-485 communication format data of the sensor into data packets in the TCP/IP protocol format received by industrial Ethernet. This can be achieved through two real-time tasks. One task is for the module to read data from the sensor from the RS-485 serial port; the other task is to send the data obtained by the module from the Ethernet interface to other network nodes that need the data. They exchange data through a shared data buffer. 3.3 Application of Java Applets on the Client Applet is a Java program that runs on a browser. It cannot run independently. Its bytecode file must be embedded in a file in another language, HTML, and interpreted and executed by the browser by calling the Applet method. Java Applet bytecode programs can perform special Applet tasks. The client software of this system is actually an application of Java Applets. The content of the user interface can be implemented by Applets. The on/off status of control parameters can be displayed through the control interface, and the control system can be selected and queried through the control panel. The communication process between the client and the server is realized by creating a socket. The Socket class and ServerSocket class are the main tools for implementing Socket communication in Java. Creating a ServerSocket object creates a listening service, and creating a Socket object establishes a connection between the client and the server. The following statement creates a ServerSocket class and simultaneously establishes a listening service on the specified port of the controller running the statement: `ServerSocket MyListener = new ServerSocket(8000);` To listen for possible client requests, the following statement should also be executed: `Socket LinkSocket = MyListener.accept();` When the client program needs to obtain information and other services from the server, a Socket object is created: `Socket MySocket = new Socket("ServerComPuterName", 8000);` The author's innovation lies in the fact that the embedded controller design includes both hardware and software components. It communicates with the computer via RJ-45 and memory interfaces, and communicates with control devices via RS-232, RS-485, and electromagnetic control switch interfaces. Client computers only need SQL Server, SOCKET, and EXPLORER to communicate with the embedded controller, while the embedded controller has a WebServer, SOCKET, and system software web server program. References: [1] Ge Yongming, Lin Jibao. Design of Ethernet interface for embedded system [J]. Electronic Technology Application, 2002, (3), 17-19 [2] Wang Huaxiang, Lin Hui. Current status and development trend of industrial control and application [J]. World Instrumentation and Automation, 2003.10:43-45 [3] Feng Dongqin, Jin Jianxiang, Chu Jian. A brief discussion on key technologies of Ethernet application in industrial field [J]. World Instrumentation and Automation, 2002, 6 (4):8-13 [4] Dong Xiaoguo, Wang Rong. Design and implementation of Web-based remote monitoring system for reclaimed water [J]. Microcomputer Information, 2006, 12-1: 86-88 [5] Sui Yunfeng, Liu Yibo, Xie Yi, Zhou Jianhong. Problems and solutions of TCP in cable television network [J]. Microcomputer Information, 4-3:141-143 [6] ARM7TDMI (Rev4) Technical Reference Manual. [EB/OL]. http://www.arm.com/pdfs/DDI0210B_7TDMI_R4.pdf [7] Gu Yongfeng, Chen Zhanglong. Embedded Linux trimming method [J]. Small and Micro Computer Systems, 2003, 24(9): 1697-1700 [8] Yu Jianxin et al. Nine comprehensive experiments on embedded application development [M]. Beijing: Tsinghua University Press, 2006
Read next

CATDOLL Charlotte Hard Silicone Head

The head made from hard silicone does not have a usable oral cavity. You can choose the skin tone, eye color, and wig, ...

Articles 2026-02-22