Mikroelektronika MIKROE-742 데이터 시트

다운로드
페이지 532
Man_Break
266
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroPASCAL PRO for AVR
CHAPTER 6
Prototype
procedure Man_Break();
Returns
Nothing.
Description
Man_Receive is blocking routine and it can block the program flow. Call this
routine from interrupt to unblock the program execution. This mechanism is sim-
ilar to WDT.
Note: Interrupts should be disabled before using Manchester routines again
(see note at the top of this page).
Requires
Nothing.
Example
var data1, error, counter : byte;
procedure Timer0Overflow_ISR(); org 0x12;
begin
counter := 0;
if (counter >= 20) then
begin
Man_Break();
counter := 0;                // reset counter
end
else
Inc(counter);                  // increment counter
end;
begin
TOIE0_bit  := 1;           // Timer0 overflow interrupt enable
TCCR0_bit  := 5;           // Start timer with 1024 prescaler
SREG_I_bit := 0;                   // Interrupt disable
...
Man_Receive_Init();
...
// try Man_Receive with blocking prevention mechanism
SREG_I_bit := 1;                   // Interrupt enable
data1 := Man_Receive(@error);
SREG_I_bit := 0;                   // Interrupt disable
...
end;