Some code I dug up from one of my earlier projects that used the modules from Rentron. They aren't complete, the meat of what the code actually does has been removed, but it might give you a decent starting point to work with...

Transmitter code....


'use TWS/RWS modules, portb.2 pwr to xmtr, portb.1 xmtr data in, slave controller PCB for data

@ DEVICE PIC16F628A , INTRC_OSC , WDT_ON , PWRT_OFF , MCLR_OFF , BOD_ON , LVP_OFF , PROTECT_OFF

'Int 4Mhz Osc, WDT off, PWR up timer off, mclr ext, brown out detect on, low volt prog off , code protect off

resetplaceholder: 'arial black, size 8, reg, 16f628A code

INCLUDE "modedefs.bas"

DEFINE OSC 4 'using internal 4mhz, switch down to 37khz when in low power mode, eventually

DISABLE

CLEAR

selectkey var portb.5 : rightkey var portb.6 : leftkey var portb.7 : upkey var portb.0 : downkey var portb.3
input selectkey : input rightkey : input leftkey : input upkey : input downkey : dataout var portb.1 : output dataout
dataout = 0 : xmtrpwr var portb.2 : output xmtrpwr : xmtrpwr = 0 : key var byte : option_reg = 8 : cmcon = 7

'option = pullups enabled, ints disabled, prescaler to WDT, all comparators off

mainloop: key = 0
if ( selectkey = 1 ) and ( upkey = 1 ) and ( downkey = 1 ) and ( leftkey = 1 ) and ( rightkey = 1 ) then
xmtrpwr = 0 : pcon.3 = 0 : nap 2
'power down for a bit, slow clock to 37khz before going into nap

else 'send manchester encoded numbers 0-4, 0=01, 1=10, therfore '1010' = '10 01 10 01'

if xmtrpwr = 0 then
pcon.3 = 1 : xmtrpwr = 1 : pause 5 : key = $55 : serout2 dataout , 84 , [ REP key \ 24 ]
endif
if upkey = 0 then key = $66 '5= 01 10 01 10
if downkey = 0 then key = $56 '1= 01 01 01 10
if leftkey = 0 then key = $6a '6= 01 10 10 01
if rightkey = 0 then key = $5a '3= 01 01 10 10
if selectkey = 0 then key = $65 '4= 01 10 01 01

serout2 dataout , 84 , [ REP key \ 2 ] 'serout2 mode 188 = 4800 baud, 84 @ 9600, 8N1 formatting

endif
goto mainloop
END










Receiver code....
@ DEVICE PIC16F628A , HS_OSC , WDT_OFF , PWRT_ON , MCLR_ON , BOD_ON , LVP_OFF , PROTECT_OFF
'HS 20mhz, watchdog off, powerup timer on, mclr external, brown out detect on, low volt program off , code protect off

resetplaceholder: 'wordpad, arial black, size 8, reg, 1600x1200 screen, 16f628A code

DEFINE OSC 20 '20mhz
DEFINE NO_CLRWDT 1 'don't clear the watchdog timer, I'm not using it anyways
DISABLE 'disable software interrupt checks
CLEAR 'clear out the ram and do a software 'reset'

upkey var portb.0 : downkey var portb.3 : rxpwr var portb.4 : selectkey var portb.5 : rightkey var portb.6
leftkey var portb.7 : redled var porta.0 : greenled var porta.1 : blueled var porta.2 : chx var porta

serdata var byte : serbuf1 var byte : serbuf2 var byte : serialselecthold var byte
gooddatacount var byte : baddatacount var byte

startupholder: goto skipsubs 'skip over all the commonly used subroutines

ON INTERRUPT GOTO INTHANDLER
DISABLE INTERRUPT
INTHANDLER: if pir1.5 = 1 then 'if serial data rx'd
pir1.5 = 0 'reset the RX flag
if ( rcsta.1 = 1 ) or ( rcsta.2 = 1 ) then 'check for err, if frame/overrun error,
rcsta.4 = 0 : rcsta.4 = 1 : serdata = rcreg : serdata = 0 'reset CREN, clear last data rx'd
gooddatacount = 0 : if baddatacount < 255 then baddatacount = baddatacount + 1
else
serdata = rcreg : serbuf2 = serbuf1 : serbuf1 = serdata
baddatacount = 0 : if gooddatacount < 255 then gooddatacount = gooddatacount + 1
endif
endif

if nokeypress <> 0 then nokeypress = nokeypress - 1 'if a key has been hit lately, this counter serves as
'a debounce/delay keeping another key hit from being
'detected later

intfinish: RESUME

clearserbuf: serialselecthold = 0 : serdata = 0 : serbuf2 = 0 : serbuf1 = 0 : return 'clear serial buffer

increasecolor: color = color + 1 : if color = 8 then color = 1 'used in a few routines for stepping the colors
return

ENABLE INTERRUPT

DISABLE INTERRUPT 'pie1=$20 enables ser-port int., spbrg= 129@2400, 255@1200baud, 64@4800baud, 33@9600baud

skipsubs: option_reg = 8 : pie1 = $20 : trisa = 0 : porta = 0 : trisb = $ef : portb = $10 : t1con = 0 : t2con = 0
cmcon = 7 : ccp1con = 0 : vrcon = 0 : txsta = 0 : rcsta = $90 : pir1.5 = 0 : spbrg = 33 : mode = 0
lastmode = 0 : intcon = $e0 : modeset = 1

mainloop: if ( selectkey = 1 ) then
if ( upkey = 1 ) then
if ( downkey = 1 ) then
if ( leftkey = 1 ) then
if ( rightkey = 1 ) then goto mainmodeloop 'if no keys pressed, don't check
endif
endif
endif
endif

if nokeypress > 1 then goto mainmodeloop 'if a certain key was pressed lately,
' don't check for any new keys

if nokeypress < 10 then
if serbuf2 = serbuf1 then
select case serbuf1 'manchester encoded numbers 1-5
case $66
gosub clearserbuf : goto serialupkey
case $56
gosub clearserbuf : goto serialdownkey
case $6a
gosub clearserbuf : goto serialleftkey
case $5a
gosub clearserbuf : goto serialrightkey
case $65
if serialselecthold > 10 then
gosub clearserbuf : goto serialselectkey
else
serialselecthold = serialselecthold + 1
endif
end select
endif
endif
ENABLE INTERRUPT
goto mainloop 'do it all over again
END