-- DS18B20: Programmable Resolution 1-Wire Digital Thermometer
--
-- The DS18B20 digital thermometer provides 9-bit to 12-bit Celsius temperature
-- measurements and has an alarm function with nonvolatile user-programmable upper
-- and lower trigger points.
--
-- Each DS18B20 has a unique 64-bit serial code, which allows multiple DS18B20s to
-- function on the same 1-Wire bus.
--
-- The temperature data is stored as a 16bit sign-extended two’s complement number
-- in the temperature register. The sign bits (S) indicate if the temperature is
-- positive or negative: for positive numbers S = 0 and for negative numbers S = 1.
--==============================================================================--
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
USE IEEE.NUMERIC_STD.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
--==============================================================================--
entity DS18B20 is
port
(
CLK : IN STD_LOGIC;
----------------------------------------------------------------------------------
SENSOR_ADD_RECEIVED : OUT STD_LOGIC_VECTOR(64-1 DOWNTO 0);
TEMP : OUT STD_LOGIC_VECTOR(16-1 DOWNTO 0);
----------------------------------------------------------------------------------
-- Data Input/Output. Open-drain 1-Wire interface pin.
TEMP_SENSOR_DIO : INOUT STD_LOGIC;
----------------------------------------------------------------------------------
test_sensor : OUT STD_LOGIC;
);
end DS18B20;
...