Forum Discussion
Altera_Forum
Honored Contributor
20 years agoC++ help in NIOS
Hello,
I am a newbie with NIOS. I was able to successfully run the "hello world" program on my board... I was just wondering if there is some type of documentation on the internet that will teach me how to program C++ in the Altera Board... for example: 1) How can I take the input from an IO pin in the board 2) How can I output a signal to one of the pins... If someone can help me out, I would emmensely appreciate it... thanks, Aydin Y Mirzaee1 Reply
- Altera_Forum
Honored Contributor
In your Nios documentation, there is a chapter for each of the various peripheral devices. The one you're looking for is the PIO device. You need to add a PIO device to your SOPC project, then look in the system.h file in your system library to find the definition of the PIO's base address. Then, in your main, you'll have some code like this:
# include "system.h"# include "altera_avalon_pio_regs.h" ... IOWR_ALTERA_AVALON_PIO_DATA(PIO_0_BASE, 0); // Base address and value.