Hi Guys & Gals

I'm going nuts

I am trying to decode the NEC remote protocol and I've been at it for days, I cant even measure the 9ms start pulse!

I have tried to use the pulsin command and I have also used a timer to measure the start pulse but no mater what method I use I get a different pulse width every time I press a remote button, even with the same button, even with different remotes, I just cant figure this out.

IF YOU HAVE SOME NEC CODE PLEASE SHARE


'-----------------------------------------------------------------------------
'Defines for EasyPic3
DEFINE LCD_DREG PORTB ' Define LCD registers and bits
DEFINE LCD_DBIT 4
DEFINE LCD_RSREG PORTB
DEFINE LCD_RSBIT 2
DEFINE LCD_EREG PORTB
DEFINE LCD_EBIT 3

DEFINE OSC 20

include "lcddefs.bas" 'easy LCD
INCLUDE "AllDigital.pbp" 'Set ALL ports to Digital i/o
pause 400

startpulse var byte
main:

startpulse = 0

pulsin portc.0,0,startpulse
if startpulse > 0 then

lcdout cmd,clss, cmd,movtoB12, dec startpulse
pause 1000
endif

GoTo main
'--------------------------------------------------------------------------------------

What am I doing wrong ?