Atmel website | ARM Community | AVR freaks | Technical Support
Banner
 FAQ •  Search •  Register •  Login 

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Interrupts on normal PIO pin on AT91SAM7S64
PostPosted: Tue Feb 01, 2005 4:38 pm 
Offline

Joined: Tue Feb 01, 2005 4:09 pm
Posts: 5
Location: Denmark
Hi :)
I have looked at the examples on the AT91SAM7S-EK Cd, and is having trouble with getting interrupts on more than 1 normal PIO pin. In the example an interrupt routine is made for SW4 (PA14), and it is enabled by PIOA on the AIC. How can i make a interrupt routine for lets say PA15 and still have the interrupt on SW4 ?

Regards Brian Nielsen


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 01, 2005 5:43 pm 
Offline

Joined: Thu Dec 09, 2004 5:20 pm
Posts: 22
Location: Melbourne, Australia
Hi Brian,

>example an interrupt routine is made for SW4 (PA14), and it is enabled >by PIOA on the AIC. How can i make a interrupt routine for lets say PA15 >and still have the interrupt on SW4 ?

To get pin-change INTs, the following needs to be done :
( SW1 = PA19, SW2 = PA20, SW3 = PA15, SW4 = PA14)

For each pin, write a 1 to PIOA_PER.
For each pin, disable outputs with PIOA_ODR .
For each pin, set proper bits in :
PIOA_MDDR, PIOA_IFER, PIOA_PUER

Make sure you enable the PIOA Per. clk in PMC_PCER

Enable the INTs for it in PIOA_IER

Assign a ISR vector, the handler for Port pin change.

clear spurious INTs with AIC_ICCR

And then enable the PIOA Per ID INTs in AIC.

so equates would be :
#define SW1 (1<<19)
etc.....

To enable interrupts on SW3 and SW4 :

PIOA_PER = SW3 + SW4;
PIOA_ODR = SW3 + SW4;
PIOA_MDDR = SW3 + SW4;
etc.....

That's it !

_________________
Best regards,
Kris De Vos
Microbit Systems


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 02, 2005 4:49 pm 
Offline

Joined: Tue Feb 01, 2005 4:09 pm
Posts: 5
Location: Denmark
Thanks Microbit :)
It works.
I can now trig the same int. routine with several PIOs. :)
Just to take it a bit further:
How can i make it so that SW4 keeps its int routine, and make a new int. routine for SW3 ?
So they have an int. routine each. ?
(The inline function AT91F_AIC_ConfigureIt requires AT91C_ID_PIOA. And i cant use that for both routines or can I ?)


Regards Brian Nielsen


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: