HI,
I am almost finish writing my code and I get an error at the receivring end, I have an LCDout and the sending end, it good number, but at the receiving end the information is confused.
meaning the Left is showing the same thing as the sending left.
But the right is showing me number like 12421 (pot at center). I encode and decode he same way, This is weird. what also struck me is that number 12421 is constant, so that when I move my pot there is a variation from 12542 to 12288 .
I also flipped the serin line for left and right and i get the same result..
(the sending and show number varying between 0 to 255)
here is a snippet of the code:
right var word : left var word : temp var word : counter var byte
rightold var word : leftold var word : speedright var word : speedleft var word
loop:
waitfor55:
serin portb.2 , n2400 , temp
if temp <> $55 then goto waitfor55
waitforaa:
serin portb.2 , n2400 , temp : if temp <> $aa then goto waitforaa
serin portb.2, n2400, rightold.LowBYTE : serin portb.2, n2400, rightold.HighBYTE
serin portb.2, n2400, leftold.LowBYTE : serin portb.2, n2400, leftold.HighBYTE
For counter=0 TO 7 'decoding
left.0[counter]=leftold.0[counter*2]
right.0[counter]=rightold.0[counter*2]
Next counter
Lcdout $fe, 1 'Clear screen
Lcdout "Left: ", Dec left
Lcdout $fe, $C0, "Right: ", DEC right
Pause 100
before you ask, here is my sending part:
send:
Lcdout $fe, 1 'Clear screen
Lcdout "Left: ", Dec left
Lcdout $fe, $C0, "Right: ", DEC right
serout portb.2, n2400,[$55,$55,$55,$55,$55,$55,$55,$55,$aa]
serout portb.2, n2400,[rightnew.LowBYTE,rightnew.HighBYTE]
serout portb.2, n2400,[leftnew.LowBYTE,leftnew.HighBYTE]
goto loop
end
Bookmarks