Monday, 17 June 2013

8051 interfacing with the buzzer

8051 interfacing with the buzzer

 components:  1) AT89C51 microcontroller

                       2) crystal oscillator

                       3) k1 buzzer

                       4) 4.7k resistor

                      5) 2 pcs 0.01uf capacitor

                      6) 5v power supply

                      7) inverter

Description: this is the post about interfacing microcontroller with a k1 buzzer.

                    pin 40 and 31 is connected to vcc(5v). port 1.5 is connected with

                    a inverter and then to the buzzer.pin 18 and 19 are connected to a crystal oscillator with    ceramic 0.01uf capacitor.

  The buzzer gets turned on when port 2.3 is high.

For resetting the buzzer pin 31 and 3 are connected together with 1uf capacitor and and then connected to ground through 8.2k resistor.

 CODE: 

org 00H

HERE: JNB P2.3,HERE                        ;keep monitoring for high

            SET B P1.5                                 ;set bit P1.5

            CLR P1.5                                    ;make P1.5 low

           SJMP HERE                               ; keep repeating

          END

the code is compiled in keil uvision software.

For any assistance or problem or query comment below.

happy innovention...................................

 

password: circuitsandprogram

download link of complete project: http://d01.megashares.com/dl/zIlpiG7/1

 

 

15 comments:

  1. Sir, Can U please post the complete code ??

    ReplyDelete
  2. #include

    #define buzzer P0_1

    void HmsDelay(unsigned char) ;

    void main()
    {
    while(1)
    {
    buzzer = 1 ; // Make LED ON
    HmsDelay(5) ; // 500 ms delay
    buzzer = 0 ;
    HmsDelay(5) ;
    }

    }

    void HmsDelay(unsigned char hmsDelay) { // 100 mSec @ 11.0592 MHz
    unsigned int i ;
    unsigned char j ;
    if (hmsDelay == 0) hmsDelay = 1 ; // Non zero value
    for (j=0; j<=hmsDelay; j++)
    for(i=0;i<=17000;i++)
    ;
    }

    ReplyDelete
  3. use #include in the header of program

    I m providing u the complete link of file with LED program for downloading from 4shared.com u can use that to drive your buzzer by changing the LED to buzzer in program and adjusting the time intervals according to your needs......incase of further queries I welcome your comments.....

    use this password to extract this archive and download : circuitsandprogram

    http://d01.megashares.com/dl/zIlpiG7/1

    ReplyDelete
  4. CODE:
    org 00H
    HERE: JNB P2.3,HERE ;keep monitoring for high
    SET B P1.5 ;set bit P1.5
    CLR P1.5 ;make P1.5 low
    SJMP HERE ; keep repeating
    END
    What is this code for ??Should we program it in assembly or C??

    ReplyDelete
  5. this code is in assembly language
    and the one for which I have posted the link that is for C
    it will be the best option to download the file from the link and just open keil uvision and then select the file option then open the project file from the downloaded folder provided by me
    the folder contains
    c code of program
    hex file and other files
    and complete project of keil u vision

    in case of further queries I am there to help you..............

    ReplyDelete
  6. I downloaded keil uvision 5 and when I click on open project ,the file which u had sent is not at all seen in dialog box opened. Should the file be changed in to any other format .?

    ReplyDelete
  7. after downloading the file do the following.........
    1) extract the file using 7zip and password circuitsandprogram
    2) you will see a folder 1LED Blink on extracting
    3) open the folder and open the file LED.uvproj it is a 14kb file
    4) file will get opened in keiluvision incase it doesnot then right click the file and choose
    openwith keiluvision

    ReplyDelete
  8. you will never see the file in the dialog box on its own,you have to browse to the location where you have saved the downloaded file and extracted folder then choose the extracted folder 1LED Blink and then you will see the file........

    follow the steps in the previous comment...no need to change any file format...

    ReplyDelete
  9. In the circuit diagram P 2.3 is connected to both vcc and gnd.How will it work ?

    ReplyDelete
  10. And now after having hex file ,which programmer should be used to burn the hex file in to the microcontroller?

    ReplyDelete
  11. yes the connections in diagram are fine
    you can use magic burner or any other burner provided with your hardware

    ReplyDelete
  12. hi ratan sir

    This is manasa. I'm trying to generate birthday tune on 8051 micro controller . Could you please help in writing the code

    ReplyDelete
    Replies
    1. hi manasa,

      no need to change the code, just replace the buzzer with a preprogrammed buzzer which plays happy birthday tune.

      alternatively, it is needed to change the code and output different frequencies for a particular interval of time to generate the correct tune.

      the first option is the fastest and easiest one but often this buzzer are hard to find, i had a buzzer once which played 5 sounds and i have used it for my personal alarm along with a clock and counter.

      in case you don't find such type of buzzer follow the second option, here is a link of an article of the worlds most popular electronics magazine just go through it, you will find complete circuit and code...

      http://www.electronicsforu.com/electronicsforu/circuitarchives/view_article.asp?sno=461

      Delete
  13. Hi ratan Sir I am doing mini project about pir sensor based home security using buzzer and at89c51microcontroller please help me to write code and connections of circuit diagram

    ReplyDelete

About the author

Scholar Ratan pal singh is a Google scholar, a man with innovative ideas and a nothing is impossible attitude, is a tech-lover.
He works as a independent researcher and freelance website and software developer.
Member of IEEE comsoc society, Green technology society and has published research paper and codes in many international journals and opensource.

"Failure is the pillar of success and Honesty with oneself is the only true way of achieving self-confidence."

Translate

Pageviews