What is thermometer code: Thermometer code
resembles the output produced by a thermometer. In thermometer code, a
value representing number ‘N’ has the lowermost ‘N’ bits as ‘1’; others as 0.
So, to move from N to ‘N+1’, just change the rightmost ‘0’ to ‘1’. Figure 1 below
shows graphically the thermometer codes for values from ‘0’ to ‘7’. As is
evident, each value resembles a reading in thermometer. This is how, thermometer
code got its name. Flash ADCs, time-to-digital converters (TDC) are some of
the circuits that utilize thermometer code.
Thermometer code with 7 symbols |
Characteristics of thermometer code:
- Each symbol in thermometer code is a sequence of 0s followed by a sequence of 1s
- There cannot be 0s in-between two 1s. For example, a symbol 01011 is invalid in thermometer code
- For an n-bit binary code, the corresponding thermometer code will have 2n – 1 symbols; hence, as many bits will be needed to represent thermometer code for the same.
How to convert from binary to thermometer code: Given below is
the VHDL code for a 3-bit binary to thermometer converter. A simple case
statement can be utilized for the same.
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use ieee.numeric_std.all;
entity bin2therm2bit is
port (
binary_input
: in std_logic_vector (1 downto 0);
therm_output
: out std_logic_vector (6 downto 0)
);
end bin2therm6bit;
architecture Behavioral of bin2therm6bit is
begin
process
(binary_input)
begin
label1
: case binary_input is
when
"000" => therm_output <= "0000000";
when
"001" => therm_output <= "0000001";
when
"010" => therm_output <= "0000011";
when
"011" => therm_output <= "0000111";
when
"100" => therm_output <= "0001111";
when
"101" => therm_output <= "0011111";
when
"110" => therm_output <= "0111111";
when
"111" => therm_output <= "1111111";
when
others => therm_output <= “xxxxxxx”;
end
case;
end process;
end Behavioral;
Hope you’ve found this post useful. Let us know what you think in the comments.
Also read:
This comment has been removed by a blog administrator.
ReplyDeletenice
ReplyDeleteVery helpful thank you so much
ReplyDeleteVery helpful thank you so much
ReplyDelete