- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have tried to make a simple interrupt of a push button and when i registered the ISR it immediately started to execute the ISR like it's an endless loop.:confused:
Another thing, what is the difference between alt_irq_register() and alt_ic_isr_register()? (i have used alt_irq_register() ); can someone give me an example code for simple interrupt....? thanks!!!:rolleyes:Link Copied
5 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
it might be that you are not Resetting the Button's edge capture register. give "IOWR_ALTERA_AVALON_PIO_EDGE_CAP(<BASE ADDRESS OF YOUR BUTTON), 0); "
where the ISR work ends- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have an example (it works fine):
# include "test_II.h"# define switches_base 0x00101030# define leds_base 0x00101000# define push_base 0x00101020 // *** Maneja la interrupcion **** static void push_isr(void* context, alt_u32 id){ volatile int *function=(volatile int*) context; *function=IORD_ALTERA_AVALON_PIO_EDGE_CAP(push_base); IOWR_ALTERA_AVALON_PIO_EDGE_CAP(push_base,0); IOWR_ALTERA_AVALON_PIO_IRQ_MASK(push_base,0xF); } //************************************* int main(void) { volatile int function=0; alt_u32 switches; // Activas la interrupcion. IOWR_ALTERA_AVALON_PIO_IRQ_MASK(push_base,0xF); alt_irq_register(PUSH_IRQ,(void*)&function, push_isr); while(1){ switch(function){ case 0x1: switches= IORD_ALTERA_AVALON_PIO_DATA(switches_base); IOWR_ALTERA_AVALON_PIO_DATA(leds_base,switches); function=0; break; default: break; } } return 0; } Maybe it could help you...- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thank you both!
i think that i found the problem!! i have writen to the edge cupture register the value '1' insted of '0' and it suddenly works!! i dont know why, does someone has an explanation why?.. thanks for your help!!!- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Possibly, when the interrupt is level triggered, the 'button up' state is the one that was asserting the IRQ. (Even if it were the 'button down' state the ISR would be called repeatedly untill the button was released.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Bit n in the edgecapture register is set to 1 whenever an edge is detected on input
port n. An Avalon-MM master peripheral can read the edgecapture register to determine if an edge has occurred on any of the PIO input ports. if the option enablebit-clearing for edge capture register is turned off, writing any value to the
edgecapture register clears all bits in the register. otherwise, writing a 1 to a
particular bit in the register clears only that bit.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page