Forum Discussion
Altera_Forum
Honored Contributor
12 years agoPROBLEM SOLVED
Hello For those who have the same problem with me, the issue was that I haven't included the header files
system.h
altera_avalon_pio_regs.h
which describe the compiled Qsys system and let me access defined structures like my parallel ports as well as the function IOWR_ALTERA_AVALON_PIO_DATA that writes at the parallel ports. So the simple program described in the Introduction to the Qsys system tutorial:
# define switches (volatile char *) 0x0002000
# define leds (char *) 0x0002010
void main()
{ while (1)
*leds = *switches;
}
Should be in the Nios II EDS:
# include "system.h"
# include "altera_avalon_pio_regs.h"
int main()
{
/* Event loop never exits. */
while (1) {
IOWR_ALTERA_AVALON_PIO_DATA(LEDS_BASE, *((char*)SWITCHES_BASE));
}
return 0;
}
cheers