Welcome to www.agpgames.com ---- HANGZHOU KinCony ELECTRONICS CO.,LTD.
About Us Contact Us          Our Patents Our Articles        Forum      SiteMap    Chinese Version

Chapter 1. Overview Chapter 2. Emulation Guide Chapter 3. Build Your First Project Chapter 4. In System Programming
Chapter 5. USB Interface Installation Chapter 6. LED Display Application Chapter 9. FAQ Chapter 10. System Configuration and Service
 
Chapter 7. Basic Experiments
7.1. Experiment with LED 7.2. Experiment with Flowing LEDs 7.3. Experiment with Keys 7.4. Experiment with Beeper
7.5. Experiment with Relay 7.6. Experiment with LED Display 7.7. Experiment with Serial Port  
 
8.1. Experiment with Matrix Key 8.2. Experiment with Stepping Motor 8.3. Experiment with 1-Wire Digital Thermometer DS18B20
8.4. Experiment with 24C01 EEPROM 8.5. Experiment with 93C46 Serial EEPROM 8.6. Experiment with DS1302 Real-time Clock
8.7. Experiment with 8-bit Serial AD Converter ADC0832 8.8. Experiment with 1602 Character LCD Module 8.9. Experiment with 12864 Graphic LCD
8.10. Experiment with Infra-red Remote Controller 8.11. Experiment with Wireless Encoding Module Chapter 11. User Feedback

Chapter 7. Basic Experiments

7.4. Experiment with Beeper

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



COPYRIGHT2003--2008 HANGZHOU KinCony ELECTRONICS CO.,LTD. All Rights Reserved

Add:Rm 11-3-702, Pujing Jiayuan, Gongshu District, Hangzhou, Zhejiang, China.
Tel:+86-0571-87615070,Fax:+86-0571-87615070 E-mail: hificat@163.com  ICQ:164806453  Webmaster:Hificat