Ir Remote contrller reader

Discussion in 'Embedded Systems and Microcontrollers' started by micropad, Jan 27, 2013.

  1. micropad

    Thread Starter Member

    Dec 24, 2011
    38
    0
    Dear All
    This is related to PIC MCU 16f877a

    I need to read the Ir Remote controller signals and put the codes to LCD display
    I am using Sony remote controller
    I need to some tutorials about, kind of remote available and kind of protocols and there signals and number identification code table

    and I need to know which peripheral I should used.( Timers or CCP or USART) ( I do not know)

    If someone could point me in the right direction it would be greatly appreciated!

    Please advice
    Thanks in advance
     
    Last edited: Jan 27, 2013
  2. MrChips

    Moderator

    Oct 2, 2009
    12,449
    3,365
    micropad likes this.
  3. micropad

    Thread Starter Member

    Dec 24, 2011
    38
    0
    Dear MrChips Thanks for the reply

    Can I have the more simple info on that
    Thanks in advance
     
  4. MMcLaren

    Well-Known Member

    Feb 14, 2010
    759
    116
    I suspect you can find several examples in assembly language or c. There's some useful information about the 12 bit SIRC protocol here; http://www.sbprojects.com/knowledge/ir/sirc.php.

    You could use any number of methods to decode SIRC. Here's a pseudo C example for decoding 12-bit SIRC using a simple loop that samples the inverted output from a TSOP4838 IR decoder at 100 usec intervals;

    Code ( (Unknown Language)):
    1. ;
    2. ;  unsigned int sirc = 0;           //
    3. ;  unsigned char count = 0;         //
    4. ;  unsigned char cmd = 0;           //
    5. ;  unsigned char dev = 0;           //
    6. ;
    7. ;  #define irpin porta.0            //
    8. ;
    9. ;  while(1)                         //
    10. ;  { delay_ms(326);                 // repeat delay
    11. ;    sirc = 0;                      // reset 'sirc'
    12. ;    do                             //
    13. ;    { delay_us(100);               //
    14. ;      if(irpin == 0)               // if irpin lo
    15. ;      { count++;                   // bump 100-us 'lo' count
    16. ;      }                            //
    17. ;      else                         // if irpin hi
    18. ;      { if(count)                  // if unprocessed lo pulse
    19. ;        { if(count > 2000/100)     // if 2400-us 'start' bit
    20. ;          { sirc.12 = 1;           // insert bit counter bit
    21. ;          }                        //
    22. ;          else                     //
    23. ;          { if(sirc)               // if decode in progress
    24. ;              if(count > 900/100)  // if a 1200-us '1' bit
    25. ;                sirc.13 = 1;       // insert a '1'
    26. ;            sirc >>= 1;            //
    27. ;          }                        //
    28. ;          count = 0;               // reset 'lo' width count
    29. ;        }                          //
    30. ;      }                            //
    31. ;    } while(sirc.0 == 0);          //
    32. ;    cmd = sirc >> 1 & 0x7F;        // copy 7-bit 'cmd' code
    33. ;    dev = sirc >> 8;               // copy 5-bit 'dev' code
    34. ;    ~~~                            // do "stuff" here
    35. ;  }                                //
    36. ;
    37.  
     
  5. micropad

    Thread Starter Member

    Dec 24, 2011
    38
    0
    Dear MMaLaren,
    Thanks for the reply

    Could you please guide me what is the most suitable peripheral among following for read IR sensor output

    Capture
    USART
    TImers

    Please advice
     
Loading...