Presentation is loading. Please wait.

Presentation is loading. Please wait.

Digilent Spartan 3 Board Lecture L2.2

Similar presentations


Presentation on theme: "Digilent Spartan 3 Board Lecture L2.2"— Presentation transcript:

1 Digilent Spartan 3 Board Lecture L2.2
7-Segment Displays Digilent Spartan 3 Board Lecture L2.2

2 Spartan 3 Board

3 Spartan 3 Board

4 Turning on an LED Note: A zero turns on the LED

5 Spartan 3 Board

6 7-Segment Decoder a-g LOW to turn on segment

7 Multiplex displays

8 Multiplex displays 1 1 1

9 Multiplex displays 1 1 1

10 Multiplex displays 1 1 1

11 Multiplex displays 1 1 1

12 x7seg

13 x7seg.vhd library IEEE; use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity x7seg is Port ( x : in std_logic_vector(15 downto 0); cclk, clr : in std_logic; AtoG : out std_logic_vector(6 downto 0); A : out std_logic_vector(3 downto 0) ); end x7seg;

14 architecture arch_x7seg of x7seg is
signal digit : std_logic_vector(3 downto 0); signal count : std_logic_vector(1 downto 0); begin

15 ctr2bit: process(cclk,clr)
begin if(clr = '1') then count <= "00"; elsif(cclk'event and cclk = '1') then count <= count + 1; end if; end process;

16 -- MUX4 with count select digit <= x(3 downto 0) when "00", x(7 downto 4) when "01", x(11 downto 8) when "10", x(15 downto 12) when others;

17 -- seg7dec with digit select AtoG <= " " when "0001", --1 " " when "0010", --2 " " when "0011", --3 " " when "0100", --4 " " when "0101", --5 " " when "0110", --6 " " when "0111", --7 " " when "1000", --8 " " when "1001", --9 " " when "1010", --A " " when "1011", --b " " when "1100", --C " " when "1101", --d " " when "1110", --E " " when "1111", --F " " when others; --0

18 Example: count = 10 AN(2) = 0 AN(0) = AN(1) = AN(3) = 1 AN(3:0) = 1011
ANcode: process(count) begin A <= (others => '1'); A(conv_integer(count)) <= '0'; end process; end arch_x7seg; Example: count = 10 AN(2) = 0 AN(0) = AN(1) = AN(3) = 1 AN(3:0) = 1011

19 .ucf file NET "AN<0>" LOC = "E13" ;
NET "AN<1>" LOC = "F14" ; NET "AN<2>" LOC = "G14" ; NET "AN<3>" LOC = "d14" ; NET "AtoG<6>" LOC = "E14" ; NET "AtoG<5>" LOC = "G13" ; NET "AtoG<4>" LOC = "N15" ; NET "AtoG<3>" LOC = "P15" ; NET "AtoG<2>" LOC = "R16" ; NET "AtoG<1>" LOC = "F13" ; NET "AtoG<0>" LOC = "N16" ; NET "dp" LOC = "P16" ;


Download ppt "Digilent Spartan 3 Board Lecture L2.2"

Similar presentations


Ads by Google