Forum Discussion

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

Buttons communication problem NIOS II

Hello everybody,

I created a design with buttons where a led lights on when pressing a button. My quartus II design works; I checked the pin assignments and the buttons signals with SignalTap. I have no error in the compilation in NIOS II IDE but then leds do not light on.

I noticed on SignalTap that when I did not press any button, the signal was 1111. Thus, I tried to write (!button) instead of (button) in LED_PIO_BASE. Afterwards, LED1 lighted on even though I was not pressing any button.

I used hello_led with this quartus II design which works perfectly. The problem really comes from the buttons.

Any idea ? Please help, I am lost.

Myriam

If it can help to understand my problem, I used the following program:

# include "system.h"# include "altera_avalon_pio_regs.h"# include "alt_types.h"# include "stdio.h"# include "stdlib.h"

int alt_main (void)

{

alt_u8 button;

while(1){

button = IORD_ALTERA_AVALON_PIO_DATA(BUTTON_PIO_BASE);

IOWR_ALTERA_AVALON_PIO_DATA(LED_PIO_BASE, button);

}

return 0;

}

12 Replies