Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
16 years ago

Using nios2 system to let led display,but not success

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;

}

2 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    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