NEC1 and NECx1 IRP definitions

If you have learned signals that don't get decoded when you look at them in IR.exe, post your file to the Diagnosis Area then post your question here (including a link to the file).

Moderator: Moderators

cyborg5
Posts: 5
Joined: Sat Jan 25, 2014 1:09 pm

NEC1 and NECx1 IRP definitions

Post by cyborg5 »

I've been looking at the IRP definitions for variants of the NEC protocol and I'm seeing some logical discrepancies. I'm referring to your wiki page here: http://www.hifi-remote.com/wiki/index.p ... odeIR#NECx

First of all NEC1 and NEC2 both show it to end with…1,-78 which is a stop bit followed by 78 units of SPACE. However on NECx, Apple, TiVo, and Pioneer all of which are variants of NEC it shows an ending of …1,^108m which means a stop bit followed by sufficient space for 108ms total extent. Other online references I found suggest that this 108ms extent is the correct value. Similarly on the ditto repeat sequence NEC shows (16, -4,1, -173)*where I believe it should be (16, -4, 1,^108m)*

Another discrepancy is with the ditto codes on NECx. The NEC1 ditto shows an nonstandard header, followed by a single stop bit and then the long blank. NECx1 ditto shows (8, -8,D:1,1^108m)*

That essentially is the standard NECx header followed by a single data bit followed by a stop bit and the extent. This raises 2 questions… First should it be (8,-4 etc.) with a nonstandard header like NEC1. Secondly are there really two bits before the long space. Specifically should it be (8,-8,1,^108m) or perhaps (8,-4,1,^108m)

I have never encountered a ditto repeat for NECx. I've only seen NECx2 without the ditto.

A bit of background about me. I'm not really into JP1 remotes, and maintain a library of code for Arduino microcontrollers. My "Bible" for understanding protocols was that page that used to be at
http://www.hifi-remote.com/johnsfine/DecodeIR.html
That particular page disappeared some time ago and I was counting my lucky stars that I had managed to save an off-line PDF copy of that page for my own use. I only recently discovered your wiki that seems to be the same information. I'm glad to see it back online again and hopefully it can be maintained and updated as new information becomes available. Anyway the bottom line is even though I've been supporting NEC and NBCx protocols in my code since the beginning, I was not supporting dittos in NECx. I would like to modify the code to support it if it really exists but I want to make sure that I'm doing it right since as I said I've never really seen NECx1 only NECx2.

Has anyone here had any experience with this protocol?

By the way for further information about my Arduino code you can visit
http://tech.cyborg5.com/irlib/
The Robman
Site Owner
Posts: 22008
Joined: Fri Aug 01, 2003 9:37 am
Location: Chicago, IL
Contact:

Re: NEC1 and NECx1 IRP definitions

Post by The Robman »

cyborg5 wrote:My "Bible" for understanding protocols was that page that used to be at
http://www.hifi-remote.com/johnsfine/DecodeIR.html
That particular page disappeared some time ago...
Thanks for letting me know that that page had disappeared, as it wasn't intentional, it must have got dropped when I switched servers. At any rate, I just restored it.
Rob
www.hifi-remote.com
Please don't PM me with remote questions, post them in the forums so all the experts can help!
cyborg5
Posts: 5
Joined: Sat Jan 25, 2014 1:09 pm

Post by cyborg5 »

I'm glad to see the page is back. The version I had captured was 2.43 and the current one is version 2.45 so there was new information that may prove useful. In fact it answered one of the 2 questions. NEC really does use 1,^108m extent. That had been corrected. Note however it is still incorrect on the wiki page.

I would still like some confirmation about the exact nature of the ditto for NECx1. If anyone has actually seen that protocol in action can you confirm its structure is properly described in the IRP notation (8,-8,D:1,1^108m)
The Robman
Site Owner
Posts: 22008
Joined: Fri Aug 01, 2003 9:37 am
Location: Chicago, IL
Contact:

Post by The Robman »

cyborg5 wrote:I would still like some confirmation about the exact nature of the ditto for NECx1. If anyone has actually seen that protocol in action can you confirm its structure is properly described in the IRP notation (8,-8,D:1,1^108m)
If you want to know which devices use NECx1, you can download the following file, which is a catalog of all the upgrades in the file section, and then filter it to just show the NECx1 upgrades:
https://www.hifi-remote.com/forums/dload ... e_id=13718

Can you read S3C8 assembler? The following file is a commented copy of the executor that generates NEC signals in JP1 remotes, so you can see exactly what the executor generates for each variant:
https://www.hifi-remote.com/forums/dload ... le_id=2095
Rob
www.hifi-remote.com
Please don't PM me with remote questions, post them in the forums so all the experts can help!
The Robman
Site Owner
Posts: 22008
Joined: Fri Aug 01, 2003 9:37 am
Location: Chicago, IL
Contact:

