financecatalyst
- 25th August 2009, 20:05
Hello
I have the following code in my PIC12F635 which I have attached to an Transmitter module (extracted from a doorbell):
//Tx Code:
cmcon0=%111
intcon=0
TRISIO=%011111
GPIO=0
w1 VAR word
Include "modedefs.bas"
START:
IF gpio.0=1 THEN zero
IF GPIO.1=1 THEN one
IF GPIO.2=1 THEN two
IF GPIO.4=1 THEN four
GOTO START
zero:
serout GPIO.5,N2400,["ty45",24]
pause 5
LOW GPIO.0
goto start
one:
serout GPIO.5,N2400,["ty45",51]
pause 5
LOW GPIO.1
goto start
two:
serout GPIO.5,N2400,["ty45",90]
pause 5
LOW GPIO.2
goto start
four:
serout GPIO.5,N2400,["ty45",36]
pause 5
LOW GPIO.4
goto start
Can someone please help me modify the code so the data can be safely transmitted (Incorporate manchester coding).
Here is my receiver code:
//Receiver Code:
intcon=0
cmcon0=%111
TRISIO=%001100
GPIO=0
w1 VAR word
Include "modedefs.bas"
start:
serin GPIO.2,N2400,100,start,["ty45"],w1
if w1=24 then five
if w1=51 then one
if w1=90 then four
if w1=36 then zero
goto start
zero:
toggle gpio.0
pause 2000
goto start
one:
toggle gpio.1
pause 2000
goto start
four:
toggle gpio.4
pause 2000
goto start
five:
toggle gpio.5
pause 2000
goto start
Please also advise me as to how to modify my receiver code to decode the manchester encoded data from my Tx.
Thanks a lot in advance
I have the following code in my PIC12F635 which I have attached to an Transmitter module (extracted from a doorbell):
//Tx Code:
cmcon0=%111
intcon=0
TRISIO=%011111
GPIO=0
w1 VAR word
Include "modedefs.bas"
START:
IF gpio.0=1 THEN zero
IF GPIO.1=1 THEN one
IF GPIO.2=1 THEN two
IF GPIO.4=1 THEN four
GOTO START
zero:
serout GPIO.5,N2400,["ty45",24]
pause 5
LOW GPIO.0
goto start
one:
serout GPIO.5,N2400,["ty45",51]
pause 5
LOW GPIO.1
goto start
two:
serout GPIO.5,N2400,["ty45",90]
pause 5
LOW GPIO.2
goto start
four:
serout GPIO.5,N2400,["ty45",36]
pause 5
LOW GPIO.4
goto start
Can someone please help me modify the code so the data can be safely transmitted (Incorporate manchester coding).
Here is my receiver code:
//Receiver Code:
intcon=0
cmcon0=%111
TRISIO=%001100
GPIO=0
w1 VAR word
Include "modedefs.bas"
start:
serin GPIO.2,N2400,100,start,["ty45"],w1
if w1=24 then five
if w1=51 then one
if w1=90 then four
if w1=36 then zero
goto start
zero:
toggle gpio.0
pause 2000
goto start
one:
toggle gpio.1
pause 2000
goto start
four:
toggle gpio.4
pause 2000
goto start
five:
toggle gpio.5
pause 2000
goto start
Please also advise me as to how to modify my receiver code to decode the manchester encoded data from my Tx.
Thanks a lot in advance