Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Digital to Analog conversion

Status
Not open for further replies.

divsec

Newbie level 4
Joined
Nov 19, 2009
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
udupi
Activity points
1,318
how to convert a 8 bit input signal into analog using digital to analog converter(DAC)?
This is normal DAC program which takes clock and reset as input and produces square wave output.

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity square_wave is
Port ( clk : in std_logic;
rst : in std_logic;
dac_out : out std_logic_vector(0 to 7));
end square_wave;

architecture Behavioral of square_wave is
signal temp : std_logic_vector(3 downto 0):="0000";
signal counter : std_logic_vector(0 to 7):="00000000";
signal en :std_logic;
begin
process(clk)
begin
if rising_edge(clk) then temp <= temp + '1' ;
end if;
end process;
process(temp(3))
begin
if rst='1' then counter <= "00000000";
elsif rising_edge(temp(3)) then
if counter<150 and en='0' then
counter <= counter +1 ;
en<='0';
dac_out <="00000000";
elsif counter=0 then en<='0';
else en<='1';
counter <= counter-1;
dac_out <="11111111";
end if;
end if;
end process;

end Behavioral;
can i use this program itself to covert 8 bit input into analog?if so where i should modify?
please help me regarding this...
 

pavan.ps

Newbie level 5
Joined
Sep 17, 2008
Messages
9
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,281
Activity points
1,318
the code provided by you gives only digital output. DAC_OUT(8-bit).

If u need the analog signal, u need to feed this digital output to a digital-to-analog converter to give analog signal.

So, If u hav a 8-bit signal, interface the FPGA to DAC such that you get the analog output.

Hope this helps..
 

xtcx

Advanced Member level 1
Joined
Dec 22, 2007
Messages
494
Helped
65
Reputation
130
Reaction score
58
Trophy points
1,308
Location
Bangalore, India
Activity points
5,003
To generate a variable analog voltage in an 8-bit DAC, just calculate the step-size for every input. For example, if DAC is capable of generating 0V to 5V, and if it's 8-bit resolution, then for every increase in count will add an output voltage of 19mv(5/255). You can easily calculate the corresponding analog voltage for a given dgital data easily
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top