Smarthome Remote Control System Producer

KinCony Electronic —- makes our life more beautiful quality more excellent and life more intelligent

7.4. Experiment with Beeper

Posted by admin July - 26 - 2010 - Monday

Except for display components in a MCU system, sound generators are also used. The most common sound generator is beeper, also called buzzer, which will generate different frequency sound at different frequency square wave.

This experiment introduces the user how to make a beeper generate sound.

The Fundamentals of Beeper

Compared with speaker, beeper is very easy to control. Only certain current is needed to drive the beeper, make it generate sound. Therefore, it is basically the same to control a LED or a beeper.

Circuit Design

Because beeper has inductance, it’s not recommended to control it by I/O pin directly. Transistor and diode can be used to isolate the beeper from I/O. In this experiment, we only use transistor.

The PNP transistor in below diagram controls the beeper. When MCU P3.6 is set to low level, the beeper will sound.

Software Design

01 #include <reg51.h>

02

03 sbit BUZZER=P3^7;

04

05 void main(void)

06 {

07 BUZZER = 0;

08 while(1);

09 }

Program Notes

Line 1: include the 8051 register definition header file

Line 3: sbit define beeper to P3.7

Line 5-9: main function

Line 7: set P3.7 to output low level, making the beeper sound

Line 8: loop

Leave a Reply

Universal Programmer | Gang Programmer | Device Programmer | ISP Programmer | Eeprom Programmer | IC Programmer
Copyright © 2003-2012 Programmerkit.com All Rights Reserved.
Add:Rm 852,4F,Zhejiang Shidai Electronics Market,Dengyun Rd 428, Hangzhou, Zhejiang, China. P.C.:310011