Works Various Waveform Generators (E)
Use the 74LS74 trigger to generate a square wave with an adjustable output frequency of 10-20kHz and a peak-to-peak output voltage amplitude of 3V. At this time, the trigger input signal is generated by the signal generator; use a 74LS74 trigger to generate an adjustable output frequency of 5-10kHz. , the output voltage is a triangular wave with a peak-to-peak amplitude of 3V; it produces a sine wave with an adjustable output frequency of 10-30kHz and an output voltage amplitude of 3V; it is required to use a single-chip microcomputer to output a square wave of 20-50kHz, with an output voltage amplitude of 3V. The generated square wave frequency can be set by the "+" and "-" buttons. The square wave frequency set by the microcontroller and the sine wave frequency output by the waveform generator can be designed by the LCD display system scheme: Demonstration and analysis of the scheme:
Single-chip microcomputer schematic diagram The minimum microcontroller system consists of the following three parts: (1) Power supply: 1 5V DC power supply (2) Crystal oscillator circuit: A typical crystal oscillator is 12MHz (produces accurate uS-level timing, convenient for timing operation). (3) Reset circuit: It is composed of a capacitor connected in series with a resistor. From the figure and the property that "the capacitor voltage cannot mutate", it can be known that when the system is powered on, the RST pin will appear at a high level, and this high level will continue. The time is determined by the RC value of the circuit. Capacitors generally use 10~30uF. After these three parts are built, the microcontroller is ready to run. 2. Demonstration and analysis of square wave output 2 scheme:
Simulation scheme for outputting a two-division square wave: Since the structure of the 74LS74D frequency division circuit is simple, we used the 74LS74D chip and resistors to build a circuit to achieve the four-division function.
Two-way square wave 20khz
Four-division square wave 10khz 3. Demonstration and analysis of the triangular wave circuit scheme:
Analysis of the simulation diagram of the triangular wave generated by the integrating circuit: First, the 10KHZ square wave signal generated by the 74LS74D four-frequency division is input to pin 2 through a 100KΩ adjustable resistor. Connect pin 3 to a 10KΩ resistor and then to ground. We used a 1.5nf capacitor and a 100KΩ adjustable resistor to form an integrating circuit. After Multisim simulation, the waveform was standard and the parameters met the requirements. Therefore, we finally chose this option.
The triangular wave output when the input signal frequency is 20khz
Triangular wave output when the input signal frequency is 40khz 4. Demonstration and analysis of the sine wave scheme:
Bandpass filter amplifier circuit simulation diagram (1) Solution 1: We use a 10KΩ adjustable resistor and a 4.7nF capacitor to form a bandpass filter circuit, which can filter out a sine wave that meets the requirements from the triangle wave, and then passes through the LM324 operational amplifier. enlarge. (2) Option 2: We use a 10KΩ adjustable resistor and a 4.7nf capacitor to form a low-pass filter circuit to filter out a sine wave that meets the requirements from the triangle wave. After practice, we found that although using a low-pass or high-pass circuit can filter out the sine wave from the triangle, the waveform distortion is serious (more clutter) and the parameters do not meet the requirements. The bandpass filter circuit can solve the above problems very well. To sum up, we finally chose option one.
5. Circuit design:
Overall circuit simulation diagram
Capacitor c6c7 is to filter the input voltage to prevent the input voltage from interfering with the circuit; resistor R6 is to adjust the amplitude of the frequency division rear wave; C1 and R3 form an integral circuit; similarly, c9c10 is also to filter the input voltage; resistor R5 has the function of adjusting the amplitude of the output triangular wave; resistor R1, capacitor C8, resistor R7, and capacitor C2 respectively form a low-pass filter, capacitor C4, resistor R12, capacitor C5, and resistor R13 respectively form a high-pass filter circuit, which can Filter out the sine wave that meets the requirements from the triangle wave; 6. Program design: 1. Functions implemented by the microcontroller i) Output square wave ii) Square wave frequency can be adjusted through buttons iii) Use the OLED screen to display the frequency of the output square wave and measure the sine wave Frequency of the wave 2. Function implementation method: i) Use the microcontroller timer to keep flipping the output, and you can get a square wave. ii) Use the external interrupt 0, 1 of the microcontroller to change the output direction by changing the initial value of the timer. The frequency of the wave iii) The OLED screen displays the frequency of the output square wave and the frequency of the sine wave to be measured by querying the relevant data sheet, connecting it to the corresponding pin of the microcontroller, and then using the display function. iv) The code is posted in the appendix. Solution implementation and debugging 1. Test plan: After we determine the plan, we adopt separate module welding and measurement; (1) Power module measurement: Connect the power module to the +10V power supply, and use a multimeter to measure the three Whether the voltage of each port meets the requirements; (2) Square wave module measurement: Use the tested power module to supply power. After the minimum system operation of the microcontroller, a square wave with adjustable frequency is generated. The amplitude and frequency of the square wave are measured with an oscilloscope. ; (3) Measurement of the frequency dividing circuit module: Use an oscilloscope to measure the output of the 74LS74 to determine whether the waveform, amplitude, and frequency are correct. If not, check whether the circuit connection is intact, whether the chip can work normally, and adjust Amplitude adjustable resistor R6; (4) Measurement of the integrating circuit module: Since the measurement is divided into modules, first use a function signal generator to input a square wave with a frequency of 10KHZ and an amplitude of 3Vpp, and measure it with an oscilloscope at the output port. If the amplitude is wrong, resistor R6 can be adjusted. If the waveform is distorted, the integrating resistor can be adjusted, or the integrating capacitor can be replaced. The selection of the integrating capacitor is critical here. If the integrating capacitor is too large, the greater the time constant of the integrating circuit, the worse the waveform obtained. The smoother and more stable it is. But the followability is poor, that is, the accuracy is small. So we chose a 1.5nf capacitor here; (5) Measurement of the filter circuit module: Use a function signal generator to input a 10kHz triangular wave with an amplitude of 5vpp, and measure it with an oscilloscope at the output port. 2. System debugging: We use module debugging, and then cascade it for debugging if there is no problem; (1) Frequency division circuit module debugging: As long as the frequency division circuit is connected correctly, there will generally be no problems. The main thing is to adjust the resistance that changes the amplitude. R6, just make it meet the requirements; (2) Integral circuit module debugging: first adjust R3 to make the integral circuit work normally, and then adjust resistor R5 to make the amplitude meet the requirements. (3) Debugging of the sine wave circuit module: Adjust the resistors R1, R7, R12, and R13 to form a band-pass filter circuit to filter out the sine wave that meets the requirements. 3. Data testing and processing: 1. Requirements: Use a 74LS74 trigger to generate a square wave with an adjustable output frequency of 10-20kHz and a peak-to-peak output voltage amplitude of 3V. At this time, the trigger input signal is generated by the signal generator;
Actual test: The function signal generator generates a square wave with a frequency of 40kHz and an amplitude of 3vpp. The 74LS74 trigger can output a square wave with an adjustable frequency of 10-20kHz and a peak-to-peak voltage amplitude of 3V. The waveform has no obvious distortion. , the error does not exceed 5%;
2. Requirements: Use an LM324 trigger to generate a triangular wave with an adjustable output frequency of 5-10kHz and an output voltage amplitude of 3V peak-to-peak;
Actual test: After the integration circuit, it can generate a triangular wave with an adjustable output frequency of 5-10kHz and an output voltage amplitude of 3 V peak-to-peak. The waveform has no obvious distortion and the error does not exceed 5%;
3. Requirements: Generate a sine wave with an adjustable output frequency of 10-30kHz and an output voltage amplitude of 3V peak-to-peak;
Actual test: After the filter circuit, a triangular wave with an adjustable output frequency of 5-10kHz and an output voltage amplitude of 416mv can be generated. The amplitude does not meet the requirements. The plan is to use an amplifier to adjust the amplitude, but the actual measurement was unsuccessful;
4. Requirements: Use a single-chip microcomputer to output a square wave of 20-50kHz, and the peak-to-peak output voltage amplitude is 3V; the frequency of the square wave generated by the single-chip computer can be set by the "+" and "-" buttons; the square wave frequency and waveform generated by the single-chip computer are set The output sine wave frequency of the device can be displayed by LCD;
Figure 5
Figure 6 Actual test: The microcontroller can be used to output a square wave of 20-50kHz, and the peak-to-peak output voltage amplitude is 3V; frequency addition and subtraction can be achieved using buttons. The square wave frequency set by the microcontroller can be displayed by OLED.
4. Summary We determined the plan on the first day and used Multisim for simulation. After the simulation was correct, we started welding the circuit. We soldered according to the schematic diagram. We originally thought it would be smooth sailing. Unexpectedly, there was a problem with the first circuit. We changed the chips many times and it still didn't work. After calming down, we thought of resetting CLR1 and CLR2 (direct reset). terminal), PR1, PR2 (direct set terminal) are connected to high level, the chip can work normally. I also encountered a lot of problems when debugging the circuit. Finally, after constant attempts and improvements, I finally made some progress. After so much debugging, I realized that Multisim simulation is not omnipotent. There are many circuits that run normally in the simulation. , it won’t work in the actual circuit. This also inspires us to practice more traditional Chinese medicine in future circuits and not to trust the simulation software too much. There are also microcontrollers that I started from knowing nothing about. After a little trial and error, I finally succeeded. Although the process of debugging the circuit is very boring, once the board is adjusted, I am still very happy. Maybe this is the charm of electronic games. When you are helpless and collapse, it will give you a little surprise to make you Have the courage to continue. This e-tournament also made us understand the importance of teamwork. Only by dividing labor well and doing what we are good at can the team's strength be maximized. During the e-sports, we went from not being familiar with each other to talking about everything now. This should also be a big gain for us in the e-sports. Of course, there were some disputes during the period, but after that, our relationship not only did not deteriorate, But it gets better because we are all working towards the same goal and we all understand that these are all for better results. Overall, I really gained a lot from this e-sports competition. Not only did I learn a lot of new knowledge, I also made a group of like-minded friends and learned the ability to work as a team. It also enhances one's hands-on ability and ability to withstand pressure, and enhances the courage to face and challenge difficulties.
All reference designs on this site are sourced from major semiconductor manufacturers or collected online for learning and research. The copyright belongs to the semiconductor manufacturer or the original author. If you believe that the reference design of this site infringes upon your relevant rights and interests, please send us a rights notice. As a neutral platform service provider, we will take measures to delete the relevant content in accordance with relevant laws after receiving the relevant notice from the rights holder. Please send relevant notifications to email: bbs_service@eeworld.com.cn.
It is your responsibility to test the circuit yourself and determine its suitability for you. EEWorld will not be liable for direct, indirect, special, incidental, consequential or punitive damages arising from any cause or anything connected to any reference design used.
Supported by EEWorld Datasheet