Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
17259 Discussions

Using nios2 system to let led display,but not success

Altera_Forum
Honored Contributor II
1,263 Views

Today, I had a nios2 system. Time in debugging, are all normal. However, when load in de2 board, not the results of operation. I would like to ask why, and how to resolve them.Thanks!:)  

Next is the test programme: 

# include "system.h"# include "altera_avalon_pio_regs.h"# include "alt_types.h" 

int main (void) __attribute__ ((weak, alias ("alt_main"))); 

int alt_main (void) 

alt_u8 led = 0x2; 

alt_u8 dir = 0; 

volatile int i; 

 

while (1)  

if (led & 0x81)  

dir = (dir ^ 0x1); 

if (dir)  

led = led >> 1; 

}  

else  

led = led << 1; 

IOWR_ALTERA_AVALON_PIO_DATA(LEDG_BASE, led); 

i = 0; 

while (i<200000) 

i++; 

return 0; 

}
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
424 Views

there may have some problem with your hardware,eg down load was not successfully executed.but the sorftware tell ok.or,the hardware description is not the right one to your programme.that are all i guess

0 Kudos
Altera_Forum
Honored Contributor II
424 Views

Thanks!It's helpfull!

0 Kudos
Reply