I. Introduction
Laboratory Design Exercise 5 is just like the Lab 4 which uses a Mod-9 counter. But in this exercise we need to use a block diagram of the Lab 4 and manipulate it to have an output of 0-99 counter.
II. Objectives
To be able to create a 99 counter with previous code.
III. Conceptional Framework
IV. Data and Result
library ieee;
use ieee.std_logic_1164.all;
entity fivepointone is
port(a, a3, e, s : in BIT;
output2 : OUT BIT;
k : IN INTEGER RANGE 0 TO 9;
y,h : out bit_vector(3 downto 0));
end fivepointone;
architecture five of fivepointone is
BEGIN
PROCESS (a3, a, e)
VARIABLE temp : INTEGER RANGE 0 TO 10 := 0;
BEGIN
IF (a3'EVENT AND a3 = '1') THEN
if (e = '1') THEN
temp := temp;
else
temp := temp + 1;
output2 <= '0';
end if;
IF (temp = 10) THEN
temp := 0;
output2 <= '1';
else
output2 <= '0';
END IF;
END IF;
IF (a = '0') THEN
temp := 0;
END IF;
CASE temp IS
WHEN 0 => y <= "0000" ;
WHEN 1 => y <= "0001" ;
WHEN 2 => y <= "0010" ;
WHEN 3 => y <= "0011" ;
WHEN 4 => y <= "0100" ;
WHEN 5 => y <= "0101" ;
WHEN 6 => y <= "0110" ;
WHEN 7 => y <= "0111" ;
WHEN 8 => y <= "1000" ;
WHEN 9 => y <= "1001" ;
WHEN OTHERS => null;
END CASE;
CASE k IS
WHEN 0 => h <= "0000" ;
WHEN 1 => h <= "0001" ;
WHEN 2 => h <= "0010" ;
WHEN 3 => h <= "0011" ;
WHEN 4 => h <= "0100" ;
WHEN 5 => h <= "0101" ;
WHEN 6 => h <= "0110" ;
WHEN 7 => h <= "0111" ;
WHEN 8 => h <= "1000" ;
WHEN 9 => h <= "1001" ;
WHEN OTHERS => null;
END CASE;
IF (s = '0') THEN
temp := k;
END IF;
END PROCESS ;
END five;
Block Diagram
V. Analysis
III. Conceptional Framework
IV. Data and Result
library ieee;
use ieee.std_logic_1164.all;
entity fivepointone is
port(a, a3, e, s : in BIT;
output2 : OUT BIT;
k : IN INTEGER RANGE 0 TO 9;
y,h : out bit_vector(3 downto 0));
end fivepointone;
architecture five of fivepointone is
BEGIN
PROCESS (a3, a, e)
VARIABLE temp : INTEGER RANGE 0 TO 10 := 0;
BEGIN
IF (a3'EVENT AND a3 = '1') THEN
if (e = '1') THEN
temp := temp;
else
temp := temp + 1;
output2 <= '0';
end if;
IF (temp = 10) THEN
temp := 0;
output2 <= '1';
else
output2 <= '0';
END IF;
END IF;
IF (a = '0') THEN
temp := 0;
END IF;
CASE temp IS
WHEN 0 => y <= "0000" ;
WHEN 1 => y <= "0001" ;
WHEN 2 => y <= "0010" ;
WHEN 3 => y <= "0011" ;
WHEN 4 => y <= "0100" ;
WHEN 5 => y <= "0101" ;
WHEN 6 => y <= "0110" ;
WHEN 7 => y <= "0111" ;
WHEN 8 => y <= "1000" ;
WHEN 9 => y <= "1001" ;
WHEN OTHERS => null;
END CASE;
CASE k IS
WHEN 0 => h <= "0000" ;
WHEN 1 => h <= "0001" ;
WHEN 2 => h <= "0010" ;
WHEN 3 => h <= "0011" ;
WHEN 4 => h <= "0100" ;
WHEN 5 => h <= "0101" ;
WHEN 6 => h <= "0110" ;
WHEN 7 => h <= "0111" ;
WHEN 8 => h <= "1000" ;
WHEN 9 => h <= "1001" ;
WHEN OTHERS => null;
END CASE;
IF (s = '0') THEN
temp := k;
END IF;
END PROCESS ;
END five;
Block Diagram
V. Analysis
In this experiment, the 99counter is only similar to the previous experiment. The only difference is that it must produce two digit displays in the seven segment display. We have some troubles in the display of two digits. The ones digit is in the left side and the tens digit is in the right side. But the whole functions are working. We find it difficult to assign the pins for the seven segment display.
VI. Conclusion
In this experiment, the group was able to create a 99 counter with sequential code having 2 seven segment display. This was made easy by the group because it was just the same with the previous experiment. The only difference is the number of output display that would count for 99 digits. And still the group members have practiced their skills in programming and debugging the code for errors. Lastly, the data flow must still be analyze every time for the group to perform the experiment well.