I am reading ADC values from a 20M and trying to transmit them to an 18X. I can send bits correctly, but sending three byte values are received by the 18X but not the correct values. I have tried a many variations but nothing seems to give the the correct values. Here is the code:
-----------------------------------------------------------------
'PICAXE 20M slave
b1=254
b2=1
b7=192
start:
SEROUT 0,n2400,(b1,b2)' clear LCD
readadc 1,b4
readadc 2,b5
readadc 3,b6
pause 100
SEROUT 0,n2400,(#b4," ",#b5," ",#b6)
pause 100:serout 0,n2400,(b1,b7,"waiting ")
pause 100:serin 6,n4800,("go")
pause 1000
high 7
pause 100
SEROUT 7,n4800,(b4,b5,b6)' send data
pause 100:SEROUT 0,n2400,(b1,b2)' clear LCD
pause 100:serout 0,n2400,("data sent")
pause 1000
goto start
-------------------------------------------------------------------------
' PIXACE18X MASTER
start:
SEROUT 4, t4800, ("?f") ' clear the LCD
pause 100:SEROUT 4, t4800, ("Master")
pause 100:SEROUT 4, t4800,("?n","press to retr data..")
main:
if pin1=1 then goto gtdat
goto main
gtdat:
SEROUT 4, t4800, ("sending go")
pause 100:serout 5, n4800,("go")
pause 100:SEROUT 4, t4800,("?n","retriving data..")
serin 2,t4800,b4,b5,b6
pause 100:SEROUT 4, t4800, ("?f") ' clear the LCD
pause 100:SEROUT 4, t4800,(#b4," ",#b5," ",#b6)
pause 3000
SEROUT 4, t4800, ("?f") ' clear the LCD
goto start
-----------------------------------------------------------------
'PICAXE 20M slave
b1=254
b2=1
b7=192
start:
SEROUT 0,n2400,(b1,b2)' clear LCD
readadc 1,b4
readadc 2,b5
readadc 3,b6
pause 100
SEROUT 0,n2400,(#b4," ",#b5," ",#b6)
pause 100:serout 0,n2400,(b1,b7,"waiting ")
pause 100:serin 6,n4800,("go")
pause 1000
high 7
pause 100
SEROUT 7,n4800,(b4,b5,b6)' send data
pause 100:SEROUT 0,n2400,(b1,b2)' clear LCD
pause 100:serout 0,n2400,("data sent")
pause 1000
goto start
-------------------------------------------------------------------------
' PIXACE18X MASTER
start:
SEROUT 4, t4800, ("?f") ' clear the LCD
pause 100:SEROUT 4, t4800, ("Master")
pause 100:SEROUT 4, t4800,("?n","press to retr data..")
main:
if pin1=1 then goto gtdat
goto main
gtdat:
SEROUT 4, t4800, ("sending go")
pause 100:serout 5, n4800,("go")
pause 100:SEROUT 4, t4800,("?n","retriving data..")
serin 2,t4800,b4,b5,b6
pause 100:SEROUT 4, t4800, ("?f") ' clear the LCD
pause 100:SEROUT 4, t4800,(#b4," ",#b5," ",#b6)
pause 3000
SEROUT 4, t4800, ("?f") ' clear the LCD
goto start