Joined: 01 Aug 2003
Location: Chicago, IL
|Posted: Sat Oct 04, 2003 7:36 pm Post subject: The $005A NEC protocol explained.
|For anyone who wants to see the actual source code, with detailed comments, there is a file in the fill section called 5a-commented.txt that has all of that. This post is just meant to be a quick reference for folks that want to tweek this protocol to create exactly the signal that they need. (There is also a zip file containing ASM and BAT files called: 5a-commented.zip).
For most of you this will probably go over your head, but don't worry about it, the folks that are likely to help you setup a complicated version of the NEC protocol will most likely understand it, and I'm writing it for their benefit.
I assume you already know what the NEC1, NEC2, NECx1 and NECx2 signals look like as I'm not going to try and explain that here.
The $005A protocol uses three bytes of fixed data. The first byte is a control byte that controls how the signals will be formatted, and that's what I'm discussing here. The remaining two bytes are the device codes.
I'm going to refer to the bits in the control byte like this B0, B1, B2, etc where B0 is the right most bit and B7 is the left most bit.
OK, onto the detail...
If B4 is set, an NECx signal will be created, otherwise it's NEC
If B5 is set, device code 2 comes from the fixed data, otherwise it's the complement of device code 1 (which does come from the fixed data)
If B0 is set, the signal is NEC2 or NECx2, otherwise it's NEC1 or NECx1
The following only applies to NEC1/NEC2 signals (not the NECx signals):
If B3 is set, use NEC2 for the repeatable buttons (ie, VOL+/-, CH+/-, REWIND and F.FWD).
If B1 is set, send the signal 2 times before jumping to the IR engine.
If B2 is set, there's some special handling for the RECORD button, if B5 is clear, use fixed byte3 as the device code (instead of fixed byte2), but if it's set, toggle bit7 of both device codes.
Here's some common non-standard values for this byte:
04: NEC1: B2=set, B5=clear (RECORD button handling)
05: NEC2: B2=set, B5=clear (RECORD button handling)
08: NEC1: B3=set, use NEC2 for the repeatable buttons
10: NECx1 (where dev2 is comp of dev1)
Please don't PM me with remote questions, post them in the forums so all the experts can help!