For one thing, I would take the SEROUT out of your loop: SEROUT takes a fair amount of time, and you will lose any IR pulses after the first while servicing the SEROUT.Save pulses to an array as you capture them, then SEROUT when done with capture.

Also, the tolerance on this:
Code:
 if (pulse < 220) or (pulse > 260) then start
might be a little tight to capture the 240msec AGC pulse at the start. See below.


From the link I gave you:

Code:
Decode:                             '// Shift right to remove bit RA.0
   H_Add = (PORTA >> 1) & %00011111 '// AND with %00011111 to mask upper 3-bits
                                    '// RA.1 to RA.5 = 5-bit hardware address
Decode2:
   PULSIN PORTA.7,0,PULSE_IN        '// Read-in start pulse
   IF (PULSE_IN < 200) OR (PULSE_IN = 0) THEN '// Less than Start pulse, then keep looking
    Loops = 0                       '// Reset Loops on idle or key release
    IF LM = 1 THEN Decode           '// If mode = latching, don't change outputs.
    PORTB = 0                       '// Mode = momentary. Key = released or idle
    GOTO Decode                     '// so clear outputs & return.
   ENDIF

Verify:                              '// Read, Decode, then verify data
   FOR Index = 0 TO 12               '// Setup to read-in 13 pulses
    PULSIN PORTA.7,0,IR_PULSE[Index] '// Read 13 low-going pulses on RA.7
   NEXT Index                        '// Loop x times
   DBYTE = $FF                       '// Start with all 1's and find each 0
   FOR Index = 0 TO 7                '// Get 8 "data" bits
    IF IR_PULSE[Index] < 100 THEN DBYTE.0[Index]=0 '// Less than 1mS = 0
   NEXT Index
   ABYTE = $FF           '// Start with all 1's and find each 0 in pattern
   X=0                   '// Initialize address bit index pointer to bit 0
   FOR Index = 8 TO 12   '// Get 5 address bits from IR_PULSE bits 8-12
    IF IR_PULSE[Index] < 100 THEN ABYTE.0[X]=0
    X = X + 1            '// Increment address bit index pointer
   NEXT Index
   ABYTE = ABYTE & %00011111 '// Mask out upper 3-bits. Result = 5-bit address.
is a good start. ABYTE and DBYTE together give you the 12 bit decoded command.