Design of Function Generator Based on 8051 Single Chip Microcomputer

Publisher:hfy13567003617Latest update time:2011-10-27 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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.

Reference address:Design of Function Generator Based on 8051 Single Chip Microcomputer

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

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号