IR Remote Control Include File

  • Anonymous - 2014-04-24

    Hi gang,

    Here's my next contribution. I've taken my previous work with IR remote controls and worked it up into a header file. If you find it acceptable, then it might make a nice addition to the Include folder.

    I put tons and tons of explanations, both hardware and software, in the file itself as comments. But I wanted to let you know here that I have tested this on two different surplus IR sensors, and two different remote controls (one surplus, one brand new) and every combination works great. I believe it will work with most any IR sensor running at a 38 kHz carrier frequency. And keep your eyes open for surplus remote controls; they show up all the time here in the US for a dollar or two. So, not only is it easy to add remote control to our projects, but it's cheap, too.

    As usual, I'll start with a demo program that uses it, and attach the include file in the next posting.

    ;This demo prints the device number and key number sent by
    ;a Sony compatible IR remote control unit.
    ;Thomas Henry --- 4/23/2014
    #chip 16F88, 8                    ;PIC16F88 running at 8 MHz
    #config mclr=off                  ;reset handled internally
    #config osc=int                   ;use internal clock
    #include <SonyRemote.h>           ;include the header file
    ;----- Constants
    #define LCD_IO      4             ;4-bit mode
    #define LCD_RS      PortB.2       ;pin 8 is Register Select
    #define LCD_Enable  PortB.3       ;pin 9 is Enable
    #define LCD_DB4     PortB.4       ;DB4 on pin 10
    #define LCD_DB5     PortB.5       ;DB5 on pin 11
    #define LCD_DB6     PortB.6       ;DB6 on pin 12
    #define LCD_DB7     PortB.7       ;DB7 on pin 13
    #define LCD_NO_RW   1             ;ground RW line on LCD
    #define IR_DATA_PIN PortA.0       ;sensor on pin 17
    ;----- Variables
    dim device, button as byte
    ;----- Program
    dir PortA in                      ;A.0 is IR input
    dir PortB out                     ;B.2 - B.6 for LCD
      readIR_Remote(device, button)   ;wait for button press
      cls                             ;show device code
      print "Device: "
      print device
      locate 1,0
      print "Button: "                ;show button code
      print button
      wait 10 mS                      ;ignore any repeats
    loop                              ;repeat forever
    Last edit: Anonymous 2014-04-24
  • Anonymous - 2014-04-24

    Here's the header file:


    JANIS - 2014-04-24

    Hally, Thomas Henry!
    This program is the same as in the previous...?
    sony remote control commands have different topology than the other manufacturers, the first bits of the command, but after that's address bits, but for the other remote controls is in the reverse order.

  • Anonymous - 2014-04-25

    I modified the code to make it suitable for an include file.

    By my count, there are over fifteen different protocols in use today. Sony's is by far the most common in my country, which is why it's so easy to find control units second-hand or surplus. But, as mentioned previously, a universal remote, especially that cheap one I just described, always knows the Sony standard, and so there's no reason why a person can't put this into practice at once without spending much.

    But feel free to modify the code if you think another protocol would be useful to you.


    JANIS - 2014-04-25

    Hallo, Thomas Henry!
    I do not understand how you can get 2.4 ms, and further 0.6 and 1.2 ms? I'll try to create code to another protocol.


    JANIS - 2014-04-28

    Hallo, Thomas Henry! pulse can be used to measure the length of the command pulsein?

  • Anonymous - 2014-05-01

    Hello Janis,

    2.4 mS, 0.6 uS and 1.2 mS are 2400 uS, 600 uS and 1200 uS, respectively. I simply count in units of 100 uS. In other words, I look for values of 24, 6 and 12. Check out the comments in the include file.

    Pulsein didn't seem to be well documented, so I just wrote my own. Again, the include file explains how it works.


    JANIS - 2014-05-05

    Hallo, Thomas Henry!
    I do not know , why command pulsein is not included in great cow basic help? For it is written here:

    • Anobium

      Anobium - 2014-05-05

      Good point! It will be now!

      thank you.

  • Chuck Hellebuyck

    Thanks for visiting my pages.
    I originally created that command page to supplement the original limited help file
    (I also have a lot to add to that command page I just need to find more time).
    It all started when I was reading through the GCB source files and found many undocumented commands that have now been added to the Help file thanks to the great work by Anobium to improve it significantly.

    Thanks for catching that missing PULSEIN command from the help file. I thought it was already added.
    Anobium will take care of it as he usually does.


    JANIS - 2014-05-13

    Hallo, Thomas Henry!
    Please, help to create a code reader for any remote control? The idea is - reading codes from several buttons and enter them in EEPROM, so after pushing the button, these codes can recognize, change the bit values​​, to be operate with variety devices.
    I think this could be used pulsein command, respectively, to count pulses length of the specified time period and write in EEPROM ...? I think that different remote controls for each button the time will be different.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks