I want to thank you all for all your help.
After hitting my head on the wall for hours, I found it best to start over and re write my code from a fresh start. With your help my new code works flawlessly and better then I had hope for.
My code job is to control a rocket launch. The board has one ARM switch that has to be on for anything else to work. The board then has 2 blue buttons, what either one is pressed it will start the count down, but if any of the 4 red buttons are hit. The program stops what it doing and resets everything.
My output of twosegment7 is set up like this
"
000000000000000"; The last 0 controls the rocket launch signal that goes to my bread board.
"0
00000000000000"; These 0's control the first digit of the 7 segment display.
"00000000
0000000"; These 0's control the second digit of the 7 segment display.
Check out my new fully working code below
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
USE ieee.std_logic_signed.ALL;
ENTITY flyingsaucer IS
PORT
(
CLK :IN std_logic;
ARM,LAUNCH,LAUNCH2,ABORT :IN std_logic;
ABORT1,ABORT2,ABORT3 :IN std_logic;
op,LUNCHBUTTON :BUFFER std_logic;
red :BUFFER INTEGER RANGE 0 TO 255;
green :BUFFER INTEGER RANGE 0 TO 255;
twosegment7 :out std_logic_vector(14 downto 0)
);
END flyingsaucer;
ARCHITECTURE BLASTOFF of flyingsaucer IS
CONSTANT max_count: natural :=24000000;
SIGNAL count: integer;
SIGNAL counter: integer;
BEGIN
onesec : PROCESS(CLK,ARM,LAUNCH,ABORT)
VARIABLE counter : natural RANGE 0 to max_count;
VARIABLE count : natural;
BEGIN
case ARM is
when '0' =>
red <= 0;
green <= 0;
twosegment7 <="000000000000000"; -- 'none'
counter := 0;
op <='0';
count :=15;
LUNCHBUTTON <= '0';
when '1' =>
case ABORT or ABORT1 or ABORT2 or ABORT3 is
when '1' =>
red <= 0;
green <= 0;
twosegment7 <="000000000000000"; -- 'none'
counter := 0;
op <='0';
count :=15;
LUNCHBUTTON <= '0';
when '0' =>
red <= 255;
if (LAUNCH='1' OR LAUNCH2= '1') THEN
LUNCHBUTTON <= '1';
end if;
IF (LUNCHBUTTON = '0') THEN
twosegment7 <="001100001111110"; -- '10'
counter := 0;
op <='0';
count :=15;
ELSIF rising_edge(CLK) THEN
IF counter < max_count/2 THEN
op <='0';
counter := counter +1;
ELSIF counter < max_count THEN
op<='0';
counter :=counter +1;
ELSE
counter :=0;
op <='1';
END IF;
IF LUNCHBUTTON = '1' THEN
if (op = '1') THEN
if (count = 15) THEN
twosegment7 <="001100001111110"; -- '10'
count := count -1;
green <= 255;
ELSIF (count = 14) THEN
twosegment7 <="000000001111011"; -- '9'
count := count -1;
green <= 255;
ELSIF (count = 13) THEN
twosegment7 <="000000001111111"; -- '8'
count := count -1;
green <= 255;
ELSIF (count = 12) THEN
twosegment7 <="000000001110000"; -- '7'
count := count -1;
green <= 127;
ELSIF (count = 11) THEN
twosegment7 <="000000001011111"; -- '6'
count := count -1;
green <= 63;
ELSIF (count = 10) THEN
twosegment7 <="000000001011011"; -- '5'
count := count -1;
green <= 31;
ELSIF (count = 9) THEN
twosegment7 <="000000000110011"; -- '4'
count := count -1;
green <= 15;
ELSIF (count = 8) THEN
twosegment7 <="000000001111001"; -- '3'
count := count -1;
green <= 7;
ELSIF (count = 7) THEN
twosegment7 <="000000001101101"; -- '2'
count := count -1;
green <= 3;
ELSIF (count = 6) THEN
twosegment7 <="000000000110000"; -- '1'
count := count -1;
green <= 1;
ELSIF (count = 5) THEN
twosegment7 <="100000001111110"; -- '0'
count := count -1;
green <= 0;
ELSIF (count = 4) THEN
twosegment7 <="000000000000000"; -- ' . '
count := count -1;
green <= 255;
ELSIF (count = 3) THEN
twosegment7 <="100011101110111"; -- 'LA'
count := count -1;
green <= 0;
ELSIF (count = 2) THEN
twosegment7 <="000000000000000"; -- ' . '
count := count -1;
green <= 255;
ELSIF (count = 1) THEN
twosegment7 <="100011101110111"; -- 'LA'
count := count -1;
green <= 0;
ELSIF (count = 0) THEN
twosegment7 <="000000000000000"; -- ' . '
count := count -1;
green <= 0;
END IF;
END IF;
END IF;
END IF;
END CASE;
END CASE;
END PROCESS;
END BLASTOFF;