Altera_Forum
Honored Contributor
14 years agoneed help with simple blinking led delay problem
I'm targeting a DE0-Nano development board, and I've created a NIOS ii/e embedded processor. I want to blink a LED, using the following C code from 'my first nios ii software tutorial':
# include <stdio.h># include "system.h"# include "altera_avalon_pio_regs.h" int main() { int count = 0; int delay; while(1) { IOWR_ALTERA_AVALON_PIO_DATA(LED_PIO_BASE, count & 0x01); delay = 0; while(delay < 2000000) { delay++; } count++; } return 0; } When I debug, I can step through and see the LED light, the value 'count' increment, but there is no 'delay' - it skips the 'while(delay...)' statement. I do not understand - can somebody help?