Forum Discussion

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

Newbie question: driving leds

Hello everybody!

I'm an absolute newbie in Altera / NIOS.

I have an NEEK with Cyclon III and touch panel LCD.

But for the time being, I am studying the basics.

I have been through the document "my first NIOS II software" tutorial.

Downloaded and installed recently the NIOS 9.1 and Quartus 9.1, both with

their latest service packs. I downloaded the proper application (that goes together

with the tutorial).

Basically the application works. I have added the proper code to blink the LED and

it works.

Now as there are 4 leds, I modified like this :

(The only modification is count & 0x0F instead of count & 0x01).

while(1) {

IOWR_ALTERA_AVALON_PIO_DATA(LED_PIO_BASE, count & 0x0F);

delay = 0;

while(delay < 2000000) {

delay++;

}

count++;

}

I thought (naively) that if I give the 4 last bits to this macro, it would make a

binary counter with the LEDS 1 to 4. However, it does nothing more than it used

to, it seems that only the last bit is taken into account. If I simply use "count", without

anding it with 0x01, it works the same.

Am I missing something? Is there a configuration somewhere that enables or disables

LEDS 2, 3 and 4?

Thanks for any hint!

Pascal

14 Replies