I just did this recently, with an IR LED with a PIC12F629 for the transmi= tter=20 and a 3-pin 38khz IR receiver module with a PIC16F628 for the receiver. = I=20 came up with my own 8-bit coding scheme, which has start and stop bits. = The=20 receiver module goes low when it senses a 38khz signal, so I used... =09(1) Wait for negative-edge interrupt =09(2) Interrupt off. Set TMR0 for 0.5 T (where pulse (bit) width =3D T= ) =09(3) Read pin state and set in a register (let's call it CODE) =09(4) Set TMR0 for 1 T =09(5) Read pin state =09(6) Left-shift into the CODE register =09(7) Repeat from step 4 until 8 total bits received. =09(8) Ensure blank for some interval time, then reset, interrupt on, et= c. The first 0.5 T sets the point of reading to be in the middle of the puls= e. Then check the code with what you have. Fairly simple. Cheers, -Neil. On Saturday 17 April 2004 08:54 am, Matt Marsh scribbled: > Hi guys, > > For my second PIC project, I'm going to need to detect a button > being pressed on an IR remote control. I've done a small amount of > research on this and from what I've read I'm going to need to hook > up an IR receiver to one of the pins and then time how long pulses > last (and/or the gaps between them depending on the remote). > > So, in order to determine how long a pulse lasts I'm thinking that > I'm going to need to do something like: > > - loop waiting for pin to go high > - reset TMR0 > - loop waiting for pin to go low > - value in TMR0 now contains length of time of pulse > > I just wanted to get some feedback whether I'm thinking of this in > the right way, or whether there is some other technique that is > generally used for timing pulses etc. > > Thanks, > Matt -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics