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
14 years ago --- Quote Start --- Moving the definition of 'delay' outside the function, and making it
volatile int delay;will force the compiler to generate the code loop. I'd also add two more zeros to the count. At a guess, the delay loop is about 20 clocks (with volatile data), at 100MHz you'd need about 2500000 iterations to get 1Hz flash. --- Quote End --- 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.