Post by The Robman »

Btw, I have corrected the Wiki for NEC1 and NEC2.
Rob
www.hifi-remote.com
Please don't PM me with remote questions, post them in the forums so all the experts can help!
cyborg5
Posts: 5
Joined: Sat Jan 25, 2014 1:09 pm

Post by cyborg5 »

The Robman wrote:If you want to know which devices use NECx1, you can download the following file, which is a catalog of all the upgrades in the file section, and then filter it to just show the NECx1 upgrades:
https://www.hifi-remote.com/forums/dload ... e_id=13718
The problem is I don't have a JP1 remote to play with so those files don't help much. I have other brands of universal remotes so I might try programming it to one of the devices listed in the spreadsheet as using NECx1 and see if I can get it to generate the ditto. I have Samsung TVs that use NECx2 and did not generate dittos so there don't help.
The Robman wrote:Can you read S3C8 assembler? The following file is a commented copy of the executor that generates NEC signals in JP1 remotes, so you can see exactly what the executor generates for each variant:
https://www.hifi-remote.com/forums/dload ... le_id=2095
This was more useful. The code is well commented and if I follow the logic correctly the only difference between NEC and NECx is when it copies the header off time to the header on time. I do not detect it doing anything different for the dittos.

That confirms my suspicion that the IRP specification for NECx1 to have the ditto exactly like NEC1.
The Robman
Site Owner
Posts: 22008
Joined: Fri Aug 01, 2003 9:37 am
Location: Chicago, IL
Contact:

Post by The Robman »

What about the 1 bit "device code" in the NECx ditto?

When I get a chance, I will learn an NECx1 signal to see first hand how it's formatted.

Given how involved you are in remote stuff already, I would strongly recommend that you get a JP1 remote, just so you can try stuff out. You can get a Nevo C2 for under $17 shipped from China, and it comes with its own cable!
http://www.ebay.com/itm/251875255703
Rob
www.hifi-remote.com
Please don't PM me with remote questions, post them in the forums so all the experts can help!
vickyg2003
Site Admin
Posts: 7109
Joined: Sat Mar 20, 2004 12:19 pm
Location: Florida
Contact:

Post by vickyg2003 »

NECx1 ditto shows (8, -8,D:1,1^108m)*
If 1,-3 is 1, the ditto should be
(8,-8,1:1,1,^108m)*)
Remember to provide feedback to let us know how the problem was solved and share your upgrades.

Tip: When creating an upgrade, always include ALL functions from the oem remote, even if you never plan on assigning them to a button. Complete function lists makes an upgrade more helpful to others.
cyborg5
Posts: 5
Joined: Sat Jan 25, 2014 1:09 pm

Post by cyborg5 »

vickyg2003 wrote:NECx1 ditto shows (8, -8,D:1,1^108m)*
If 1,-3 is 1, the ditto should be
(8,-8,1:1,1,^108m)*)
Yet the ditto for NEC is (16,-4,1,^108m). Do you really need the extra "1:1"? Logically the only thing that changes between NEC and NECx is a header. That's why I think the NECx1 ought to be (8,-8,1,^108m). Your suggestion of "1:1" rather than "D:1" makes more sense to me but I just want to make sure that extra bit really needs to be in there since it is not there on the NEC1. Also looking at the code that someone sent me the link to, I don't see where the NECx handling code does the ditto differently.
vickyg2003
Site Admin
Posts: 7109
Joined: Sat Mar 20, 2004 12:19 pm
Location: Florida
Contact:

Post by vickyg2003 »

cyborg5 wrote:Your suggestion of "1:1" rather than "D:1" makes more sense to me but I just want to make sure that extra bit really needs to be in there since it is not there on the NEC1.
Maybe it doesn't make sense, but it is there. Here is a picture of a Necx1 signal


http://getzweb.net/random/Necx1.JPG
Whoops, this looks a little huge but you can definately see the 1:1.
Remember to provide feedback to let us know how the problem was solved and share your upgrades.

Tip: When creating an upgrade, always include ALL functions from the oem remote, even if you never plan on assigning them to a button. Complete function lists makes an upgrade more helpful to others.
cyborg5
Posts: 5
Joined: Sat Jan 25, 2014 1:09 pm

Post by cyborg5 »

Many thanks. That's the proof I needed.
The Robman
Site Owner
Posts: 22008
Joined: Fri Aug 01, 2003 9:37 am
Location: Chicago, IL
Contact:

Post by The Robman »

