Forum Discussion
Altera_Forum
Honored Contributor
20 years agoc programming for Pin pio
Hi there...i'm currently having problem of understanding the pin input pio.... my nios is connected to the 16 bits pio pin in the development board...how to write a c code to retrieve the i...
Altera_Forum
Honored Contributor
20 years agoHello niceguylow,
the PIO Core is described in the Quartus II Development Software Handbook Volume 5: Embedded Peripherals (http://www.altera.com/literature/quartus2/lit-qts-peripherals.jsp). For accesing the PIO registers there are some macros which are included in “altera_avalon_pio_regs.h”:#define IOADDR_ALTERA_AVALON_PIO_DATA(base) __IO_CALC_ADDRESS_NATIVE(base, 0)# define IORD_ALTERA_AVALON_PIO_DATA(base) IORD(base, 0) # define IOWR_ALTERA_AVALON_PIO_DATA(base, data) IOWR(base, 0, data)
# define IOADDR_ALTERA_AVALON_PIO_DIRECTION(base) __IO_CALC_ADDRESS_NATIVE(base, 1)# define IORD_ALTERA_AVALON_PIO_DIRECTION(base) IORD(base, 1) # define IOWR_ALTERA_AVALON_PIO_DIRECTION(base, data) IOWR(base, 1, data)
# define IOADDR_ALTERA_AVALON_PIO_IRQ_MASK(base) __IO_CALC_ADDRESS_NATIVE(base, 2)# define IORD_ALTERA_AVALON_PIO_IRQ_MASK(base) IORD(base, 2) # define IOWR_ALTERA_AVALON_PIO_IRQ_MASK(base, data) IOWR(base, 2, data)
# define IOADDR_ALTERA_AVALON_PIO_EDGE_CAP(base) __IO_CALC_ADDRESS_NATIVE(base, 3)# define IORD_ALTERA_AVALON_PIO_EDGE_CAP(base) IORD(base, 3) # define IOWR_ALTERA_AVALON_PIO_EDGE_CAP(base, data) IOWR(base, 3, data) Regards, niosIIuser