Design of Communication Testing Instrument Based on C51 Single-Chip Computer

With the development of modern communication technology, communication test instruments are constantly innovating. Various new devices have higher and higher requirements on the system’s real-time response capability. 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 processor, C51 single-chip microcomputer and other embedded systems as the main control chip in a number of communication test instrument projects, and realized the real-time control function of the instrument-related modules. Therefore, a design scheme of using C51 single-chip microcomputer to realize real-time control in a communication test instrument is proposed.

With the development of modern communication technology, communication test instruments are constantly innovating. Various new devices have higher and higher requirements on the system’s real-time response capability. 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 processor, C51 single-chip microcomputer and other embedded systems as the main control chip in a number of communication test instrument projects, and realized the real-time control function of the instrument-related modules. Therefore, a design scheme of using C51 single-chip microcomputer to realize real-time control in a communication test instrument is proposed.

1 Hardware Design and Implementation

1.1 Overall scheme design

In the communication test instrument, the real-time control module mainly realizes the real-time control of the RF receiving frequency synthesis, the RF generating frequency synthesis, the filter components, the RF input module, and the RF output module. A/D conversion is performed on the RF detection signal to obtain data. Functions such as communication with the host computer.

According to the functional requirements of the system to be implemented, and comprehensively considering factors such as system resources and chip cost-effectiveness, it is determined to adopt an embedded system solution with a C51 single-chip microcomputer as the main control chip. ×1 024+256 Byte on-chip RAM, addressable 64 kB address space for external data memory interface, SPI, UART, timer, clock oscillator, PLL, etc. The on-chip peripherals are rich in resources and easy to control.

System resource allocation: RF receiving and transmitting RF integrated modules, including DDS, PLL, etc., the external control interface is a microcontroller interface, so directly use the address, data, and control three buses of the microcontroller to implement control. The working status of filter components, RF input/output modules, etc. is related to the level of the signal on the interface, so it is controlled by GPIO. The A/D conversion control uses the serial peripheral device interface SPI. The communication with the host computer uses the RS-232 serial port. The overall design block diagram is shown in Figure 1.
  

Design of Communication Testing Instrument Based on C51 Single-Chip Computer

1.2 Design of bus and I/O control

For the RF receiving frequency synthesis and RF transmission frequency synthesis modules, the 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 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 modules controlled by I/O such as filter components and RF input/output, the GPIO pins of the 51 chip are not directly used, but the data bus is latched to simulate GPIO signals for use by related modules, as shown in Figure 2 , among them, IO_/WR1 is generated by logical OR of B_/CS7 and MCU write line.

Design of Communication Testing Instrument Based on C51 Single-Chip Computer

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 the system. Therefore, an AD7707 from ADI Company is added outside the chip. Its resolution is 16 bits, and it is a ∑-△ architecture. , which 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 AIN3 high-level input port, Unbuffered mode, HICOM, REF- are 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, can detect unipolar level in the 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 an electrical connection diagram for the AD7707.

Design of Communication Testing Instrument Based on C51 Single-Chip Computer

The communication between the single-chip microcomputer and the host computer uses a universal asynchronous transceiver UART, which is connected to a MAX3224 to convert the UART signal into an RS-232 signal for transmission. The MAX3224 works at a low voltage of 3~5.5 V, but can generate a ±12 V voltage of RS-232. , just connect Tx, Rx and ground to realize asynchronous serial communication. There are still some clocks, reset circuits, and power supplies in the system, which will not be repeated here.

2 Software design and implementation

2.1 Main program framework

The main program flow chart is shown in Figure 4.
 

Design of Communication Testing Instrument Based on C51 Single-Chip Computer

The main program is a sequential structure, which is relatively simple. It is mainly divided into two parts: one is to initialize 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 upper computer, the corresponding operation is performed, and when there is no command, it waits. Infinite loops are necessary for embedded programs.

2.2 Serial communication program

The serial communication program realizes the communication function with the upper computer. In the specific operation, a circular queue is used to store the received host computer commands, and the head pointer and the tail pointer are respectively used to point to the head and tail of the queue, and each command byte is taken out and operated accordingly. After the command is executed (the queue is empty), clear the flag and wait for a new command. As shown in Figure 5.
 

Design of Communication Testing Instrument Based on C51 Single-Chip Computer

2.3 SPI communication procedure

The C51 uses SPI master mode to communicate with the AD7707. It is relatively simple to write AD7707 in the main mode. The single-chip microcomputer first writes 1Byte of configuration data to the AD7707, which will automatically put the data into its own communication register, and then the AD7707 determines the register and data size to be written next according to the configuration value. The subsequently entered data is placed in the specified location. Before C8051F120 sends data, it first judges whether data can be sent according to the value of the TXBMT bit of the SPICN register, and then writes data to its own SPIDAT register, and the hardware will automatically send the data.

It is more difficult to read the AD7707 in master mode. When C51 has set the communication register of AD7707, indicating that the next operation is to read a certain register value of AD7707, C51 writes any value to SPIDAT, then the data will be serially shifted out on the SPI data line (MOSI), and a serial number will be generated on the clock line. Line clock, the slave device (AD7707) receives the clock, sends the prepared data to the MISO line to C51, and does not accept any value sent by the master device. C51 puts the sent serial data in the shift register, when the last bit is received, it is moved into the receiving buffer, and the data can be read out by reading SPIDAT again.

2.4 Other software modules

Other software modules are based on the specific requirements of each part of the hardware, to achieve the relevant functions by sequentially sending the required data to the allocated corresponding address space.

3 Conclusion

In this paper, an embedded system with C51 microcontroller C8051F120 as the core control chip is proposed, which has been successfully applied to a communication test instrument. The system can realize the real-time control function of the whole machine through interruption and query.

The Links:   TPS650532RGER LQ084V1DG44 BSM150GT120DN2

Author: Yoyokuo