How to use the Reset Button as input to switch States

I am trying to create a simple State Machine with 3 States for my Arduino MKR VIDOR 4000 FPGA board.

I was wondering if I could use the reset button on the board as an input to switch between state. How would I assign that button to the FPGA? On pressing the button, would it still reset the whole board?

Here is code I've written so far in my process block in the VHDL file on Quartus Prime LITE.

I'm wondering how I can assign sw to be the input button for my state transition and not let the button do its default job of resetting the whole board.

if rising_edge(clk)	then								
		
		led <= "000";
		count := (count + 1);
		
			case StateVariable is								
																		
			
				when STATE1 =>										
					led(0) <= '1';									
					led(1) <= '0';									
					led(2) <= '0';									
				
																		
					
					if sw = '1' then							
						StateVariable <= STATE2;
					end if;
					
																		
				
				when STATE2 =>
					led <= "010";
					
					if sw = '1' then
						StateVariable <= STATE3;
					end if;

					
					
					
				
				when STATE3 =>
					led <= "100";
					
					if sw = '1' then
						StateVariable <= STATE1;
					end if;

					

Thanks in advance!

That button is physically connected to multiple hardware components. FPGA will receive the signal on its general purpose I/O pin and in theory would work ok, but MCU will be reset and there is no way around it. If you're using the Arduino default bootloader then your sketch will reload the FPGA design, effectively resetting it. The voltage regulator IC will also pull that reset line on powerup, so this button generally should not be treated as a generic user button.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.