OpenCores
URL https://opencores.org/ocsvn/c16/c16/trunk

Subversion Repositories c16

[/] [c16/] [trunk/] [vhdl/] [ds1722.vhd] - Diff between revs 2 and 9

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 2 Rev 9
Line 2... Line 2...
use IEEE.std_logic_1164.all;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_unsigned.all;
use IEEE.std_logic_unsigned.all;
 
 
entity DS1722 is
entity DS1722 is
    Port(       CLK_I:      in          std_logic;
    Port(       CLK_I:      in          std_logic;
                        T2:         in          std_logic;
                        RST_I:      in          std_logic;
                        RESET:      in          std_logic;
 
 
 
                        DATA_IN:        in      std_logic_vector(7 downto 0);
                        DATA_IN:        in      std_logic_vector(7 downto 0);
                        DATA_OUT:       out     std_logic_vector(7 downto 0);
                        DATA_OUT:       out     std_logic_vector(7 downto 0);
                        ADDRESS:        in      std_logic_vector(7 downto 0);
                        ADDRESS:        in      std_logic_vector(7 downto 0);
 
 
Line 36... Line 35...
 
 
        signal Write: std_logic;
        signal Write: std_logic;
 
 
begin
begin
 
 
        -- Set up counter to sample digital themometer.
        -- divide CLK_I by 256
        process (CLK_I, RESET)
        --
 
        process (CLK_I)
        begin
        begin
                if (RESET = '1') then   --asynchronous RESET active High
                if (rising_edge(CLK_I)) then
                        counter <= "00000000";
                        if (RST_I = '1') then   counter <= "00000000";
                elsif (rising_edge(CLK_I)) then
                        else                                    counter <= counter + "00000001";
                        if (T2 = '1') then
 
                                counter <= counter + "00000001";
 
                        end if;
                        end if;
                end if;
                end if;
        end process;
        end process;
 
 
        DONE     <= START when (state = LAST_ONE) else '0';
        DONE     <= START when (state = LAST_ONE) else '0';
        DATA_OUT <= data_latch;
        DATA_OUT <= data_latch;
 
 
        Write <= ADDRESS(7);
        Write <= ADDRESS(7);
 
 
        -- process to convert byte commands to SPI and SPI to byte.
        -- convert byte commands to SPI and SPI to byte.
        process (CLK_I, RESET)
        --
 
        process (CLK_I)
        begin
        begin
                if (RESET='1') then     --asynchronous RESET active High
                if (rising_edge(CLK_I)) then
 
                        if (RST_I = '1') then
                        state     <= SET_CE;
                        state     <= SET_CE;
                        TEMP_CE   <= '0';
                        TEMP_CE   <= '0';
                        TEMP_SCLK <= '0';
                        TEMP_SCLK <= '0';
                        bit_count <= 0;
                        bit_count <= 0;
                elsif (rising_edge(CLK_I)) then
                        elsif (counter = "11111111" and START = '1') then
                        if (T2 = '1') then
 
                                if (counter = "11111111" and START = '1') then
 
                                        case state is
                                        case state is
                                                when SET_CE =>
                                                when SET_CE =>
                                                        TEMP_SCLK <= '0';
                                                        TEMP_SCLK <= '0';
                                                        TEMP_CE <= '1';
                                                        TEMP_CE <= '1';
                                                        state <= LATCH_ADD;
                                                        state <= LATCH_ADD;
Line 152... Line 150...
                                                        TEMP_SCLK <= '0';
                                                        TEMP_SCLK <= '0';
                                                        state     <= SET_CE;
                                                        state     <= SET_CE;
                                        end case;
                                        end case;
                                end if;
                                end if;
                        end if;
                        end if;
                end if;
 
        end process;
        end process;
 
 
end DS1722_arch;
end DS1722_arch;
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.