Forum Discussion
Altera_Forum
Honored Contributor
12 years agoOK, I think I may have found the most straight forward way (based on an example project that came with my dev kit):
1. Using Qsys, add a PIO component to the Nios processor (@dsl, I think this is what you mentioned in the beginning of your post). In my example, the two ports were named col and row. 2. Use the following avalon API calls to initialize the ports (Note COL_BASE and ROW_BASE will be define in system.h if the Qsys generation goes well). # define col_in() IOWR_ALTERA_AVALON_PIO_DIRECTION(COL_BASE,0x0) # define row_out() IOWR_ALTERA_AVALON_PIO_DIRECTION(ROW_BASE,0xf) 3. Use the following API calls to read and write to the ports: # define col_read() IORD_ALTERA_AVALON_PIO_DATA(COL_BASE) # define row_write(data) IOWR_ALTERA_AVALON_PIO_DATA(ROW_BASE,data) I'm going to look into the Avalon Slave approach as well.