Vicky, I know you love those graphs, but you really should get used to looking at the raw times. In my opinion they're much easier to read. Could you post the raw times that go along with that graph? (Btw, I will convert your pic to a link as it's making the thread too wide)

cyborg5, here's a snippet of the assembler that generates the NECx1 signal, you can clearly see that a 1-bit device code is included in the ditto portion:

Code: Select all

                                       ; *** NECx processing ***
8062:   E4 20 1E   LD    R1E, R20      ; set header ON time = OFF time
8065:   E4 21 1F   LD    R1F, R21      ; 

8068:   37 01 EB   BTJRT 8056H, RC0.0  ; if control-bit0=1 (NECx2), jump to main-exit
806B:   F6 01 36   CALL  0136H         ; send IR signal

                                       ; *** setup repeat pattern ***
806E:   E6 28 C1   LD    R28, #C1H     ; change IR settings (see below)
8071:   60 04      COM   R04           ; comp dev1 ???
8073:   E6 12 01   LD    R12, #01H     ; set device code length to 1
8076:   8B E4      JR    805CH         ; send IR and exit

*** new IR settings (used at 806E)
806E:   R28 = C1 = '11000001'
        6   =  1 = ???
        5/4 = 00 = format: device, command
        3/2 = 00 = don't send command bytes
        1/0 = 01 = single word of R12 bits
Rob
www.hifi-remote.com
Please don't PM me with remote questions, post them in the forums so all the experts can help!
The Robman
Site Owner
Posts: 22008
Joined: Fri Aug 01, 2003 9:37 am
Location: Chicago, IL
Contact:

Post by The Robman »

Ok, here's the timing for a random NECx1 signal...

Once:
+4400 -4400 +550 -1650 +550 -550 +550 -550 +550 -550 +550 -550 +550 -550 +550 -550 +550 -1650 +550 -1650 +550 -550 +550 -550 +550 -550 +550 -550 +550 -550 +550 -550 +550 -1650 +550 -550 +550 -1650 +550 -550 +550 -1650 +550 -1650 +550 -550 +550 -550 +550 -550 +550 -1650 +550 -550 +550 -1650 +550 -550 +550 -550 +550 -1650 +550 -1650 +550 -1650 +550 -47300

Repeat:
+4400 -4400 +550 -550 +550 -97350

or, in binary...
Once: +4400 -4400 10000001100000010101100010100111 +550 -47300
Repeat: +4400 -4400 0 +550 -97350
Rob
www.hifi-remote.com
Please don't PM me with remote questions, post them in the forums so all the experts can help!
3FG
Expert
Posts: 3440
Joined: Mon May 18, 2009 11:48 pm

Post by 3FG »

cyborg5,
Similarly on the ditto repeat sequence NEC shows (16, -4,1, -173)*where I believe it should be (16, -4, 1,^108m)*
These two versions of IRP describe identical IR signals. In the first, the ditto has a total duration of (16+4+1+171) * 564uS or 108.2mS. The second describes a total duration of 108mS. Actually the same considerations apply to NEC1 and NEC2--as originally defined by NEC and implemented in the uPD6122 IC--because the actual definition of NEC1 and 2 require that the second and fourth bytes are the binary complement of the first and third bytes. So the payload has a fixed duration regardless of the values being transmitted.

However, over time, companies started breaking the rules in two ways. One was to change the lead-in and lead-out times, and to repeat the value of the first byte into the second byte. (In the nomenclature we use now, we say that NECx1 and NECx2 nearly always set S=D.) I imagine these changes were made to avoid paying royalties to NEC. Secondly, as more flexible ICs became available, the rule which requires that the second byte be the binary complement of the first was abandoned. But the same overall frame time was retained. The IR community didn't describe this as a new protocol, and so now the correct description of what we call NEC uses an extent.
vickyg2003
Site Admin
Posts: 7109
Joined: Sat Mar 20, 2004 12:19 pm
Location: Florida
Contact:

Post by vickyg2003 »

Rob wrote: Vicky, I know you love those graphs, but you really should get used to looking at the raw times. In my opinion they're much easier to read. Could you post the raw times that go along with that graph? (Btw, I will convert your pic to a link as it's making the thread too wide)
The raw timings are listed on the graph.
I was trying to shrink the picture down, here to make it a more manageable size, but then I couldn't read the numbers. I didn't want to force the user off into unknown domain.


What this does point out is that I don't understand the repeats.
In the official doc it said D:1, but that is not the case in the random Necx1 signal that i captured. In mine it was and yours it looks like its ~D:1
. I guess it would take more studies to figure out what this is supposed to be. I guess it would take more study .

My Repeat Ditto
+4400 -4400 +550 -1550 +550 -97470
Your Repeat Ditto:
+4400 -4400 +550 -550 +550 -97350
Post Reply