ВходНаше всё Теги codebook 无线电组件 Поиск Опросы Закон Понедельник
20 мая
8122
Jackal (03.03.2004 15:08, просмотров: 785)
Ответ: Мысли в слух аля net :) Примеры CW #include static int timer0Count, timer1Count; static void ledInit() { IODIR |= 0x0000FF00; IOSET = 0x0000FF00; } static void ledOn(int led) { IOCLR = led; } static void ledOff(int led) { IOSET = led; } static void timer0ISR(void) __attribute__ ((interrupt ("IRQ"))); static void timer0ISR(void) { if (++timer0Count % 2) ledOn(0x100); else ledOff(0x100); /* Clear the timer 0 interrupt */ T0IR = 0xFF; /* Update VIC priorities */ VICVectAddr = 0; } static void timer1ISR(void) __attribute__ ((interrupt ("IRQ"))); static void timer1ISR(void) { ++timer1Count; /* Clear the timer 1 interrupt */ T1IR = 0xFF; /* Update VIC priorities */ VICVectAddr = 0; } int main(void) { ledInit(); /* Timer 0 interrupt is an IRQ interrupt */ VICIntSelect &= ~0x10; <------Тут мы имеем DATA ABORT /* Enable timer 0 interrupt */ VICIntEnable = 0x10; /* Use slot 0 for timer 0 interrupt */ VICVectCntl0 = 0x24; /* Set the address of ISR for slot 0 */ VICVectAddr0 = (unsigned int)timer0ISR; /* Timer 1 interrupt is an IRQ interrupt */ VICIntSelect &= ~0x20; /* Enable timer 1 interrupt */ VICIntEnable = 0x20; /* Use slot 1 for timer 1 interrupt */ VICVectCntl1 = 0x25; /* Set the address of ISR for slot 1 */ VICVectAddr1 = (unsigned int)timer1ISR; /* Reset timer 0 */ T0TCR = 0; /* Set the timer 0 prescale counter */ T0PR = 2500; /* Set timer 0 match register */ T0MR0 = 1000; /* Generate interrupt and reset counter on match */ T0MCR = 3; /* Start timer 0 */ T0TCR = 1; /* Reset timer 1 */ T1TCR = 0; /* Set the timer 1 prescale counter */ T1PR = 2500; /* Set timer 1 match register */ T1MR0 = 1000; /* Generate interrupt and reset counter on match */ T1MCR = 3; /* Start timer 1 */ T1TCR = 1; /* Enable Interrupts */ __ARMLIB_enableIRQ(); while (timer0Count < 5 && timer1Count < 5); return 0; } /*************************************************************/ Я что то не пойму толи это из-за того что он у меня с ошибками стал или они у всех действительно не работают ?? А если не работают то как вообще программировать контроллер прерываний, если попытка записи приводит к data abort'у ? :) p.s. Хотелось бы узнать в железе работает или нет ?