PIC16F877A – Interfacing LED
PIC16F877A Mini Development Board has 3 SMD LEDs connected to port pins RB1, RB2 and RB3 via jumpers J1, J2 and J10 respectively. If any jumper is left open, then the corresponding port pin can be used independently.The sample code given below toggles the LEDs in fixed intervals. Jumpers (J1/J2/J10) have to be shorted accordingly for using the desired LED.
Schematic
Sample Code
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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
/************************************************************************* HEADER FILES **************************************************************************/ #include<pic.h> /************************************************************************* FUNCTION DECLARATIONS **************************************************************************/ void Delay_Ms(unsigned int); /************************************************************************* MAIN FUNCTION **************************************************************************/ void main() { TRISB=0x00; /* PORTB configured as o/p */ while(1) { PORTB=0xFF; /* Make port pins high to turn on LEDs */ Delay_Ms(500); /* Delay fuction called for 500ms */ PORTB=0x00; /* Make port pins low to turn off LEDs */ Delay_Ms(500); /* Delay fuction called for 500ms */ } } /************************************************************************* * Function : Delay_Ms * * * * Description : Function for delay * * * * Parameter : ms - delay in milliseconds * **************************************************************************/ void Delay_Ms(unsigned int ms) { int i,count; for(i=1; i<=ms; i++) { count = 498; while(count != 1) { count--; } } } /*************************** 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.