dolphinlabs
...
Doplhin labs
News

PIC18F4520-Buzzer Interfacing


·         Program statement: Interfacing of  buzzer with PIC18F4520 controller

Connections: PORT RC0= Buzzer

Hardware connections for PIC184520 Board:

1.      Give supply to the Board with the help of adapter.

2.      Connect +5V pin of PIC controller to +5v supply and GND pin of controller to GND pin of supply.

3.      Connect RC0 pin of controller to BUZZER

4.      Connect +5V pin of Buzzer interface block to +5v supply pin and GND pin of Buzzer to GND pin of supply.

 

Circuit Diagram:

 

 

Program Code:

#include<P18f4520.h>

#define buz PORTCbits.RC0                                            //connect buzzer to PORTC.0 bit

void delay();

void main()

{

                TRISC=0x00;                                                      //PORT C as output

                while(1)

                {

                                buz=1;                                                   //make buz high

                                delay();                                                  //call delay

                                buz=0;                                                   //make buz low                   

                                delay();                                                  //call delay

                }

}

void delay()

{

                int i,j;

                for(i=0;i<200;i++)

                  for(j=0;j<100;j++);

}

 

 

 

 

 

 

 


Get SOCIAL







SAFE & SECURE SHOPPING

visa card master card maestro card
Maverick IT Industries Pvt. Ltd.