- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
To make this as short as possible, I have a project at school that requires me to program a Chronometer on the nexys 2 board. The Chronometer must start, pause,reset and record the times that are on the 7 segment display when you press the pause button,and show them all in order when i press a different button from the three mentioned before. I have made it start,pause and reset but i have no clue how to make it memorize the time and then display it.
This is my code: -- Verified 9/3/08 by jht library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity stopwatch is Port ( clk : in std_logic; btns : in std_logic_vector(3 downto 1); leds : out std_logic_vector(7 downto 5); an : out std_logic_vector(3 downto 0); seg : out std_logic_vector(6 downto 0); dp : out std_logic ); end stopwatch; architecture Behavioral of stopwatch is signal Dhex : std_logic_vector(15 downto 0); signal Start, Stop, Reset: std_logic := '0'; signal TP_001s: std_logic := '0'; signal run_pulse: std_logic := '0'; signal Blink_on: boolean := FALSE; signal EN: std_logic_vector(3 downto 0) := "1111"; begin -- Use seven segment display to show elapsed time. U_SSD: entity HEXSSD port map (hex => Dhex, DP => "0100" , CLK => CLK, DISP_SEG(7) => dp, DISP_SEG(6 downto 0) => seg , Disp_AN => an, EN => EN); -- Generate 0.01 sec tick. U10MS: entity NCNT generic map(500_000) port map (CLK, TP_001s); -- Use DEC_UP_CNT to measure elapsed time. UDUC: entity DEC_UP_CNT(arch) port map(CLK => CLK, RST => Reset, EN => Run_Pulse, COUNT => Dhex); Run_pulse <= TP_001s and START; --------------------------------------- -- Remember which button was pressed. process(clk) begin if clk'event and clk = '0' then if (Reset = '1') and (Start ='1') then Reset <= '0'; end if; case btns is when "100" => Start <= '1'; Stop <= '0'; Reset <= '0'; when "010" => Start <= '0'; Stop <= '1'; Reset <= '0'; when "001" => Reset <= '1'; Stop <= '0'; when others => NULL; end case; end if; end process; --------------------------------------- leds(7) <= Start; leds(6) <= Stop; leds(5) <= Reset; --------------------------------------- -- Blink seven segment display -- Add blink when 99.99. Blink_on <= TRUE when Dhex = X"9999" else FALSE; process (clk) variable count: integer range 0 to 25 - 1; begin if clk'event and clk = '0' then if TP_001s = '1' then count := count + 1 mod 25; if count = 0 then if Blink_on then EN <= not EN; else EN <= "1111"; end if; end if; end if; end if; end process; --------------------------------------- end Behavioral; Could anyone help? Thanks a lot :)Link Copied
0 Replies

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page