
Originally Posted by
oneohthree
'Transmitter Code
Include "Modedefs.bas"
trisb = 0
main:
u var byte : counter var byte : encode var byte : u = %1000
'u is the byte containing the input in binary, counter is a byte that describes the amount of bits to encode
'encode is the variable holding the encoded value
'Manchester encoding
For counter = 0 to 3
If u.0[counter]=0 Then
encode.0[counter*2]=0 : encode.0[counter*2+1]=1 'If it is a zero make the first bit 0 and second bit 1
Else
encode.0[counter*2]=1 : encode.0[counter*2+1]=0 'If not then make first bit 1 and second bit 0
EndIf
Next counter : <<<<<<<<<<<------- Here!!
write 0, encode 'Write to EEPROM Location 0
High 1 'High on Port B Pin 1
Pause 1000 'Pause
Low 1 'Low on Port B Pin 1
serout PORTB.0, n2400, [ $55 , $55 ,$55, $55, $aa , encode ]: 'send out preamble and encoded from Port B Pin 0
goto main
Bookmarks