entity ds18b20_ctrl is
port
(
clk : IN std_logic; -- 100mhz
--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--
temp_sensor_id : OUT std_logic_vector(63 downto 0); -- Unique Serial Code
-- The default resolution at power-up is 12-bit.
temperature : OUT std_logic_vector(15 downto 0); -- -55°C to +125°C
-- The DS18B20 output temperature data is calibrated in degrees Celsius;
-- for Fahrenheit applications, a lookup table or conversion routine must
-- be used.
-- output * 0.0625 = output / 16 = temperature(11 downto 4)
--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--
temp_sensor_dq : INOUT std_logic := 'Z' -- 1-Wire Digital Thermometer
);
end ds18b20_ctrl;
--==============================================================================--
architecture Behavioral of ds18b20_ctrl is
--==============================================================================--
-- Constant Declarations
constant MAX_TPDTCT : integer := 100000; -- 1ms
constant MAX_TSTART : integer := 50000; -- 500us
-- PARAMETER SYMBOL MIN MAX UNITS
-- Temperature Conversion Time tCONV 750 ms
-- Time to Strong Pull-up On tSPON 10 us
-- Time Slot tSLOT 120 us
-- Recovery Time tREC 1 us
-- Write 0 Low Time tLOW0 60 120 us
-- Write 1 Low Time tLOW1 1 15 us
-- Read Data Valid tRDV 15 us
-- Reset Time High tRSTH 480 us
-- Reset Time Low tRSTL 480 us
-- Presence-Detect High tPDHIGH 15 60 us
-- Presence-Detect Low tPDLOW 60 240 us
constant MAX_TPDLOW : integer := 24100;
constant MIN_TPDLOW : integer := 5900;
constant MIN_TRSTL0 : integer := 55000;
constant MIN_TRSTL1 : integer := 54000; -- MIN_TRSTL0 - 10us
constant MIN_TLOW0 : integer := 6500;
constant MIN_TLOW1 : integer := 500;
-- All write time slots must be a minimum of 60us in duration with a minimum of
-- a 1us recovery time between individual write slots.
constant MIN_TWSLOT : integer := 9500;
-- All read time slots must be a minimum of 60us in duration with a minimum of
-- a 1us recovery time between slots.
constant MIN_TRSLOT : integer := 7000;
-- Recovery Time: tREC > 1us
constant MIN_TREC : integer := 200;
-- Read Data Valid: tRDV < 15us
constant MAX_TRDV : integer := 1200;
constant MAX_TBSCMD : integer := 59000;
-- Temperature Conversion Time: tCONV < 750ms
constant MAX_TCONV : integer := 76000000;
...