Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++

C++ help in NIOS

Altera_Forum
Honored Contributor II
997 Views

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 Mirzaee
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
251 Views

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.
0 Kudos
Reply