Motherboard Forums


Reply
Thread Tools Display Modes

NEC(?) IR remote control protocol

 
 
Jim
Guest
Posts: n/a
 
      02-16-2004, 06:38 PM
I want to decode the output from a remote control handset that uses what
some call the "NEC" protocol, reference:
http://www.xs4all.nl/~sbp/knowledge/ir/nec.htm

Not sure if "NEC" is the official name for it, as Googling for that does not
get many results.

It's a very simple protocol so I can write the decoding source from scratch,
but if there is some around already I'd be grateful of the time-saving, plus
any extra robustness that it might have over my attempts

FWIW I'm targetting a PIC12F629, but code for any microcontroller (assembler
or C) would be great, thanks.

Jim


 
Reply With Quote
 
 
 
 
Noel Henson
Guest
Posts: n/a
 
      02-16-2004, 11:26 PM
Jim,

This stuff easily fits into 12C508. I do it quite a bit for a client.
Because of this, I can't give you the software. You can buy cheap chips
(12cxxx and 16cxxx based) from him if you need a quick solution. You can
get them from www.infraredremote.com. Done properly you can even get by
with the internal 4.0MHz RC oscillator.

Other than that, you will want to download the datasheet from a TSOP1238
from Vishay. You'll need to compensate for the pulse stretching and pulse
width distortions cause by modern IR receiver internal AGC and filter
circuits.

Noel

Jim wrote:

> I want to decode the output from a remote control handset that uses what
> some call the "NEC" protocol, reference:
> http://www.xs4all.nl/~sbp/knowledge/ir/nec.htm
>
> Not sure if "NEC" is the official name for it, as Googling for that does
> not get many results.
>
> It's a very simple protocol so I can write the decoding source from
> scratch, but if there is some around already I'd be grateful of the
> time-saving, plus any extra robustness that it might have over my attempts
>
>
> FWIW I'm targetting a PIC12F629, but code for any microcontroller
> (assembler or C) would be great, thanks.
>
> Jim


--
Noel's Lab
www.noels-lab.com
Chips, firmware, circuits and embedded systems
 
Reply With Quote
 
 
 
 
Jim
Guest
Posts: n/a
 
      02-17-2004, 09:26 AM
"Noel Henson" <(E-Mail Removed)> wrote in message
news:jlcYb.27040$(E-Mail Removed). net...
> Jim,
>
> This stuff easily fits into 12C508. I do it quite a bit for a client.
> Because of this, I can't give you the software. You can buy cheap chips
> (12cxxx and 16cxxx based) from him if you need a quick solution. You can
> get them from www.infraredremote.com. Done properly you can even get by
> with the internal 4.0MHz RC oscillator.
>
> Other than that, you will want to download the datasheet from a TSOP1238
> from Vishay. You'll need to compensate for the pulse stretching and pulse
> width distortions cause by modern IR receiver internal AGC and filter
> circuits.
>
> Noel
>
> Jim wrote:


Many thanks for the info, Noel. In fact I need to use a PIC12F629 as it's
got other work to do as well as the decoding. It's a great chip for our
application - internal 8MHz oscillator with +/-1% accuracy or so and runs ok
from 3.3V. I don't think it costs much more than the gold ol' 12C508.

In fact, I've already got an IR receiver module (actually a Hero Electronics
HIM702HM, as it was easier and cheaper to get hod of than a Vishay for me at
the time). The output from it looks fine after some crude distance/obstacle
testing, so I'm ready to start coding. Just didn't want to rewrite the wheel
if someone has already done it and it's available.

Thanks too for the head-up re pulse stretching and distortions. That's
exactly the kind of thing I'm worried I'll miss if I write the code myself.
If I do my own code, I'll build in some slack for those possibilities.

Jim


 
Reply With Quote
 
Mike Harrison
Guest
Posts: n/a
 
      02-17-2004, 11:29 AM
On Tue, 17 Feb 2004 09:26:17 -0000, "Jim" <(E-Mail Removed)> wrote:

