Hi!
I'm not sure I have completely understood what you mean by "i have success in detecting pulses but counting and changes with respect to numbers."
But let's have this straight:
First of all, you may know that IR protocol frequency may vary from 38 to 42 KHz. The IR protocol varies slightly with every manufacturer, but tends to be like the japanese NEC protocol, where 0's are defined as 1 HIGH period and 1 low period and 1' as 1 HIGH period and 2 or 3 LOW periods.
This first Samsung document has self explanatory flowcharts that will help you programming the AT89S52. Also it explains in a very detailed manner how their own protocol works. However you'd have to find the codes of the numbers, volume, keys, etc. by yourself.
http://www.samsung.com/global/busin...F80KB_RemoteController_AN_REV000_090108-0.pdf
This one, from JVC, explains again how their protocol works and they give your all of the codes assigned to every single key. It will also provide you with great insight with the exact timings required.
http://support.jvc.com/consumer/support/documents/RemoteCodes.pdf
Then there's the Sony protocol (SIRC) which uses, again, a different encoding but its flowchart is really enlightening.
Please note this document is not directly from Sony as the others were. This one is from
http://picprojects.org.uk/.
http://www.cypress.com/?docID=46755
And if you have some time, this video from Dave Jones will give and excellent approach:
http://www.eevblog.com/2013/08/12/eevblog-506-ir-remote-control-arduino-protocol-tutorial/
Hope this helps!