Design of Function Generator Based on Single Chip Microcomputer
1 Introduction
In the process of designing and debugging automatic control systems, sine waves, triangle waves and square waves of different frequencies are often used as signal sources, which are very convenient to use. In the past, oscillators were often composed of discrete components and integrated operational amplifiers. The later ICL8038 had a maximum frequency of only 100kHz. The MAX038 chip has better performance, with a maximum frequency of 20MHz, and the three waveforms are output from the same end. The microcontroller has excellent control quality, and the function generator based on the microcontroller is reliable and easy to operate.
2 Introduction to the high-frequency signal generator chip MAX038
The MAX038 chip produced by MAXIM is a high-frequency precision function generator that can generate triangle waves, sawtooth waves, sine waves, square waves and pulse waves, and the frequency and duty cycle can be controlled independently.
The circuit achieves the best working performance when the current range of Lin pin is 10~400μA. The selection of output waveform is determined by the combination of logic address pins A0 and A1: when A1A0=10 or 11, the output is sine wave; when A1A0=00, the output is square wave; when A1A0=01, the output is triangle wave. Waveform switching can be completed within 0.3μs, but the output waveform has a delay time of 0.5μs. The output frequency is determined by the current of Lin pin, the capacitance of SOSC pin to ground and the voltage of FADJ. When the FADJ pin is grounded, the output frequency is given by the formula:
F0=Lin/CF
In the formula, F0 is the output frequency, unit MHz; Lin is the pin input current, unit μA; CF is the series capacitance value that determines the output frequency, unit pF.
3 Design and implementation of function generator based on single chip microcomputer
3.1 System Hardware Interface Circuit Design
The 8051 microcontroller in Intel's MCS-51 series has been very mature in application. Other 8-bit machines based on it have excellent compatibility and are very convenient to use. Figure 1 shows the system hardware circuit with 8051 and MAX038 as the core.
The 8279 is used to complete the two functions of keyboard input and LED display control. The keyboard key settings include: numeric keys 0 to 9, decimal point, sine wave, square wave and triangle wave switching keys, frequency selection Hz, kHz, MHz switching keys, duty cycle key, and enter key. Using external decoding, SL0 to SL2 of 8279 are connected to the keyboard through the output of 74LS138 (2), and are sent to the LED after being driven by the output of 74LS138 (1). The display outputs B0 to B3 and A0 to A3 of 8279 are 8-bit data outputs. When a valid closed key appears on the keyboard, the data automatically enters the RAM memory of 8279 and requests an interrupt to the CPU.
The frequency control voltage of MAX038 is provided by 10-bit DAC1020 and enters the Lin pin through the resistor Rin=50kΩ. P2.6 of 8051 is used as the chip select signal of DAC1020. Double buffer mode is adopted to latch 10-bit data. The voltage range of DADJ pin -2.4V~+2.4V is provided by the bipolar output voltage of 8-bit DAC0832, which is the control voltage of duty cycle adjustment. P2.5 of 8051 is used as the chip select signal of DAC0832. The reference voltage adopts the internal 2.5V reference voltage of MAX038 and is connected to the VR terminal. ILE of DAC0832 is connected to +5V, and the chip select terminal and data transmission terminal are connected to the output line A0 of 74LS373.
Assume that the voltage at the Lin input terminal is Vin and the series resistance is Rin, then we have the formula:
F0=Vin/〔Rin×CF〕
wherein, F0 is the output frequency, in MHz; Vin is the input terminal voltage, in V; Rin is the series resistance, in Ω; CF is the series capacitance value that determines the output frequency, in pF.
Take Rin = 50kΩ, Vin range 0.5 ~ 5V, so for a certain capacitor, it can provide a tenfold frequency sweep range, so the choice of capacitor can determine the output frequency range, that is, the frequency band. The first frequency band capacitor is 100μF, the frequency range is 0.1 ~ 1Hz, the second to the ninth frequency band capacitor selection is ten times attenuation, you can get the frequency range of each frequency band, the ninth frequency band frequency range is 10 ~ 20MHz, each frequency band step value is 0.5% of the low frequency of each frequency band. There are nine frequency bands to choose from, 8051 P1.2 ~ P1.5 is sent to the frequency band setting circuit after decoding by T1042, and the switch in the frequency band setting circuit is started by software to select the frequency band.
3.2 System software design and implementation
The main program flow chart of the system is shown in Figure 2.
First, initialize 8279, that is, allow interrupt application, clear 8279 status, set keyboard display mode and clock programming, and then set MAX038 initial waveform, frequency, and duty cycle. Then test whether the enter key is closed to determine whether to interrupt processing, determine the output waveform and output control signal, and send the control voltage and duty cycle calculation of the output waveform frequency to DAC1020 and DAC0832. Finally, send the waveform frequency and duty cycle to the display buffer and call the display subroutine for display.
4 Conclusion
The real-time program control of MAX038 by single-chip microcomputer can generate high-frequency and high-precision output waveform. The system runs stably, the output waveform has small distortion, small drift, and wide frequency range. The CHMOS single-chip microcomputer based on 8051 can also be easily embedded in the application.
Previous article:Design of Liquid Level Monitor Based on Multiple Single Chip Microcomputers
Next article:Design of Single CPU Simulator for 51 Single Chip Microcomputer
- Popular Resources
- Popular amplifiers
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
- MCU Selection
- Qianao driving recorder disassembly-communication module
- Micropython windows compilation error
- 【GD32307E-START】Development environment construction + some problems encountered
- Introduction to Microcontroller (MCU) Architecture
- Pull-down resistor
- Purgatory Legend-Binary to BCD Battle
- 2020 Medtec China Exhibition and International Medical Device Design and Manufacturing Technology Exhibition invites you to participate!
- Share the problem of using LM3409
- EEWORLD University - Designing wide input DC/DC converters for solar inverter applications