Header Ads

IR Remote controller circuit use PIC Microcontroller

Welcome to MINA TECHNOLOGY.

In this tutorial we will learn how to remote controller circuit use PIC Microcontroller. Here I am use PIC16F877A and TSOP1838. I am use Mikro C Pro for PIC compiler for code editing. You can watch the video or read the written tutorial below.




Circuit Diagram





Mikro C Code:
# define IR PORTD.RD7  // IR is connect to RD7
// Lcd module connections
sbit LCD_RS at RB0_bit;
sbit LCD_EN at RB1_bit;
sbit LCD_D4 at RB2_bit;
sbit LCD_D5 at RB3_bit;
sbit LCD_D6 at RB4_bit;
sbit LCD_D7 at RB5_bit;

sbit LCD_RS_Direction at TRISB0_bit;
sbit LCD_EN_Direction at TRISB1_bit;
sbit LCD_D4_Direction at TRISB2_bit;
sbit LCD_D5_Direction at TRISB3_bit;
sbit LCD_D6_Direction at TRISB4_bit;
sbit LCD_D7_Direction at TRISB5_bit;
// End lcd module connnections
int i =0;
void main() {
     TRISC.F0 = 0X00;                               // PORTC in output
     TRISD = 0X80;                                       // RD7 is input
     PORTC.F0 = 0X00;                               // clear PORTC
     PORTD = 0X00;                                      // Clear PORTD
     Lcd_Init();                                                   // Initialize Lcd module
     Lcd_Cmd(_LCD_CURSOR_OFF);                 // Lcd cursor off
     Lcd_Cmd(_LCD_CLEAR);                               // Led clear
     Lcd_Out(1,3,"DEVELOPED BY");                   // Lcd show "DEVELOPED BY"
     Lcd_Out(2,1,"MINA TECHNOLOGY");             // Lcd show "MINA TECHNOLOGY"
     delay_ms(2000);                                                // 2s delay
     Lcd_Cmd(_LCD_CLEAR);                                  // Lcd clear
     Lcd_Out(1,3,"IR Remote");
     Lcd_Out(2,3,"Controller");
     delay_ms(2000);
     Lcd_Cmd(_LCD_CLEAR);
     Lcd_Out(1,5,"IR Reciver");                                   // Lcd show "LATCH"
     Lcd_Out(2,1,"LED:");                                     // Lcd show "LED:"

     while(1){                                                     // Endless loop
              if(IR==0){
                        while(IR==0);                          // wait for SW release
                        i++;                                               // Increase value
                        }

              PORTC.F0 = i;
              if(i==2)i=0;
              if(i==0){
                       Lcd_Out(2,5,"OFF");
                       }
              else{
                   Lcd_Out(2,5,"ON ");
                   }
              }


}


Click the download button for program file:
download










1 comment:

  1. Hi, I have a question, is it needed a capacitor for this proyect? Is there any danger to the PIC if I don't add one? Thanks.

    ReplyDelete

Theme images by 5ugarless. Powered by Blogger.