Design of Ultra-low Frequency Signal Generator Based on AT89C52 Single Chip Microcomputer

Publisher:JikaiLatest update time:2011-04-13 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Low-frequency and ultra-low-frequency signals are widely used in medicine, electrochemical research and experimental teaching. Especially in the field of electrochemistry, ultra-low-frequency signal generators have become an indispensable part of electrochemical instruments. Electrochemical instruments equipped with square wave, triangle wave and sine wave generators can study various transient behaviors of electrochemical systems; equipped with slow linear scanning signals or step wave signals, steady-state (or near-steady-state) polarization curve measurements can be automatically performed. However, there are few signal generators suitable for the field of electrochemistry on the market. Traditional signal generators cannot meet professional needs and the purchase cost is too high. This paper introduces a signal generator controlled by a single-chip microcomputer, which can output square waves, triangle waves and sine waves. The frequency range of the generated waveform signal is 0.125 mHz (millihertz) to 80 Hz, the output analog signal voltage range is -10 to +10 V, and the amplitude and frequency of the output signal have a certain adjustment range. Compared with the traditional signal generator, this signal generator has the following characteristics: this signal generator can meet the requirements of the electrochemical field for signal generators, the lowest frequency can reach 0.125 mHz, reaching the advanced level in China, and the signal generator has high precision, low distortion, stable performance, simple circuit structure and small size at ultra-low frequency.

1 Working principle
The input parameters of the ultra-low frequency signal generator include scanning mode, upper and lower limit levels, and waveform frequency. Among them, the scanning mode has three options: single, round trip, and continuous; the upper and lower limit levels are between -10 and +10 V, and the upper limit level is greater than the lower limit level; the waveform frequency range is 0.125 mHz to 80 Hz. There are three output waveforms: square wave, triangle wave, and sine wave. When the signal generator is powered on, it is reset and cleared first, and then the system is initialized. The user inputs parameters such as scanning frequency, upper and lower limit levels, and scanning mode into the microcontroller through the keyboard, and displays them on the LCD. According to a certain algorithm, each functional module is accurately adjusted, and the analog switch that controls the instrument in the integration circuit module is disconnected to start the signal generator to output the required signal waveform.

2 Waveform generation principle
The signal generator can generate continuous square waves, triangle waves and sine waves with adjustable frequency and peak and valley values. The following is a detailed introduction to the generation principles of the three waveforms.
2.1 Sine wave generation principle
Since the lowest frequency of the signal generator can reach 0.125 mHz, the traditional sine wave generation circuit can no longer meet the requirements. The instrument uses a 16-bit digital/analog converter DAC8532 to generate sine waves. Compared with the RC bridge sine wave oscillation circuit and the LC sine wave oscillation circuit, this method is simple, reliable and has high stability.
2.2 Square wave generation principle
The traditional square wave generation circuit consists of a hysteresis comparator with an inverting input and an RC circuit. The RC loop serves as both a delay link and a feedback network, and the output state is automatically converted through RC charging and discharging. However, the generated square wave cannot meet the requirements of ultra-low frequency, and the amplitude and frequency of the waveform are difficult to adjust. The square wave generating circuit of this system is generated by the continuous conversion of CMOS analog switch. This circuit uses ADG201A as the analog switch. When the switch is open, the circuit outputs a high level; when the switch is closed, the circuit outputs a low level. The amplitude of the square wave is determined by the input voltage
, and the period is determined by the frequency of the analog switch conversion. The circuit is simple and can meet the requirements of ultra-low frequency. Moreover, the square wave generated by this circuit is a continuous analog waveform, and the amplitude and frequency are easy to adjust.
2.3 Principle of triangular wave generation
The triangular wave of this signal generator is generated by an integration circuit. Unlike the traditional triangular wave generating circuit, the generation process of this triangular wave is a closed-loop control system, as shown in Figure 1. The square wave generating circuit controls the integration direction of the integration circuit. The output of the integration circuit is compared with the upper and lower limit levels input by the user into the comparator, and the comparison result is sent to the RS trigger. When the output of the integration circuit is higher than the upper limit level (or lower than the lower limit level) input by the user, the RS trigger controls the square wave generating circuit to reverse its output voltage, and continues to send the output of the integration circuit and the upper and lower limit levels input by the user to the comparator for comparison, repeating the cycle, thereby outputting the waveform of the required signal.



3 Hardware circuit design
3.1 Hardware circuit design based on AT89C52

The circuit block diagram is shown in Figure 2.


