With the development of modern communication technology, communication test instruments are constantly being introduced. Various new types of equipment have increasingly 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 the system design. The author has successfully used embedded systems such as ARM processors and C51 microcontrollers as main control chips in multiple communication test instrument projects to achieve real-time control of instrument-related modules. Therefore, a design scheme is proposed to use C51 microcontroller to achieve real-time control in a certain communication test instrument.
1 Hardware design and implementation
1.1 Overall scheme design
In this communication test instrument, the real-time control module mainly realizes real-time control of RF receiving frequency synthesis, RF generating frequency synthesis, filter components, RF input module, RF output module, etc. Perform A/D conversion on the radio frequency detection signal to obtain data. Communicate with the host computer and other functions.
According to the functional requirements of the system to be implemented, comprehensive consideration of system resources, chip cost performance and other factors, it is 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 on-chip Flash memory, 8TImes ; 1 024+256 Byte on-chip RAM, which can address external data memory interfaces, SPI, UART, timers, clock oscillators, PLL, etc. in the 64 kB address space. The on-chip peripherals are rich in resources and easy to control.
System resource allocation: RF receiving and transmitting integrated modules, including DDS, PLL, etc. The external control interface is a micro-control interface, so the three buses of address, data and control of the microcontroller are directly used for control. The working status of filter components, RF input/output modules, etc. is related to the signal level on the interface, so it is 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 radio frequency receiving frequency synthesis and radio frequency transmitting frequency synthesis modules, bus control is directly used. In order to avoid mutual interference when different modules are controlled, a 3-8 decoder is used to decode the bus address and 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 I/O-controlled modules such as filter components and radio frequency input/output, the GPIO pins of the 51 chip are not directly used. Instead, the data bus is latched and the simulated GPIO signal is used by the relevant modules, as shown in Figure 2. , among them, IO_/WR1 is generated by B_/CS7 and the microcontroller write line logical OR.
1.3 SPI and RS232 control interface
The C8051F120 chip has its own A/D converter, but it only has 12 bits, which is not suitable for the needs of this system. Therefore, an AD7707 from Analog Devices is added outside the chip. Its resolution is 16 bits and it is a Σ-Δ architecture. , what is converted is the average value of the input level. Three channels, input level range can reach ±10 mV~±10 V. According to actual requirements, the system uses AIN3 high-level input port, Unbuffered mode, HICOM and REF- are connected to analog ground, VBIAS and REF+ are both connected to +2.5 V The reference voltage is 5 V for analog power and 3.3 V for digital power. It can detect unipolar levels in the input range of 0~10 V. Its control interface is a synchronous serial port, directly controlled by the SPI of the 51 chip. Figure 3 is the electrical connection diagram of the AD7707.
The communication between the microcontroller and the host computer uses a universal asynchronous receiver-transmitter UART, and is connected to an external MAX3224 to convert the UART signal into an RS-232 signal for transmission. The MAX3224 operates at a low voltage of 3~5.5 V, but can generate the ±12 V voltage of RS-232. , just connect Tx, Rx and ground wires to achieve asynchronous serial communication. There are still some clocks, reset circuits and power supplies in the system, which will not be described in detail here.
2 Software design and implementation
2.1 Main program framework
The main program flow chart is shown in Figure 4.
The main program has a sequential structure and is relatively simple. It is mainly divided into two parts: First, initialize and set up each part of the system so that it can work in a normal state. The second is the normal working cycle state. When receiving the control command from the host computer, it will perform the corresponding operation. If there is no command, it will wait. For embedded programs, infinite loops are necessary.
2.2 Serial communication program
The serial communication program implements 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. Each command byte is taken out and the corresponding operation is performed. After the command is executed (the queue is emptied), the flag bit is cleared and waiting for new commands. As shown in Figure 5.
2.3 SPI communication program
C51 uses SPI master mode to communicate with AD7707. Writing to the AD7707 in master mode is relatively simple. The microcontroller first writes 1 Byte of configuration data to the AD7707, which will automatically put the data into its own communication register. Then the AD7707 determines the register and data size to be written next based on the configuration value, and then The data input by the microcontroller is then placed into the specified location. Before C8051F120 sends data, it first determines whether it can send data based on the value of the TXBMT bit in the SPICN register, and then writes data to its own SPIDAT register. The hardware will automatically send the data.
Reading the AD7707 in master mode is more difficult. When C51 has set the communication register of AD7707, indicating that the next operation is to read a register value of AD7707, C51 writes any value to SPIDAT, and then the data will be serially shifted out on the SPI data line (MOSI), and at the same time, a serial number will be generated on the clock line. Row clock, the slave device (AD7707) receives the clock, sends the prepared data to the MISO line and hands it to C51, and does not accept any value sent by the master device. C51 places the sent serial data in the shift register. When the last bit is received, it is moved into the receiving buffer, and then the SPIDAT can be read to read the data.
2.4 Other software modules
Other software modules implement related functions by sequentially sending the required data to the assigned corresponding address space according to the specific requirements of each part of the hardware.
3 Conclusion
The article proposes an embedded system with C51 microcontroller C8051F120 as the core control chip, which has been successfully used in a communication test instrument. The system has achieved real-time control of the entire machine through interrupts and queries.
Previous article:51 microcontroller general assembly delay subroutine,
Next article:Understand the assembly program and source code of the 51-controlled MT8880 dual audio transceiver in one minute
- Popular Resources
- Popular amplifiers
- Semantic Segmentation for Autonomous Driving: Model Evaluation, Dataset Generation, Viewpoint Comparison, and Real-time Performance
- Machine Learning and Embedded Computing in Advanced Driver Assistance Systems (ADAS)
- Intelligent program synthesis framework and key scientific problems for embedded software
- arm_embedded_machine_learning_design_dummies_guide
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
- A collection of ESP32 experience posts. Netizens who are learning ESP32 can take a look.
- 883 Q What does Q stand for in the device identification?
- Received the prize, I feel the delivery speed is very fast now
- LM358 op amp problem, please give me some advice
- How to Measure Circuit Current Using a Shunt Resistor
- 【TI millimeter wave radar evaluation】+SDK development environment
- PCB News: Zhongjing Electronics plans to acquire 45% of Yuansheng Electronics for RMB 270 million to achieve horizontal integration of PCB
- How to use EPI general mode to communicate with FPGA in TM4c129 series microcontroller
- Before buying a cable fault tester, you must know about its manufacturer. How to find a good time...
- High-speed PCB design technology (Chinese)