Quote:
Originally Posted by legendisborn
Show the number of ‘1’s on the 7-segment display
|
This function will return a vector that will display the number you pass (temp) on the 7seg
Code:
function sevenSeg (temp : INTEGER) return STD_LOGIC_VECTOR is
VARIABLE result: STD_LOGIC_VECTOR(6 downto 0);
begin
case temp is
when 0 => result:= "1000000";
when 1 => result:= "1111001";
when 2 => result:= "0100100";
when 3 => result:= "0110000";
when 4 => result:= "0011001";
when 5 => result:= "0010010";
when 6 => result:= "0000010";
when 7 => result:= "1111000";
when 8 => result:= "0000000";
when 9 => result:= "0011000";
when others => result := "0000110";
end case;
return result;
end sevenSeg;
For example if you define HEX0 as such:
Code:
HEX0 : out STD_LOGIC_VECTOR(6 downto 0);
Map 6 downto 0 as the pins of the 7seg, then once you've calculated the number of one's you can pass that as such:
Code:
HEX0 <= sevenSeg(ones);
where ones would be the number of ones up.
The rest of it would be logic, you don't even need to know how to program.
----------------
If you're really struggling add my email under my post count.
edit:
Quote:
Originally Posted by M_A_I_N_FTW
you need to atleast find which pin on your 7 segment does whut, other wise there is no way (unless you can find the exactly the data sheet for it).
I willl look into vhdl aswell, and hopefully should be retty easy. But yeah without knowing the pinout of your 7 segment its really difficult for any one to do it.
|
Pin planning is the least of his worries for now if he can't get the code right.