3.2 LCD display circuit
The LEDs that were previously commonly used in display terminals have been gradually eliminated because they cannot conveniently display Chinese characters and graphics. This signal generator uses the OCM4X8C LCD display module for display. OCM-4X8C is a graphic dot matrix LCD display module with a serial/parallel interface and a Chinese character library inside. The control driver of this module uses the ST7920 of Taiwan Silicon Creation Electronics Company, so it has a strong control and display function.
The LCD screen of OCM4X8C is 128×64 dot matrix, which can display 4 lines, 8 Chinese characters per line. In order to facilitate the simple and convenient display of Chinese characters, the module has a 2 Mb Chinese font CGROM, which contains 8 192 16×16 dot matrix Chinese font libraries; at the same time, in order to facilitate the display of English and other commonly used characters, it has a 16 Kb 16×8 dot matrix ASCII character library. The LCD display circuit is shown in Figure 3. LEDA is the positive electrode of the backlight source of the liquid crystal display module, connected to the +5 V power supply; LEDK is the negative electrode of the backlight source, connected to the ground; PSB controls the serial/parallel connection mode. When the PSB pin of the module is connected to a low level, the module enters the serial interface mode. The serial mode uses the serial data line R/W, the serial clock line E and the chip select terminal RS to transmit data, which constitutes a 3-wire serial mode. According to the serial operation timing programming, the display can be performed.


3.3 E2PROM circuit
Serial E2PROM is an online electrically erasable and writable memory. It has the characteristics of small size, simple interface, reliable data storage, online rewrite, low power consumption, and low voltage writing. It is widely used in single-chip microcomputer systems. E2PROM can be used to store the initialization state table of the signal generator. After the single-chip microcomputer is reset and cleared, the table is directly called to initialize the system. The connection circuit between AT24C64 and single-chip microcomputer is shown in Figure 4.



4 System software design
The software program is the core of the ultra-low frequency signal generator. According to the keyboard input parameters, the digital potentiometer that controls the upper and lower limits of the level and the DAC8532 that controls the input voltage are accurately adjusted to enable the signal generator to work normally. The software flow is shown in Figure 5.

5 Implementation of ultra-low frequency signal
The output frequency of the square wave and triangle wave is divided into 4 output levels. In order to make the frequency distribution of the 4 levels uniform, the selection of resistors is also critical. Through calculation, 2 MΩ, 75 kΩ, 4 kΩ, and 310Ω are selected. From the formula:

the frequency range that the 4 levels meet can be calculated: capacitor C = 10μF. In this design, the maximum value of Uo is 10 V, and the maximum value of Ui is 10 V, so that the minimum value of Ui for the circuit to work is 0.1 V. According to the formula:

the frequency range is 0.125 mHz~80 Hz.
In order to ensure the stability of the ultra-low frequency signal waveform and good repeatability, the following points should be paid attention to during the waveform implementation process:
(1) The use of analog switches. The system initially used analog switches to control the four frequency ranges. However, due to the on-resistance and off-resistance of the analog switches, the analog switches were not completely closed or opened, and the off-resistance of the analog switches was not large enough. Therefore, the off-resistance of the four analog switches in parallel would be even smaller. When connected in parallel with the integral resistor, the integral period would be seriously affected, thus affecting the output of the ultra-low frequency signal. Finally, relays were used to control the lowest frequency range, and analog switches were used to control the remaining three frequency ranges, so that the low-frequency signal output was stable.
(2) The input signal cannot be too small. If the input signal is too small, the signal will be equivalent to the offset current and offset voltage of the op amp, and the error of the output signal will be large.
(3) Selection of integral capacitor. Ultra-low frequency also has specific requirements for capacitors. In order to stabilize the signal, the capacitor of the ultra-low frequency signal generator is a polytetrafluoroethylene capacitor with a capacitance of 10μF. Since the insulation resistance on the circuit board is not large enough, the integral capacitor cannot be directly soldered to the circuit board, but is connected to the op amp through two wires.
(4) Selection of integral resistor. If the resistance value is too large, the requirements for the operational amplifier are too high. If the resistance value is too small, the ultra-low frequency waveform cannot be generated. Therefore, a metal resistor with a maximum integral resistance of 2 MΩ is selected.
(5) Op amp selection. The ultra-low frequency signal has high requirements for the operational amplifier. The system selects the OP37 low offset current and low offset voltage operational amplifier.

6 Conclusion
Compared with the existing signal generators composed of counters, read-only memories, D/A converters and filters, the ultra-low frequency signal generator controlled by the single-chip microcomputer has higher frequency accuracy and stability. The three waveforms generated by the signal generator are commonly used in electrochemical experiments, and the lowest frequency can reach 0.125 mHz, which is the requirement of electrochemical experiments for low frequency. It has broad application prospects in medicine and electrochemical research.

Reference address:Design of Ultra-low Frequency Signal Generator Based on AT89C52 Single Chip Microcomputer

Previous article:Design of portable mine gas detection system
Next article:Design of intelligent water controller based on contactless IC card

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号