Obviously I missed a few posts.
Thanks for the info there Ioannis.
I searched the forum some more this morning and I was able to whip out a tx/rx pair that ALMOST works, based on code tidbits I found..
At the moment the two modules are connected with wires but once I get the code rectified a bit, I'll move up to RF modules.
I say "ALMOST" because the tx part seems to be working ok, however the receiver isn't quite there yet.
Here is the code that I'm using for transmitting (I have observed it on the oscilloscope and it appears to be working):
dataport var PORTB.0
START:
serout2 PORTB.0,813,[$55, $55, $55, $AA]
mydata = "T"
dataport = $00
pause 1000
goto start
ENCODEMANCHESTER:
ManchesterWord=0
For CounterA=0 to 7
If MyData.0=0 then
ManchesterWord.14=1
else
ManchesterWord.15=1
endif
If CounterA<7 then ManchesterWord=ManchesterWord>>2
MyData=MyData>>1
Next CounterA
serout2 dataport,396,[manchesterword.lowbyte, manchesterword.highbyte]
Return
And here is the receiver code:
RECEPTION var PORTB.0
INFO VAR PORTB.2
ERROR var PORTB.1
START:
manchesterword=0
SERIN2 reception, 813, [WAIT($AA),ManchesterWord.LowByte,ManchesterWord.Hi ghByte]
gosub ManchesterDecode
goto start
ManchesterDecode:
ErrorFlag=0
For CounterA=0 to 7
If ManchesterWord.1=0 then
MyData.7=0
ERROR = 0
If ManchesterWord.0=0 then
ErrorFlag=1
ERROR = 1
endif
else
MyData.7=1
ERROR = 0
If ManchesterWord.0=1 then
ErrorFlag=1
ERROR = 1
endif
endif
ManchesterWord=ManchesterWord>>2
If CounterA<7 then MyData=MyData>>1
NEXT COUNTERA
serout2 info, 813, [Mydata]
Return
I set PORTB.1 as an indicator telling me whether or not the Manchester code has errors in it... I was monitoring that pin with a scope and not once did it light up, yet I'm getting garbage coming out on pin 2.
Somehow I'm thinking that the receiver code is missing something but I'm hoping if you guys could point out where the problem lies.
thanks
Alex
Bookmarks