Datasheet

while (temp <> 0x0E)
temp = Man_Receive(error_) ' Attempt byte receive
if (error_ <> 0) then ' If error occured
Lcd_Chr_CP("?") ' Write question mark on Lcd
Inc(ErrorCount) ' Update error counter
if (ErrorCount > 20) then ' In case of multiple errors
temp = Man_Synchro() ' Try to synchronize again
'Man_Receive_Init() ' Alternative, try to Initialize
Receiver again
ErrorCount = 0 ' Reset error counter
end if
else ' No error occured
if (temp <> 0x0E) then ' If "End" byte was received(see
Transmitter example)
Lcd_Chr_CP(temp) ' do not write received byte on Lcd
end if
Delay_ms(25)
end if
wend ' If "End" byte was received exit do loop
wend
end.
The following code is code for the Manchester transmitter, it shows how to use the
Manchester Library for transmitting data:
program Manchester_Transmitter
' Manchester module connections
dim MANRXPIN as sbit at PORTB.B0
MANRXPIN_Direction as sbit at DDRB.B0
MANTXPIN as sbit at PORTB.B1
MANTXPIN_Direction as sbit at DDRB.B1
' End Manchester module connections
dim index, character as byte
s1 as char[17]
main:
s1 = "mikroElektronika"
Man_Send_Init() ' Initialize transmitter
while TRUE ' Endless loop
Man_Send(0x0B) ' Send "start" byte
Delay_ms(100) ' Wait for a while
character = s1[0] ' Take first char from string
index = 0 ' Initialize index variable
253
MIKROELEKTRONIKA - SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroBasic PRO for AVR
CHAPTER 6