>"Noel Henson" <(E-Mail Removed)> wrote in message
>news:jlcYb.27040$(E-Mail Removed) .net...
>> Jim,
>>
>> This stuff easily fits into 12C508. I do it quite a bit for a client.
>> Because of this, I can't give you the software. You can buy cheap chips
>> (12cxxx and 16cxxx based) from him if you need a quick solution. You can
>> get them from www.infraredremote.com. Done properly you can even get by
>> with the internal 4.0MHz RC oscillator.
>>
>> Other than that, you will want to download the datasheet from a TSOP1238
>> from Vishay. You'll need to compensate for the pulse stretching and pulse
>> width distortions cause by modern IR receiver internal AGC and filter
>> circuits.
>>
>> Noel
>>
>> Jim wrote:

>
>Many thanks for the info, Noel. In fact I need to use a PIC12F629 as it's
>got other work to do as well as the decoding. It's a great chip for our
>application - internal 8MHz oscillator with +/-1% accuracy or so and runs ok
>from 3.3V. I don't think it costs much more than the gold ol' 12C508.


Internal osc is 4MHz, not 8MHz.


 
Reply With Quote
 
Jim
Guest
Posts: n/a
 
      02-17-2004, 01:26 PM
"Mike Harrison" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> On Tue, 17 Feb 2004 09:26:17 -0000, "Jim" <(E-Mail Removed)> wrote:
>
> >"Noel Henson" <(E-Mail Removed)> wrote in message
> >news:jlcYb.27040$(E-Mail Removed) .net...
> >> Jim,
> >>
> >> This stuff easily fits into 12C508. I do it quite a bit for a client.
> >> Because of this, I can't give you the software. You can buy cheap chips
> >> (12cxxx and 16cxxx based) from him if you need a quick solution. You

can
> >> get them from www.infraredremote.com. Done properly you can even get by
> >> with the internal 4.0MHz RC oscillator.
> >>
> >> Other than that, you will want to download the datasheet from a

TSOP1238
> >> from Vishay. You'll need to compensate for the pulse stretching and

pulse
> >> width distortions cause by modern IR receiver internal AGC and filter
> >> circuits.
> >>
> >> Noel
> >>
> >> Jim wrote:

> >
> >Many thanks for the info, Noel. In fact I need to use a PIC12F629 as it's
> >got other work to do as well as the decoding. It's a great chip for our
> >application - internal 8MHz oscillator with +/-1% accuracy or so and runs

ok
> >from 3.3V. I don't think it costs much more than the gold ol' 12C508.

>
> Internal osc is 4MHz, not 8MHz.
>


You're right of course. Thanks for the correction.

- Jim


 
Reply With Quote
 
Noel Henson
Guest
Posts: n/a
 
      02-17-2004, 03:49 PM
Jim wrote:

> "Noel Henson" <(E-Mail Removed)> wrote in message
> news:jlcYb.27040$(E-Mail Removed). net...
>> Jim,
>>
>> This stuff easily fits into 12C508. I do it quite a bit for a client.
>> Because of this, I can't give you the software. You can buy cheap chips
>> (12cxxx and 16cxxx based) from him if you need a quick solution. You can
>> get them from www.infraredremote.com. Done properly you can even get by
>> with the internal 4.0MHz RC oscillator.
>>
>> Other than that, you will want to download the datasheet from a TSOP1238
>> from Vishay. You'll need to compensate for the pulse stretching and pulse
>> width distortions cause by modern IR receiver internal AGC and filter
>> circuits.
>>
>> Noel
>>
>> Jim wrote:

>
> Many thanks for the info, Noel. In fact I need to use a PIC12F629 as it's
> got other work to do as well as the decoding. It's a great chip for our
> application - internal 8MHz oscillator with +/-1% accuracy or so and runs
> ok from 3.3V. I don't think it costs much more than the gold ol' 12C508.
>
> In fact, I've already got an IR receiver module (actually a Hero
> Electronics HIM702HM, as it was easier and cheaper to get hod of than a
> Vishay for me at the time). The output from it looks fine after some crude
> distance/obstacle testing, so I'm ready to start coding. Just didn't want
> to rewrite the wheel if someone has already done it and it's available.
>
> Thanks too for the head-up re pulse stretching and distortions. That's
> exactly the kind of thing I'm worried I'll miss if I write the code
> myself. If I do my own code, I'll build in some slack for those
> possibilities.
>
> Jim


Jim,

The BEST way to test your code is to use one of the outputs as a temporary
test signal. While using a scope or, preferably a logic analyzer, you can
monitor the input from the receiver and the test signal. Have the test
signal Change state to show the start and stop time of your timing
windows, that way you can make sure that you are sampling in the center of
the window. Or, if you're using an interrupt-on-change function along with
a timer, you can use the test signal to show timeouts.

