Use this as your receiver code
Code:
Define OSC 4
intcon=0
cmcon0=7
TRISIO=%001100
GPIO=0
w1 VAR byte
prevw1 var byte
Include "modedefs.bas"
@ __CONFIG _INTRC_OSC_NOCLKOUT & _WDT_ON & _PWRTE_ON & _MCLRE_OFF & _CP_ON & _BOD_ON & _CPD_ON & _IESO_OFF & _FCMEN_ON & _WUREN_OFF
start:
serin GPIO.2,N2400,["pl65"],w1
if w1 <> prevw1 then ' new command not same as prev
prevw1 = w1 ' update the value of prev command
gpio = 0
if w1=24 then gpio.5=1 ' and change the output
if w1=51 then gpio.1=1
'if w1=90 then gpio.4=1
'if w1=36 then gpio.0=1
pause 500 ' you may not need this line now
endif
goto start
Bookmarks