Forum Discussion
Altera_Forum
Honored Contributor
17 years agoPIO
Hi all, I'm trying to write/read to and from some PIO. I have read as much as I can find about this topic on the forums and nios wiki but im not having much luck. Ive made a little test pro...
Altera_Forum
Honored Contributor
17 years ago<div class='quotetop'>QUOTE (Gaz @ Aug 7 2009, 10:16 AM) <{post_snapback}> (index.php?act=findpost&pid=23448)</div>
--- Quote Start --- Hi all, I'm trying to write/read to and from some PIO. I have read as much as I can find about this topic on the forums and nios wiki but im not having much luck. Ive made a little test program: <div class='codetop'>CODE --- Quote End --- <div class='codemain' style='height:200px;white-space:pre;overflow:auto'>#include <stdio.h># include <asm/io.h> int main(void) { printf("writing to port:\n"); writew(0xFFFF,0x10402020); //data return 0; }</div> where 0x10402020 is the address of my PIO. The code doesn't do anything really... ive tried a few other methods, none seemed to work. Can anyone help!?!?!?[/b] --- Quote End --- got it! had to find the correct register to change the direction (can find them in the nios2eds io.h). so doing utw(0xFFFF,(0x10402020+4)) wrote 0xFFFF to the direction register and changed the port to an output. Maybe this will help someone else one day....