PIC16F877A – Interfacing Buzzer
PIC 16F877A Mini Development Board has an on-board buzzer connected to port pin RE0 via jumper J19. If jumper is left open, then the corresponding port pin can be used independently.
Schematic
Note: To use buzzer, don’t forget to short jumper J19. Leaving it open frees RE0 and it can be used for any other desired purpose.
Sample Code
The sample code to check on-board buzzer is given below. Pressing SW3 turns on the buzzer and releasing it turns the buzzer off.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
/**************************************************************** HEADER FILES *****************************************************************/ #include<pic.h> /**************************************************************** MAIN FUNCTION *****************************************************************/ void main() { TRISE0 = 0; /* Configure RE0 as o/p */ TRISB5 = 1; /* Configure RB5 as i/p */ while(1) { if(RB5==0) /* If SW3 is pressed, RB5 is low */ { RE0 = 1; /* Buzzer ON */ while(RB5 == 0); /* Wait here till switch is released */ } else if(RB5 == 1) /* If SW3 is released, RB5 is high */ { RE0 = 0; /* Buzzer OFF */ while(RB5 == 1); /* Wait here till switch is pressed */ } } } /********************** END OF PROGRAM ************************/ |
Topics related to PIC16F877A Development Board-Mini
- PIC16F877A Mini Development Board – Overview
- PIC16F877A Mini Development Board – Interfacing LED
- PIC16F877A Mini Development Board – Interfacing LCD
- PIC16F877A Mini Development Board – Serial communication(USART)
- PIC16F877A Mini Development Board – Interfacing Switch
- PIC16F877A Mini Development Board – Interfacing Buzzer
- PIC16F877A Mini Development Board – Interfacing POT(ADC)
- PIC16F877A Mini Development Board – Interfacing Temperature sensor
- PIC 16F877A Mini Development Board – Interfacing Servo Motor
- PIC 16F877A Mini Development Board – Interfacing μRFID Reader
Resources
- Datasheets
How to buy?
- Click here to buy rhydoLABZ PIC 16F877A Mini Development Board
- Click here to buy rhydoLABZ PIC 18F4520 Mini Development Board
- Click here to buy rhydoLABZ PIC 18F4550 Mini Development Board
- Click here to buy rhydoLABZ PIC 18F4580 Mini Development Board
SupportPlease share your ideas with us, visit our forum for discussion
Leave a Reply
You must be logged in to post a comment.