Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

newbee Simple Button Porblem - Help :)

Status
Not open for further replies.

lentin

Newbie level 2
Joined
Feb 19, 2009
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,293
Hi, Guys after 4 days and over 40 working hours, finally I get stucked with the following example (I am trying to executed in XUP V2P platform):

Code:
entity main_button is 
	port( 	CLK : in STD_LOGIC;
			RESET : in STD_LOGIC;
			BUTTON_2 : in STD_LOGIC;
			LED_2 : out STD_LOGIC);
end;	

architecture button of main_button is
signal sig_temp : STD_LOGIC; --LED_2 output

begin

process(CLK, RESET, BUTTON_2)
	begin
		if(RESET='1') then 
			sig_temp<='0';
		elsif(rising_edge(CLK)) then
			if (BUTTON_2='1') then 
				sig_temp<=not sig_temp;
				
			end if;
		end if;	
end process;
LED_2<=sig_temp;
end;

What I am trying to do is to connect RESET and BUTTON_2 to user board buttons, therefore pressing the RESET should initialize the system and pressing the BUTTON_2 should couse the LED to go in ON or OFF state.

The example is NOT working - Could you help me?!

Please do not redirect me to google - I do my best, but I cannot resolve the problem....

Thanks in advance!
 

Remove BUTTON_2 from the sensitivity list of your flip-flop.

It looks like you're trying to imply a FF with an asynchronous clear. The only thing you need in the sensitivity list is the clock and the reset signal since those are the only things that should cause the FF to change state.

Also, be aware that as long as you are holding BUTTON_2 down your sig_temp signal will keep toggling. If you happen to get unlucky and always release the button when sig_temp is 0, you will never see the LED switch. Though this isn't likely just be aware that the button might not appear to work reliably.

Radix
 

    lentin

    Points: 2
    Helpful Answer Positive Rating
Thanks, I solve successfully the problem. I add debouncing shift register to each of the button inputs. I also found out that LED='0' means LED ON
::)
Regards.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top