Datasheet
break; // We got the starting sequence
if (error <> 0) then // Exit so we do not loop forever
break;
end;
repeat
begin
temp := Man_Receive(error); // Attempt byte receive
if (error <> 0) then // If error occured
begin
Lcd_Chr_CP('?'); // Write question mark on Lcd
Inc(ErrorCount); // Update error counter
if (ErrorCount > 20) then // In case of multi-
ple errors
begin
temp := Man_Synchro(); // Try to synchronize
again
//Man_Receive_Init(); // Alternative, try to
Initialize Receiver again
ErrorCount := 0; // Reset error counter
end;
end
else // No error occured
begin
if (temp <> 0x0E) then // If "End" byte was
received(see Transmitter example)
Lcd_Chr_CP(temp); // do not write received
byte on Lcd
end;
Delay_ms(25);
end;
until ( temp = 0x0E );
end; // If "End" byte was received exit do loop
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
var MANRXPIN : sbit at PORTB.B0;
MANRXPIN_Direction : sbit at DDRB.B0;
MANTXPIN : sbit at PORTB.B1;
MANTXPIN_Direction : sbit at DDRB.B1;
// End Manchester module connections
var index, character : byte;
s1 : array[17] of char;
268
MIKROELEKTRONIKA - SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroPASCAL PRO for AVR
CHAPTER 6