With the development of modern communication technology, communication test instruments are constantly being innovated. Various new devices have higher and higher requirements for the real-time response capability of the system. The real-time response performance of a communication test instrument has become one of the key factors for the success of system design. The author has successfully applied ARM processors, C51 single-chip microcomputers and other embedded systems as the main control chips in multiple communication test instrument projects to achieve real-time control functions for instrument-related modules. Therefore, a design scheme using C51 single-chip microcomputers to achieve real-time control in a communication test instrument is proposed.
1 Hardware Design and Implementation
1.1 Overall design
In this communication test instrument, the real-time control module mainly realizes the real-time control of the RF receiving frequency synthesis, RF generating frequency synthesis, filter components, RF input module, RF output module, etc. It performs A/D conversion on the RF detection signal to obtain data and communicates with the host computer, etc.
According to the requirements of the system functions to be implemented, comprehensive consideration of system resources, chip cost-effectiveness and other factors, it was determined to adopt an embedded system solution with C51 microcontroller as the main control chip. The chip is Silicon Labs' C8051F120, which has 128 kB of on-chip Flash memory , 8×1 024+256 Byte of on-chip RAM, an external data memory interface with an addressable 64 kB address space, SPI, UART, timer, clock oscillator , PLL, etc. The on-chip peripheral resources are rich and easy to control.
System resource allocation: RF receiving and transmitting modules, including DDS, PLL, etc., the external control interface is a microcontroller interface, so the address, data, and control buses of the microcontroller are directly used for control. The working status of the filter components, RF input/output modules, etc. is related to the signal level on the interface, so they are controlled by GPIO. The A/D conversion control uses the serial peripheral interface SPI. The communication with the host computer uses the RS-232 serial port. The overall design block diagram is shown in Figure 1.
1.2 Design of bus and I/O control
For the RF receiving frequency synthesis and RF transmitting frequency synthesis modules, bus control is directly adopted. In order to avoid mutual interference when different modules are controlled, the bus address is decoded by 3-8 decoder to generate chip select signals for different modules. At the same time, the data line passes through the bus transceiver to improve the load capacity. For the modules controlled by I/O, such as filter components and RF input/output, the GPIO pins of the 51 chip are not used directly. Instead, the data bus is latched and then simulated with GPIO signals for use by related modules, as shown in Figure 2, where IO_/WR1 is generated by B_/CS7 and the microcontroller write line logic OR.
1.3 SPI and RS232 control interface
The C8051F120 chip itself has an A/D converter, but it is only 12 bits, which is not suitable for the needs of the system, so an AD7707 from ADI is added outside the chip. Its resolution is 16 bits, it is a ∑-△ architecture, and it converts the average value of the input level. Three channels, the input level range can reach ±10 mV~±10 V. According to actual requirements, the system uses the AIN3 high-level input port, Unbuffered mode, HICOM and REF- connected to analog ground, VBIAS and REF+ are connected to +2.5 V reference voltage, analog power supply 5 V, digital power supply 3.3 V, and can detect unipolar levels with an input range of 0~10 V. Its control interface is a synchronous serial port, which is directly controlled by the SPI of the 51 chip. Figure 3 is the electrical connection diagram of AD7707.
The communication between the microcontroller and the host computer uses the universal asynchronous receiver and transmitter UART, and the external MAX3224 converts the UART signal into RS-232 signal for transmission. The MAX3224 works at a low voltage of 3~5.5 V, but can generate ±12 V voltage of RS-232. Asynchronous serial communication can be achieved by simply connecting Tx, Rx and ground wires. There are still some clocks, reset circuits and power supplies in the system, which will not be described here.
2 Software Design and Implementation
2.1 Main program framework
The main program flow chart is shown in Figure 4.
The main program is a sequential structure and is relatively simple. It is mainly divided into two parts: one is to initialize the various parts of the system so that they can work in a normal state. The other is the normal working cycle state. When receiving the control command from the host computer, it will perform the corresponding operation, and wait when there is no command. For embedded programs, an infinite loop is necessary.
2.2 Serial communication program
The serial port communication program realizes the communication function with the host computer. In the specific operation, a circular queue is used to store the received host computer commands. The head pointer and tail pointer are used to point to the head and tail of the queue respectively, and each command byte is taken out to perform the corresponding operation. After the command is executed (the queue is empty), the flag is cleared and new commands are waited for. As shown in Figure 5.
2.3 SPI communication program
C51 uses SPI master mode to communicate with AD7707. It is relatively simple to write AD7707 in master mode. The microcontroller first writes 1 Byte of configuration data to AD7707, which will automatically put the data into its own communication register. Then AD7707 determines the register and data size to be written next based on the configuration value, and then puts the data subsequently input by the microcontroller into the specified position. Before sending data, C8051F120 first determines whether it can send data based on the value of the TXBMT bit of the SPICN register, and then writes data to its own SPIDAT register. The hardware will automatically send the data.
It is difficult to read AD7707 in master mode. When C51 has set the communication register of AD7707, indicating that the next operation is to read a register value of AD7707, C51 writes an arbitrary value to SPIDAT, and then the data will be serially shifted out on the SPI data line (MOSI), and a serial clock will be generated on the clock line. The slave device (AD7707) receives the clock and sends the prepared data to the MISO line to C51, and does not adopt any value sent by the master device. C51 puts the sent serial data in the shift register, and when the last bit is received, it is shifted into the receiving buffer, and then the data can be read by reading SPIDAT.
2.4 Other software modules
Other software modules implement related functions by sending required data in sequence to the corresponding allocated address space according to the specific requirements of each hardware part.
3 Conclusion
This paper proposes an embedded system with C51 single-chip microcomputer C8051F120 as the core control chip, which has been successfully applied to a communication test instrument. The system has achieved a good real-time control function of the whole machine through interruption and query.
Previous article:Detailed explanation of STARTUP.A51 of Keil C51
Next article:51 MCU low power working mode
Recommended ReadingLatest update time:2024-11-16 14:42
- Popular Resources
- Popular amplifiers
- 西门子S7-12001500 PLC SCL语言编程从入门到精通 (北岛李工)
- Siemens Motion Control Technology and Engineering Applications (Tongxue, edited by Wu Xiaojun)
- How to read electrical control circuit diagrams (Classic best-selling books on electronics and electrical engineering) (Zheng Fengyi)
- MCU C language programming and Proteus simulation technology (Xu Aijun)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- EEWORLD University Hall----Live Replay: Detailed Explanation of Ultra-Low Power RSL10 Bluetooth SoC Development Board
- 51 single chip digital tube display
- EEWORLD University ---- Training series for BQ76952 & BQ76942, 3-16S & 3-10S battery monit
- How to deploy Wi-Fi connectivity for grid protection and control?
- Common knowledge of inductors
- Three design challenges that the new generation of SimpleLink Wi-Fi devices will help you solve
- How to use the internal LDO of CC1310
- 【TGF4042 Signal Generator】+ Actual Project Application
- Design of control system for CNC engraving machine based on embedded system
- Communication RF Circuit (Online Education) PPT