What are the operations of Dongguan buzzer in the process of driving mode? Since the self-excited buzzer is driven by DC voltage, it does not need to be driven by AC signal. Just output the driving level to the driving port and amplify the driving current through the triode to make the buzzer sound. It is very simple. The self-excited buzzer is not described here. Here, only the other excited buzzer that must be driven by 1 / 2duty square wave signal is described.
There are two ways for MCU to drive the other buzzer: one is directly driven by PWM output, and the other is to drive the buzzer by using the driving waveform generated by I / O timing reversal level.
PWM output direct drive is to use PWM output itself to output a certain square wave to directly drive the buzzer. In the software setting of the single chip microcomputer, several system registers are used to set the output of the PWM port. You can set the duty cycle, cycle, etc. after setting these registers to generate the waveform of the frequency that meets the requirements of the buzzer, as long as the PWM output is turned on, the PWM output port can output the square wave of the frequency. At this time, the buzzer can be driven by using this waveform.
For example, the driving period of a buzzer with a frequency of 100Hz can be known as 10000 μ s. In this way, you only need to set the PWM cycle to 10000 μ s. The duty cycle level is set to 5000 μ s. A square wave with a frequency of 100Hz can be generated. Through this square wave, the buzzer can be driven by a triode.
The way to generate the driving waveform by using the I / O timing flip level will be a little more troublesome. The timer must be used for timing. The frequency waveform meeting the requirements of the buzzer can be generated through the timing flip level, and this waveform can be used to drive the buzzer.
For example, the driving period of a 100Hz buzzer is 10000 μ s. This only needs to drive the I / O port of the buzzer every 5000 μ S turning the level once can generate a square wave with frequency of 100Hz and duty cycle of 1 / 2duty, and then the buzzer can be driven by triode amplification.