One of the easiest ways to decode on the 629 is to use the interrupt pin
set for any edge. Use a timer to measure the time between the edges. You
can then use a simple 'within-range' function or subroutine to determine
what the bits are and if they are valid.

Have fun!

Noel

--
Noel's Lab
www.noels-lab.com
Chips, firmware, circuits and embedded systems
 
Reply With Quote
 
Jim
Guest
Posts: n/a
 
      02-17-2004, 06:06 PM
"Noel Henson" <(E-Mail Removed)> wrote in message
news:lKqYb.27165$(E-Mail Removed). net...
<snip>
> Jim,
>
> The BEST way to test your code is to use one of the outputs as a temporary
> test signal. While using a scope or, preferably a logic analyzer, you can
> monitor the input from the receiver and the test signal. Have the test
> signal Change state to show the start and stop time of your timing
> windows, that way you can make sure that you are sampling in the center of
> the window. Or, if you're using an interrupt-on-change function along with
> a timer, you can use the test signal to show timeouts.
>
> One of the easiest ways to decode on the 629 is to use the interrupt pin
> set for any edge. Use a timer to measure the time between the edges. You
> can then use a simple 'within-range' function or subroutine to determine
> what the bits are and if they are valid.
>
> Have fun!
>
> Noel
>
> --
> Noel's Lab
> www.noels-lab.com
> Chips, firmware, circuits and embedded systems


Hi Noel,

Thank you for more of your tips; it's much appreciated. I will do as you
suggest, using an interrupt-on-change from the input pin plus a timer, with
the provisos you've mentioned. A simple state machine should be sufficient
hopefully for the command decoding.

As an aside, I really enjoy coding towards this kind of task, but thought I
should check there isn't already some free source code out there first!

Jim


 
Reply With Quote
 
Noel Henson
Guest
Posts: n/a
 
      02-18-2004, 05:51 AM
Jim wrote:

> "Noel Henson" <(E-Mail Removed)> wrote in message
> news:lKqYb.27165$(E-Mail Removed). net...
> <snip>
>> Jim,
>>
>> The BEST way to test your code is to use one of the outputs as a
>> temporary test signal. While using a scope or, preferably a logic
>> analyzer, you can monitor the input from the receiver and the test
>> signal. Have the test signal Change state to show the start and stop time
>> of your timing windows, that way you can make sure that you are sampling
>> in the center of the window. Or, if you're using an interrupt-on-change
>> function along with a timer, you can use the test signal to show
>> timeouts.
>>
>> One of the easiest ways to decode on the 629 is to use the interrupt pin
>> set for any edge. Use a timer to measure the time between the edges. You
>> can then use a simple 'within-range' function or subroutine to determine
>> what the bits are and if they are valid.
>>
>> Have fun!
>>
>> Noel
>>
>> --
>> Noel's Lab
>> www.noels-lab.com
>> Chips, firmware, circuits and embedded systems

>
> Hi Noel,
>
> Thank you for more of your tips; it's much appreciated. I will do as you
> suggest, using an interrupt-on-change from the input pin plus a timer,
> with the provisos you've mentioned. A simple state machine should be
> sufficient hopefully for the command decoding.
>
> As an aside, I really enjoy coding towards this kind of task, but thought
> I should check there isn't already some free source code out there first!
>
>
> Jim


You're a quick study. It looks like you'll do just fine.
Noel


--
Noel's Lab
www.noels-lab.com
Chips, firmware, circuits and embedded systems
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
no Remote wonder remote control Ron Shaw ATI 1 09-22-2006 01:57 PM
Bit-level protocol or text-based protocol? (PC to embedded) ElderUberGeek Embedded 6 02-14-2006 10:16 AM
Pioneer Remote Control Protocol Scarfie Embedded 0 09-30-2004 03:08 PM
Re: remote desktop as "remote control" Chris H. Tablet PC 13 08-26-2004 01:22 AM
NEC remote control protocol question me@cpit.ac.nz Embedded 0 04-29-2004 10:44 AM


All times are GMT. The time now is 06:53 PM.


Welcome!
Welcome to Motherboard Point
 

Advertisment