- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
#define RETURN 100
void interrupt[INT0_vect] INT0_interrupt(void)
{
char i,temp;
/*Filter it to makes sure it was not only noise*/
for (temp= 0;temp< 5;) //Five samples noise filter
{
if(!(PIND & (1<<PD2)))
temp++;
else
temp = RETURN;
}
if(temp != RETURN)
{
/*Place your zero cross action here*/
...
}
}
Что это?
Из Watcom C:
The __interrupt keyword may be used with function definitions for functions that handle computer interrupts. All registers are saved before the function begins execution and restored prior to returning from the interrupt. The machine language return instruction for the function is changed to iret (interrupt return). Functions written using __interrupt are suitable for attaching to the interrupt vector using the library function _dos_setvect. Open Watcom C16 and C32 provide the predefined macros interrupt and _interrupt for convenience and compatibility with the Microsoft C compiler. They may be used in place of __interrupt.
Надо покопаться. Может быть, и в других компиляторах есть похожая директива.
у борланда была тоже такая кейворда
__declspec(naked)
и
иногда
__asm
> __asm
amd64