# sin(x) e^(t/T) - DAC/ALTERA - VHDL

Discussion in 'The Projects Forum' started by wheetnee, Nov 10, 2009.

1. ### wheetnee Thread Starter New Member

Oct 1, 2009
28
0
from using a 12 BIT MCP4922 DAC,
i have to somehow program altera to read the data input
'but i want to input a wave function , connect to dac which connects to audio amplifer to output the voltage output of the sound from the wave function

but altera-> uses simple calculations suchs as +, - / *,
how do i get it to read sin(x), e^(t/Time constant)
how do i code that or any possible solutions i can look into or examples?

is thre any testing i can do with the DAC to see how it work? Is there any sample Altera samples that has to do wit hSPI/clock signals and get the DAC to output a signal?

thanks

Last edited: Nov 10, 2009
2. ### t_n_k AAC Fanatic!

Mar 6, 2009
5,448
783
You have to develop 12-bit sequences for the individual components (sine & exponential parts) over a desired time interval - assuming some base clock rate. I guess you could build the complete time sequence into a single 12-bit stream of appropriate length - output would be virtually zero after 5 time constants.

3. ### wheetnee Thread Starter New Member

Oct 1, 2009
28
0
i hv no background in coding the altera board using VHDL....
the prof gave us basic introduction but it was confusing
are there any type of examples available?(on web or any good links?) i cant find any relevant to what im doing at the moment

4. ### Papabravo Expert

Feb 24, 2006
10,340
1,850
When I was researching VHDL aout two years ago I found numerous helpful postings. There are two basic approaches: tables and calculation.

In the table approach you precalculate a table of function values. You store a represnetation of these values in a readonly memory or table. Upon the occurrence of some enabling condition you pull the values out of the read only memory, perform a multiplication and send them to the DAC at regular periodic intervals. You will need two tables one for the sin function and one for the exponetial function.

The second method is to obtain the Chebyshev polynomial approximations to the sin and the exponential functions and compute the values on the fly. As you know, a polynomial approximation uses only the four operations +, -, *, and /.