Forum Discussion
Altera_Forum
Honored Contributor
17 years agoButtons 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
- Altera_Forum
Honored Contributor
Thank you for ~button, I changed it. For the leds, I don't know I am gonna check this. I have a Cyclone III C25 from Altera.
When doing further tests, I noticed that button always remained at 0. Is there an initialisation to make to the variable button (knowing that I use the pooling method)? Why button value does not change ? - Altera_Forum
Honored Contributor
If you want one's complement "button" variable, you should use "~button" not "!button". What is common in your leds, anode or cathode?