Altera_Forum
Honored Contributor
15 years agoUsing the GPIO_0 (JP1) on DE2 board.
Hi
I am building a robot and want to use the DE2 board to control a circuit, i want to use one of the pins on the GPIO_0 36pin port. When i press the KEY0 it should make the pin i choose active. Press key0 -> the circuit recieve a "1" from the pin -> release key0 -> the circuit revieve a "0". If someone could tell me in small steps how i could do that in C. I have come this far: volatile int * GPIO_0_base = (volatile int *) 0x10000060; volatile int * GPIO_0_dir = (volatile int *) 0x10000064; Then i want to make the first pin work as an output: *( GPIO_0_dir) |= 0x01; And then make it active by doing this: *(GPIO_0_base) |= 1; I have written interupt handlers for KEY0 and that works, one of the problems is that the circuits gets a "1" all the time... But that might have something to do with me configuring the port incorrectly. Im thankful for all the help i can get. :)