Forum Discussion

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

ELF downloaded but switchers don't respond !!!

hello

I am working on niosII 13.0 web edition trying to command 2 LEDs using 2 Switchers on Cyclone III board

the niosII console shows that the elf is downloaded BUT when i click on Sw nothing happens !!

what could be the problem ?!

Downloading 00004000 ( 0%)Downloading 00004F0C (61%)Downloaded 4KB in 0.0s Verifying 00004000 ( 0%)Verifying 00004F0C (61%)Verified OK Starting processor at address 0x00004020

1 Reply

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

    #include "io.h"

    # include "system.h"

    /**

    * Gets led_pattern as parameter in order to write to the register.

    */

    void set_led(unsigned char led_pattern) {

    IOWR(LED_BASE, 0, led_pattern); // writes register

    }

    /**

    * Main, what else?

    * Gets LEDs pattern from switchers.

    * Sets LEDs register according to the pattern.

    **/

    void main() {

    unsigned char led_pattern = 0x00;

    while (1) { // infinite loop

    led_pattern = IORD(SWITCHER_BASE, 0); // gets LEDs

    set_led(led_pattern); // sets LEDs

    }

    }