Here is a IR remote code I used way back for a Remote Robot using a Sony remote control.



Hope it helps

Code:
define  LOADER_USED 1


DEFINE  OSC 20
start:
	ADCON1 = 7 
    'angleVar VAR BYTE	' set up constants with the minimum and maximum pulsewidths
	'SERVO1 CON 450
	'SERVO2 CON 1000	' set up a constant with the time between pulses:
	refreshPeriod CON 20
	A  VAR BYTE	' set an initial pulsewidth:
	'angleVar = minAngle
    TRISB = 0
    TRISA = %00000100
    P_VAL VAR WORD
    IR_DEV  VAR BYTE
    IR_BUT  VAR BYTE
    HEADER  VAR WORD
    BITCNT  VAR BYTE
    PACKET  VAR WORD
    DIRINF  VAR BYTE
    
    SEROUT2 PORTC.6,32,["START  " , 10,13]
main:
	GOSUB IRIN
    SELECT CASE IR_BUT
    CASE $10
    GOSUB LEFT
    CASE $11
    GOSUB RIGHT
    CASE $12
    GOSUB FWD
    
    CASE $13
    GOSUB RE
    
    CASE $14
    GOSUB ST
    
    CASE ELSE
    
    END SELECT
    
 
GoTo main
'Recieve a signel from a Sony remote control
' and return with a 7 bit button code
' IR_BUT and a 5 bit device code IR_DEV in the variable IR_DEV
' if no header then IR_DEV and IR_BUT hold 255

IRIN:   IR_DEV = 255:IR_BUT = 255
        PULSIN PORTA.2,0,HEADER 'Measure header 
        IF HEADER < 1000 THEN RETURN
        IF HEADER > 1350 THEN RETURN ' VERIFY GOOD HEADER IF BAD RETURN
        FOR BITCNT = 0 TO 11
            PULSIN PORTA.2,0,P_VAL
            IF p_VAL >= 450 THEN
                PACKET.0[BITCNT] = 1
                ELSE
                PACKET.0[BITCNT] = 0
            ENDIF
        NEXT
        'Split the 7 bit button code and the 5 bit device code
        IR_BUT = PACKET & %01111111
       
        IR_DEV = (PACKET>>7) & %00011111
        SEROUT2 PORTC.6,32,["BUTTON =", HEX IR_BUT, 10,13]
RETURN


FWD:
FOR A = 1 TO 20
	Low PORTB.7
	Low PORTB.6
 ' pulse the pin
	PulsOut PORTB.7, 450
	PulsOut PORTB.6, 1000
 ' pause for as long as needed:
	Pause refreshPeriod
NEXT A

RETURN

RE:
FOR A = 1 TO 20
	Low PORTB.7
	Low PORTB.6
 ' pulse the pin
	PulsOut PORTB.7, 1000
	PulsOut PORTB.6, 450
 ' pause for as long as needed:
	Pause refreshPeriod
 NEXT A
RETURN
ST:
Low PORTB.7
Low PORTB.6
'PAUSE 1000
RETURN

LEFT:
FOR A = 1 TO 20
	Low PORTB.7
	Low PORTB.6
 ' pulse the pin
	PulsOut PORTB.7, 1000
	PulsOut PORTB.6, 1000
 ' pause for as long as needed:
	Pause refreshPeriod
 NEXT A
RETURN


RIGHT:
FOR A = 1 TO 20
	Low PORTB.7
	Low PORTB.6
 ' pulse the pin
	PulsOut PORTB.7, 450
	PulsOut PORTB.6, 450
 ' pause for as long as needed:
	Pause refreshPeriod
 NEXT A
RETURN