User manual
mikroC PRO for dsPIC
MikroElektronika
409
Man_Break
Prototype
void Man_Break();
Description Man_Receive is blocking routine and it can block the program ow. Call this routine from interrupt to
unblock the program execution. This mechanism is similar to WDT.
Parameters None.
Returns Nothing.
Requires Nothing.
Example
char data1, error, counter = 0;
void Timer1Int() org IVT_ADDR_T1INTERRUPT {
if (counter >= 20) {
Man_Break();
counter = 0; // reset counter
}
else
counter++; // increment counter
T1IF_bit = 0; // Clear Timer1 overow interrupt ag
}
void main() {
...
if (Man_Receive_Init() == 0) {
...
}
...
// try Man_Receive with blocking prevention mechanism
IPC0 = IPC0 | 0x1000; // Interrupt priority level = 1
T1IE_bit= 1; // Enable Timer1 interrupts
T1CON = 0x8030; // Timer1 ON, internal clock FCY, prescaler
1:256
data1 = Man_Receive(&error);
T1IE_bit= 0; // Disable Timer1 interrupts
}
Notes Interrupts should be disabled before using Manchester routines again (see note at the top of this
page).