I ripped the interesting parts from a working program. It transmits RC5 codes via an IRLED, modulation is 38.5kHz. Not exactly 38kHz but close enough. There are loads of information on the net regarding addresses, commands and all the rest you need to know about RC5.

This link seems to cover just about all you need to know.
http://info.fuw.edu.pl/~pablo/s/opis...dge/ir/rc5.htm

Have fun.
/Ingvar
Code:
DEFINE OSC 4

SendIRword      VAR WORD
SendIRcommand   VAR BYTE
SendIRaddr      VAR BYTE
SendIRtoggle    VAR BIT
SendIRbit       VAR BIT
Counter         VAR BYTE

SendIRpin       VAR PortB.0 'connect IRLED via resistor to ground

LOW SendIRpin



Send_IR:
    SendIRword = %0000000000000110
    SendIRword = (SendIRword + SendIRtoggle) << 5
    SendIRword = (SendIRword + SendIRaddr) << 6
    SendIRword = (SendIRword + SendIRcommand)
    FOR bitcounter = 13 TO 0 STEP -1
        SendIRbit = ~(SendIRword.0(bitcounter))
        GOSUB ToggleSendPin
        SendIRbit = SendIRword.0(bitcounter)
        GOSUB ToggleSendPin
    NEXT
    SendIRpin = 0
    RETURN

ToggleSendPin:
    IF SendIRbit THEN
        FOR Counter = 1 TO 34
            SendIRpin = 1
            ASM
            nop
            nop
            nop 
            nop
            nop
            nop
            nop
            nop 
            ENDASM        
            SendIRpin = 0
            ASM
            nop
            nop
            nop 
            nop
            nop
            nop
            nop
            nop 
            ENDASM                
        NEXT
    ELSE
        PAUSEUS 875
    ENDIF        
    RETURN