I like this method...seems simple enough even for me to understand. Does anyone have any comments about the method itself or changing the leading/falling edge setting in the middle of the program? I'd assume I'd have to disable the interrupt before I changed it. Can I change it from inside the ISR? Josh Mahmood Elnasser wrote: > > You can set the interrupt on both rising edge and falling edge , first set > it on rising edge , when the interrupt occurs set it on falling edge in the > rising edge interrupt routine and vice versa , I think I did my reception > this way and I recall that the ir stream has a start bit of 20 us then 16 > bit code then 16 bit key code , depending on your remote control of course > . and the output is always hi the pulses are low. first you have to check > that the start bit is the right length otherwise you just ignore the rest > and the hi is 4 usec pulse and the low is 7 u sec , check it with a DSO or > logic analyzer . if u keep the key on the remote pressed down you get just > the start bit and 1 pulse of certain duration and not the rest of the code > , this is useful for things like volume up and volume down etc . > > ----- Original Message ----- > From: "Josh Koffman" > To: > Sent: Sunday, December 02, 2001 9:56 PM > Subject: [PIC]: What's the best way to decode IR? > > > Ok, since I can't seem to find anyone that's really done exactly what I > > want to do, I seem to be forging new ground. Unfortunately, I'm not that > > great at it, so I have a few questions. I plan on using one of the > > little IR modules to decode the actual IR signal and give me a ttl out. > > The question now is, what's the best way to deal with it? I'd like to > > stay away from just polling, because the PIC will be doing a bunch of > > other things, and I don't want to run the risk of missing IR pulses. I > > could use the external interrupt, so that every time there is a pulse > > I'd check a TMR. The problem I see there is that I have to set the > > interrupt to trigger on rising edge or falling edge, I can't do both. I > > don't want to mess with portB interrupt on change. I was thinking I > > could use the CCP module, but I don't really know how. I guess it would > > trigger when it receives a pulse from the IR module, then captures the > > value in the TMR. Then I could check the value of that against what my > > high and low timings should be, and go from there. Again I think I run > > into the rising/falling edge thing though. I'm really confused here. I'm > > sure that there is a solution somewhere, I just can't quite figure it > > out. > > > > If you have any ideas or suggestions, they will be appreciated! > > > > Thanks, > > > > Josh > > -- > > A common mistake that people make when trying to design something > > completely foolproof is to underestimate the ingenuity of complete > > fools. > > -Douglas Adams > > > > -- > > http://www.piclist.com hint: To leave the PICList > > mailto:piclist-unsubscribe-request@mitvma.mit.edu > > > > > > > > -- > http://www.piclist.com hint: To leave the PICList > mailto:piclist-unsubscribe-request@mitvma.mit.edu -- A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools. -Douglas Adams -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu