- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hi every one,
i am using a nios 2(on cyclone 2) on uclinux os..can anybody suggest me ,how can i detect a rising or falling edge of a pulse(hardware signal) as an interrupt to the processor..??Link Copied
5 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
you can use a PIO component for that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thanks for reply...
den is it required to keep on polling a perticular PIO pin using readh(0x40008df)memory loc..? how can i read it as an interrupt..??- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Double click on it in SOPC builder. Then you can have it trigger an interrupt on level change.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
but how will i come to know while executing my source code(in C) on processor..
i.e when i detect the signal, i should go to some routine(signal handler) in my C code.. what is the code sequence to do tat in c..- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
in the code there r instructions like
main() { signal(SIGPIPE,SIG_IGN); int fp,oflags; signal(SIGIO, interrupt_handler); fp = open("/dev/interrupt1", O_NOCTTY); if(fp < 0) { printf("Error opening device node !\n"); } else { fcntl(fp, F_SETOWN, getpid()); oflags = fcntl(fp, F_GETFL); fcntl(fp, F_SETFL, oflags | FASYNC); } }///end of main function interrupt_handler() { \\control should come here when edge is detected }
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