Ich mochte gerne einen Interrupt programmieren leider wird der
irq_handler nicht aufgerufen. Habe einen AT91RM9200.
Kann mir villeicht jamand helfen? Danke.
1 | void timer1_c_irq_handler (void)
|
2 | { unsigned int dummy ;
|
3 | printf("ein Interrupt Trat auf");
|
4 | dummy = TC1_SR; /* Read TC1 Status Register to clear it */
|
5 | AIC_IVR = 0;
|
6 |
|
7 | if ( (PIOB_PDSR & LED8) == LED8 )
|
8 | { PIOB_CODR = LED8;
|
9 | printf("set LED8\n");
|
10 | }else
|
11 | { PIOB_SODR = LED8 ;
|
12 | printf("clear LED8\n");
|
13 | }
|
14 | AIC_EOICR = 0;
|
15 | }
|
16 | int main ( void )
|
17 | {
|
18 | unsigned int dummy ;
|
19 | init_mem();
|
20 | PIOB_PER = LED8 | LED1 ; /* Enable the PIO/LED8 pin */
|
21 | PIOB_OER = LED8 | LED1; /* Enable the PIO/LED8 pin as Output */
|
22 | PIOB_CODR = LED8 | LED1 ; /* Set LED8 */
|
23 | // Timer1 Init
|
24 | TC1_CCR = TC_CLKDIS ; /* Disable the Clock Counter */
|
25 | TC1_IDR = 0xFFFFFFFF ;
|
26 | dummy = TC1_SR ;
|
27 | TC1_CMR = TC_CLKS_MCK1024 | TC_CPCTRG ;
|
28 | TC1_CCR = TC_CLKEN; /* Enable the Clock counter */
|
29 | TC1_IER = TC_CPCS; /*Validate the RC compare interrupt */
|
30 |
|
31 | AIC_IDCR = (1<<TC1_ID); /* Disable timer 1 interrupt at AIC level */
|
32 | AIC_SVR5 = (unsigned int) timer1_c_irq_handler ; /* Set the TC1 IRQ handler address */
|
33 | AIC_SMR5 = ( AIC_SRCTYPE_INT_LEVEL_SENSITIVE | 0x4 ); /* Set the trigg and priority for TC1 interrupt */
|
34 | AIC_ICCR = (1<<TC1_ID); /* Clear the TC1 interrupt */
|
35 | AIC_IECR = (1<<TC1_ID); /* Enable the TC1 interrupt */
|
36 | TC1_RC = 0xFBC5;
|
37 | TC1_CCR = TC_SWTRG ;
|