Forum Discussion
Altera_Forum
Honored Contributor
14 years agoBlinking LED - stays on
I was trying to use NIOS to get an LED to blink over a set period. However, everytime the code is loaded the LED stays on. After a couple of hours of troubleshooting I added a print statement f...
Altera_Forum
Honored Contributor
13 years ago --- Quote Start --- This worked perfectly, pretty cool seeing the LED blinking. Also, tried doing it in the manner that Sanmao suggested. A follow up question; I am working on a project this semester with video (long shot) or image processing, if I add more memory to my SOPC build will I have to worry about manually controlling memory like I did in this code? Or is that something that I will know as I actually begin my project? Thank you for the help. --- Quote End --- This is Final code ? it dosen't work to me ...
#include <stdio.h># include "system.h"# include "altera_avalon_pio_regs.h"
volatile int delay;
int main()
{
int count = 0;
//int delay=0;
//printf("Test!\n");
while(1)
{
IOWR_ALTERA_AVALON_PIO_DATA(LED_BASE, count & 0x01);
delay = 0;
while(delay < 2500000)
{
printf("Hello from Nios II!\n");
delay++;
}
count++;
}
return 0;
}