Extended NEC protocol (not used in this demonstration)
The NEC protocol is so widely used that soon all possible addresses were used up. By sacrificing the address redundancy the address range was extended from 256 possible values to approximately 65000 different values. This way the address range was extended from 8 bits to 16 bits without changing any other property of the protocol. The command redundancy is still preserved. Therefore each address can still handle 256 different commands.in extended protocol instead of sending address and address inverse we send address low and address high as shown in the image blow.
Repeat Codes
If the key on the remote controller is kept depressed, a repeat code will be issued, typically around 40ms after the pulse burst that signified the end of the message. A repeat code will continue to be sent out at 108ms intervals, until the key is finally released. The repeat code consists of the following, in order:
A 9ms leading pulse burst
A 2.25ms space
A 562.5µs pulse burst to mark the end of the space (and hence end of the transmitted repeat code).
the figures give blow show the timing of repeat codes
if user keeps the key depressed the repeat codes keep coming
T8 shows the timing of repeat code
Encoding NEC Protocol with microcontroller
Schematic
As shown in the schematic and the pcb images this circuit use PIC12F615 as infrared encoder , the IR LED is driven by a separate npn transistor for longer range and the Coin cell Battery CR2032 is used to power the whole infrared remote. battery nominal voltage is 3.0V volts but as the datasheet says the PIC12F615 can work down to 2.0V.
for GP4,GP5,GP1,GP0 internal pullups are being used but the GP3 pullup can’t be used for GIPO as its is internally connected to MCLRE .
The current Consumption of the Circuit in sleep mode is around 35nA which is less then what datasheet claims. the CR2032 coin cell battery will last quite some time.
Hardware
Source Code
the Software utilize the internal PWM capability of the PIC12F615 to generate quite stable and accurate carrier frequency of 38Khz. most of the time Micro stay in the sleep mode ,even Brown out is enabled only when the wake mode to save battery. the current consumption is around 35nA when sleeping.
GitHub Repo.
Click Here to download Source code.