Hi Guys

Ok, I am totaly stumpped with this, I have tried to use a timer as suggested by dhouston & I have been trying the pulsin method as suggested by bogdan but I get the same problem, the start pulse is all over the place, it ranges from 0 to 255 etc, it seems random.
I have changed the ir reciver to eliminate a fault there and I checked the output on my scope and it seems to show a correct pattern.

God knows what I am doing wrong, I just wonder if it is down to the pic's i use 18f4550 & 18f14k50 ?, I have even changed the oscillator down to 4mhz to try and copy bogdan's pulsin code (shown below), also I dont know why the example uses a word var for the pulsin, am I missing something there ?.
Maths is not my strong point so maybe I'm just reading things worong I dunno but I've been at this a week now and cant get the same start pulse 2 times in a row.

Could someone check the code below and tell me why I dont get values in the range of 400 - 490 ?.


'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
INCLUDE "AllDigital.pbp" 'Set ALL ports to Digital i/o
DEFINE OSC 4 ;=4MHz
DEFINE PULSIN_MAX 490

Header VAR WORD '<-- why is this a 'word' instead of a byte ?
index VAR BYTE
IR_pulse VAR BYTE[31]
IR_data VAR BYTE[31]
PORTC=0
TRISC=%000001 ;PORTC.0 input for the IR



'Note, device is a 18f4550

IRIN:
PULSIN PORTC.0,0,Header

IF (Header < 400) OR (Header > 490) THEN GOTO IRIN '<-- problem, values I get are not between 400 to 490


goto irin