Alexander Grigorjev (07.05.2004 12:11, просмотров: 1268)
Вопрос по прерываниям Люди, что я делаю нетак (не надо говорить, что все)?
void InitInterrupt(void(*ptrfTimer0)(), void(*ptrfUart0)(), void(*ptrfI2C)(), void(*ptrfSPI)(), void(*ptrfUART1)())
{
// Setup interrupt controller.
__VICProtection = 0;
// Disable all interrupts
__VICIntEnClr = 0xffffffff;
__VICIntSelect &= ~(VIC_TIMER0_bit | VIC_UART0_bit | VIC_SPI_bit | VIC_I2C_bit | VIC_UART1_bit); // IRQ on Timer0 and UART0 line.
__VICVectAddr0 = (unsigned int)ptrfTimer0; //Channel 0 of VIC - TimerO interrupt
__VICVectAddr1 = (unsigned long)ptrfUart0; //Channel 1 of VIC - UARTO interrupt
__VICVectAddr2 = (unsigned int)ptrfUART1;
__VICVectAddr3 = (unsigned int)ptrfSPI;
__VICVectAddr4 = (unsigned int)ptrfI2C;
__VICVectCntl0 = 0x20 | VIC_TIMER0; // Enable vector interrupt for Timer0 on channel 0 and set his type.
__VICVectCntl1 = 0x20 | VIC_UART0; // Enable vector interrupt for UART0 on channel 1 and set his type.
__VICVectCntl2 = 0x20 | VIC_UART1; // Enable vector interrupt for UART0 on channel 1 and set his type.
__VICVectCntl3 = 0x20 | VIC_SPI;
__VICVectCntl4 = 0x20 | VIC_I2C;
__VICIntEnable |= (VIC_TIMER0_bit | VIC_UART0_bit | VIC_UART1_bit | VIC_SPI_bit | VIC_I2C_bit); // Enable Timer0 and UART0 interrupt.
}
После такой инициализации прерываний они не срабатывают.
P.S. __enable_interrupt() делаю. Среда разработки IAR.