1. This forum section is a read-only archive which contains old newsgroup posts. If you wish to post a query, please do so in one of our main forum sections (here). This way you will get a faster, better response from the members on Motherboard Point.

NEC(?) IR remote control protocol

Discussion in 'Embedded' started by Jim, Feb 16, 2004.

  1. Jim

    Jim Guest

    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
     
    Jim, Feb 16, 2004
    #1
    1. Advertising

  2. Jim

    Noel Henson Guest

    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
     
    Noel Henson, Feb 16, 2004
    #2
    1. Advertising

  3. Jim

    Jim Guest

    "Noel Henson" <> wrote in message
    news:jlcYb.27040$...
    > 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, Feb 17, 2004
    #3
  4. On Tue, 17 Feb 2004 09:26:17 -0000, "Jim" <> wrote:

    >"Noel Henson" <> wrote in message
    >news:jlcYb.27040$...
    >> 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.
     
    Mike Harrison, Feb 17, 2004
    #4
  5. Jim

    Jim Guest

    "Mike Harrison" <> wrote in message
    news:...
    > On Tue, 17 Feb 2004 09:26:17 -0000, "Jim" <> wrote:
    >
    > >"Noel Henson" <> wrote in message
    > >news:jlcYb.27040$...
    > >> 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
     
    Jim, Feb 17, 2004
    #5
  6. Jim

    Noel Henson Guest

    Jim wrote:

    > "Noel Henson" <> wrote in message
    > news:jlcYb.27040$...
    >> 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
     
    Noel Henson, Feb 17, 2004
    #6
  7. Jim

    Jim Guest

    "Noel Henson" <> wrote in message
    news:lKqYb.27165$...
    <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
     
    Jim, Feb 17, 2004
    #7
  8. Jim

    Noel Henson Guest

    Jim wrote:

    > "Noel Henson" <> wrote in message
    > news:lKqYb.27165$...
    > <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
     
    Noel Henson, Feb 18, 2004
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    391
  2. Scarfie

    Pioneer Remote Control Protocol

    Scarfie, Sep 30, 2004, in forum: Embedded
    Replies:
    0
    Views:
    698
    Scarfie
    Sep 30, 2004
  3. ElderUberGeek
    Replies:
    6
    Views:
    483
    Paul Carpenter
    Feb 14, 2006
  4. Ron Shaw

    no Remote wonder remote control

    Ron Shaw, Sep 4, 2006, in forum: ATI
    Replies:
    1
    Views:
    441
    Amanda Hugenkiss
    Sep 22, 2006
  5. Chris H.

    Re: remote desktop as "remote control"

    Chris H., Aug 25, 2004, in forum: Tablet PC
    Replies:
    13
    Views:
    390
    Cliff
    Aug 26, 2004
Loading...

Share This Page