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

Subversion Repositories c16

[/] [c16/] [trunk/] [vhdl/] [temperature.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 temperature is
entity temperature is
        PORT(   CLK_I                   : in STD_LOGIC;
        PORT(   CLK_I                   : in STD_LOGIC;
                        T2                              : in STD_LOGIC;
                        RST_I                   : in STD_LOGIC;
                        CLR                             : in STD_LOGIC;
 
                        DATA_OUT                : out STD_LOGIC_VECTOR(7 downto 0);
                        DATA_OUT                : out STD_LOGIC_VECTOR(7 downto 0);
                        TEMP_SPI                : out STD_LOGIC;
                        TEMP_SPI                : out STD_LOGIC;
                        TEMP_SPO                : in STD_LOGIC;
                        TEMP_SPO                : in STD_LOGIC;
                        TEMP_CE                 : out STD_LOGIC;
                        TEMP_CE                 : out STD_LOGIC;
                        TEMP_SCLK               : out STD_LOGIC
                        TEMP_SCLK               : out STD_LOGIC
Line 15... Line 14...
end temperature;
end temperature;
 
 
architecture behavioral of temperature is
architecture behavioral of temperature is
 
 
        component DS1722
        component DS1722
        PORT(   RESET                   : in std_logic;
        PORT(   CLK_I                   : in std_logic;
                        CLK_I                   : in std_logic;
                        RST_I                   : in std_logic;
                        T2                              : 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 47... Line 45...
 
 
begin
begin
 
 
        tsensor: DS1722
        tsensor: DS1722
        PORT MAP(       CLK_I           => CLK_I,
        PORT MAP(       CLK_I           => CLK_I,
                                T2                      => T2,
                                RST_I           => RST_I,
                                RESET           => CLR,
 
 
 
                                DATA_IN         => TEMP_DATA_IN,
                                DATA_IN         => TEMP_DATA_IN,
                                DATA_OUT        => TEMP_DATA_OUT,
                                DATA_OUT        => TEMP_DATA_OUT,
                                ADDRESS         => TEMP_ADDRESS,
                                ADDRESS         => TEMP_ADDRESS,
 
 
Line 63... Line 60...
                                TEMP_SPO        => TEMP_SPO,
                                TEMP_SPO        => TEMP_SPO,
                                TEMP_CE         => TEMP_CE,
                                TEMP_CE         => TEMP_CE,
                                TEMP_SCLK       => TEMP_SCLK
                                TEMP_SCLK       => TEMP_SCLK
                        );
                        );
 
 
-- State machine to step though the process of getting data from the Digital Thermometer.
        -- State machine to step though the process of getting data
        process (CLR, CLK_I)
        -- from the Digital Thermometer.
 
        --
 
        process (CLK_I)
        begin
        begin
                if (CLR = '1') then
                if (rising_edge(CLK_I)) then
 
                        if (RST_I = '1') then
                        TEMP_state   <= TEMP_IDLE;
                        TEMP_state   <= TEMP_IDLE;
                        TEMP_START   <= '0';
                        TEMP_START   <= '0';
                        TEMP_ADDRESS <= "00000000";
                        TEMP_ADDRESS <= "00000000";
                        TEMP_DATA_IN <= "00000000";
                        TEMP_DATA_IN <= "00000000";
                elsif (rising_edge(CLK_I)) then
                        else
                        if (T2 = '1') then
 
                                case TEMP_state is
                                case TEMP_state is
                                        when TEMP_IDLE =>
                                        when TEMP_IDLE =>
                                                TEMP_START   <= '0';
                                                TEMP_START   <= '0';
                                                TEMP_ADDRESS <= "00000000";
                                                TEMP_ADDRESS <= "00000000";
                                                TEMP_DATA_IN <= "00000000";
                                                TEMP_DATA_IN <= "00000000";

powered by: WebSVN 2.1.0

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