PIC18F4550 – Interfacing LED
PIC18F4550 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.
SchematicSample 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 |
/***************************************************************** HEADER FILES ******************************************************************/ #include<pic18.h> /***************************************************************** FUNCTION DECLARATIONS ******************************************************************/ void Delay_ms(int ms); /***************************************************************** 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 to keep LEDs ON for sometime */ PORTB = 0X00; /* Make port pins low to turn off LEDs */ Delay_ms(500); /* Delay to keep LEDs OFF for sometime */ } } /***************************************************************** * Function : Delay_ms * * * * Description : Function for delay * * * * Parameter : ms - delay in milliseconds * ******************************************************************/ void Delay_ms(int ms) { int i,count; /* Local variables */ for(i=1; i<=ms; i++) /* Loop here to create delay */ { count = 498; while(count!=1) { count--; } } } |
Topics related to PIC18F4550 Mini Development Board
- PIC18F4550 Mini Development Board – Overview
- PIC18F4550 Mini Development Board – Interfacing LED
- PIC18F4550 Mini Development Board – Interfacing LCD
- PIC18F4550 Mini Development Board – Serial communication(USART)
- PIC18F4550 Mini Development Board – Interfacing Switch
- PIC18F4550 Mini Development Board – Interfacing Buzzer
- PIC 18F4550 Mini Development Board – Interfacing POT(ADC)
- PIC18F4550 Mini Development Board – Interfacing Temperature sensor
- PIC18F4550 Mini Development Board – Interfacing Servo Motor
- PIC18F4550 Mini Development Board – Interfacing μRFID
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
Support
Please share your ideas with us, visit our forum for discussion
Leave a Reply
You must be logged in to post a comment.