Many devices and their control computers use RS 232 standard serial interface for communication. This paper designs and implements RS 232 serial communication data interceptor, which can effectively intercept the communication data between the device and its control computer.
1 Interceptor Hardware Design
1.1 Overall block diagram and principle
The system principle block diagram is shown in Figure 1.
Principle analysis: The communication line between the specific device and its control computer is divided into two paths through level conversion. One path is directly connected to ensure that the normal communication between them will not be affected after the interceptor is added. The other path is connected to the microcontroller through the extended serial ports 1 and 2, ensuring that the communication data between them can be captured by the microcontroller. After being processed by the microcontroller, these data are transmitted to the host computer through another extended serial port to realize the interception of communication data.
1.2 Device Selection
The system uses the commonly used AT89C51 microcontroller as the processing core. The GM8123 chip produced by Chengdu Guoteng Company is selected to expand the one full-duplex asynchronous serial communication interface of the AT89C51 microcontroller into three full-duplex asynchronous serial communication interfaces. The MAX232 chip is used to realize the mutual conversion between RS 232 level and TTL level.
1.3 Hardware Circuit
The complete circuit diagram of the system is shown in Figure 2. The system circuit consists of three parts: the single-chip minimum system, the serial port expansion circuit and the level conversion circuit.
The minimum system of the single-chip microcomputer includes power supply circuit, clock circuit and reset circuit. S1 and S2 are used as baud rate control switches to control the values of P0.0 and P0.1 from 00 to 11 respectively, corresponding to the baud rate of 1200 to 9600 b/s.
The serial port expansion circuit is composed of GM8123, and its clock circuit uses a 12 MHz quartz crystal oscillator to form an internal clock mode. The GM8123's mother serial port receiving pin RXD0 and sending pin TXD0 are connected to the microcontroller's serial port sending pin TXD and receiving pin RXD respectively. The GM8123's reset pin is connected to the microcontroller's P3.6 pin, and P3.6 controls the GM8123 system reset. Its mode control pin MS is connected to P3.7, and P3.7 selects the mode. The GM8123's sending address line pins STADD0, STADD1, and the receiving address pins SRADD0, SRADD1 are connected to the microcontroller's P1 port P1.0~P1.3 in sequence, and the microcontroller P1 port determines which sub-serial port receives data and selects a sub-serial port to send data.
The level conversion circuit is completed by two MAX232 chips, which realizes the mutual conversion between RS 232 level and TTL level of J1, J2, and J3.
2 Software Design
The system software has two working modes. The software design of mode 1 is to realize the real-time transmission of intercepted data, and the interceptor cannot be separated from the host computer when working. The software design of mode 2 is to realize the storage and forwarding of intercepted data, and the interceptor can work without the host computer.
2.1 Main program flow design
The main programs of Mode 1 and Mode 2 are basically the same. Their main functions include: configuration of the microcontroller serial interrupt related registers, setting of the serial port data transmission and reception baud rate and configuration of related timers, and configuration of the reset operation and working mode of the GM8123 chip. The main program flow chart is shown in Figure 3.
The program flow chart of the baud rate setting controlled by S1 and S2 is shown in Figure 4.
2.2 Interrupt Service Routine
The function of the interrupt service program of mode 1 is to receive the data sent by the specific device (J1) and its control computer (J2), and send the data to the host computer (J3) for display in real time. The flow chart of the interrupt service program of mode 1 is shown in Figure 5.
The main function of the mode 2 interrupt service program is to receive the data sent by the specific device (J1) and its control computer (J2), and store the received data in the RAM of the microcontroller. When receiving the send data command from the host computer (J3), the stored data is sent to the host computer. Its flow chart is shown in Figure 6.
3 Functional Testing
With the help of the serial port debugging assistant software, the interceptor is tested at different baud rates. Figure 7 shows the test results at a baud rate of 9600 b/s and mode 2. COM1, COM2 and COM4 correspond to specific devices, control computers and host computers respectively. The data after the "s:" label in the host computer received data is sent by the device, and the data after the "k:" label is sent by the control computer. These data are intercepted by the interceptor in chronological order. When the interceptor is used to intercept the actual communication data between a specific device and its control computer, the corresponding relationship between the communication data between them can be found by analyzing the intercepted data, thereby analyzing its communication protocol.
4 Conclusion
This paper discusses the design of RS 232 serial data interceptor, makes a product and conducts experiments. The system is stable and reliable and can effectively intercept serial communication data. The system can provide help for people with related needs.
Previous article:New SIM card monitors your child's every move
Next article:Hardware debugging skills during MCU development
- Popular Resources
- Popular amplifiers
- High signal-to-noise ratio MEMS microphone drives artificial intelligence interaction
- Advantages of using a differential-to-single-ended RF amplifier in a transmit signal chain design
- ON Semiconductor CEO Appears at Munich Electronica Show and Launches Treo Platform
- ON Semiconductor Launches Industry-Leading Analog and Mixed-Signal Platform
- Analog Devices ADAQ7767-1 μModule DAQ Solution for Rapid Development of Precision Data Acquisition Systems Now Available at Mouser
- Domestic high-precision, high-speed ADC chips are on the rise
- Microcontrollers that combine Hi-Fi, intelligence and USB multi-channel features – ushering in a new era of digital audio
- Using capacitive PGA, Naxin Micro launches high-precision multi-channel 24/16-bit Δ-Σ ADC
- Fully Differential Amplifier Provides High Voltage, Low Noise Signals for Precision Data Acquisition Signal Chain
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Learn ARM development(14)
- Learn ARM development(15)
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- Sn-doped CuO nanostructure-based ethanol gas sensor for real-time drunk driving detection in vehicles
- Design considerations for automotive battery wiring harness
- Do you know all the various motors commonly used in automotive electronics?
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- [Help] What is the purpose of impulse withstand voltage test? What is the difference between it and surge?
- Pi Cast celebrates Raspberry Pi's 10th anniversary
- Verilog task call
- [RVB2601 Creative Application Development] + 2 DEMO Trials
- EEWORLD University ---- RT-Thread Studio
- Invite you to make an appointment for TI live broadcast: Analysis of the classic and innovative TI ultrasonic gas flow meter solution + the latest SimpleLink platform wireless products
- 2017 MG6 smart key disassembly (NXP solution, with keyless entry, one-button start)
- [Sipeed LicheeRV 86 Panel Review] Review Project Summary Report - Desktop Calendar Weather Assistant
- 【AT-START-F425 Review】USB to CAN: Five Serial Port Commands Explained
- Evaluation board quick test - based on TI Sitara Cortex-A9(2)