Altera_Forum
Honored Contributor
16 years agoSwitch on leds on DE2
Hey, im trying to switch on LEds on DE2.
http://thalandinenop99.free.fr/image.jpg You can see here the system that i've generated. Leds is set in output with 8 bits and Switch set in input with 8 bits I've generated the system then i've programmed it to my DE2, then i've written this code in C with NIOS 2 IDE in oder to switch on the LED : # define SWITCHES_BASE_ADDRESS 0x00009010# define LEDR_BASE_ADDRESS 0x00009000 int main(void) { int * red_leds = (int *) LEDR_BASE_ADDRESS; /* red_leds is a pointer to the LEDRs */ volatile int * Switch = (int *) SWITCHES_BASE_ADDRESS; /* switches point to toggle switches */ printf("Hello from Nios II!\n"); while(1) { *(red_leds) = *(Switch); /* Red LEDR[k] is set equal to SW[k] */ } return 0; } i've send this to DE2. i don't understand why, LED's doesn't want to switch on....any idea ?? is there any turorial of how i have to code in C if yes, where can i download this file...could you plus help me to solve this problem. Thanks