Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Single-chip microcomputer buzzer master program and drive circuit

2025-02-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

Buzzer is divided into piezoelectric buzzer and electromagnetic buzzer according to its structure. The piezoelectric type is the piezoelectric ceramic piece pronunciation, the current is relatively small, the electromagnetic buzzer is the coil electrified vibration pronunciation, the volume is relatively small.

According to the driving method, it is divided into active buzzer and passive buzzer. The active and passive here do not refer to the power supply, but to the source of oscillation. There is an oscillation source on the outside of the active buzzer, as shown in figure 9-8. If the BUZZ pin is given a low level, the buzzer will ring directly. On the other hand, the passive buzzer does not have an oscillator source on the outside, so it must be driven by a pulse frequency signal between the 500Hz~4.5KHz to make it ring. The active buzzer is often more expensive than the passive buzzer, because there are more oscillating circuits in it, and the driving pronunciation is complex, which can be driven by the level, but the passive buzzer is relatively cheap. In addition, the sound frequency of the passive buzzer can be mastered, and there is a definite corresponding relationship between the scale and the frequency, so the consequence of "do re mi fa sol la si" can be made, and complex music tracks can be made with it. For example, birthday songs, two mountain gentlemen and so on.

Figure 9-8 the circuit diagram of the buzzer

Let's take a look at the circuit in figure 9-8. The buzzer current is still absolutely large, so it needs to be driven by a transistor, and a 100-ohm resistor is added as a current-limiting resistor. In addition, a D4 diode is added, which is called a continuous current diode. Our buzzer is a rational device, and when the transistor is turned on to power the buzzer, there will be a conduction current flowing through the buzzer. And we know that one of the characteristics of the inductor is that the current cannot change gradually, and the current increases gradually when it is turned on, which has no success, but when it is turned off, the circuit of "power supply-transistor-buzzer-ground" will be cut off and can not pass any current, so where does the stored current go? it is through the loop of D4 and buzzer itself to waste and lose. Thus, the reverse impact caused by the inductor current during the turn-off is prevented. The current at the turn-off is the origin of the title of the continuous current diode.

Buzzer is often used for computers, printers, multimeters and other equipment to do reminder tone, reminder tone is also very complex, that is, complex to recover a sound on the line, we use the program complexity to do a 4KHZ frequency sound and 1KHZ frequency voice program, students can study the program, compare the practical consequences.

# include sbit BUZZ = P1 ^ 6; / / buzzer master pin unsigned char T0RH = 0; / / High byte unsigned char T0RL of T0 reload value = 0; / / low byte void OpenBuzz (unsigned int frequ) of T0 reload value; void StopBuzz (); void main () {unsigned int i; TMOD = 0x01; / / set equipment T0 task in form 1, but do not start EA = 1; while (1) {/ / enable global infix OpenBuzz (4000) / start the buzzer for at the frequency of 4KHz (iS0; i2; / / calculate the sound time, which is 0.75 of the total time. The shift principle is the same as above soundTime = beatTime-(beatTime > 2); enable = 1; / / instruct the buzzer to start the sound time++. } else {/ / after the rhythm is not finished, deal with the later rhythm / / later continue to return to zero when the total time reaches the rhythm, / / and increment the rhythm index to prepare to start the new rhythm if (time > = beatTime) {time = 0; beat++;} else {/ / when the total time is not reached, time++ / / overtime time count / / after arriving at the sound time, instruct to close the buzzer, / / pull out the silence distance of 0.25 * total time, if (time = = soundTime) {enable = 0; / / to distinguish the continuous two rhythms} / * T0 suffix service function, used to master buzzer sound * / void InterruptTimer0 () interrupt 1 {TH0 = T0RH; / / from the newly loaded load value TL0 = T0RL Tmrflag = 1; if (enable) {/ / reverse buzzer master level BUZZ = ~ BUZZ;} else {/ / close buzzer BUZZ = 1 when not enabled;}}

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report