# Interfacing 8051 with RTC and DAC to get a user defined random waveform

#### kar855

Joined Jan 26, 2008
2
Hi everyone I am Karthik, looking out for a project which involves Interfacing 8051 with RTC and DAC to get a user defined random waveform.
I had a lab expt in 7th sem where 8051 was interfaced to get a sine wave.
But now I want to display a random user defined wave where signal may be a mixture of sine, square, ramp or any other shape and also it should have a definite user defined time interval in the program.

Can anyone tell me how to go about it?

#### beenthere

Joined Apr 20, 2004
15,808
At a guess, your sine wave was generated from a lookup table. The frequency was set by changing the rate each successive value was sent to the DAC. That at least lets you know how to adjust frequency.

For many waveforms, a mathematical description is pretty simple to work out. For instance, a ramp increases the voltage linearly over time until a maximum valy, and then goes back to zero. For simple waveforms, it would be simple to have lookup table templates to generate them.

The "any other shape" requirement will take some doing. How is the arbitrary waveform to be presented to the 8051? You haven't got a lot of computing horsepower there, so are you expecting to program the 8051 to do curve fitting? Or does someone give you a table with the X-Y values of the waveform, which makes the function or reproducing it trivial (X is the time axis, Y the voltage).

#### kar855

Joined Jan 26, 2008
2
yes the flight data is given which consists of random signals!
And the expt involves these three 8051, DAC and RTC.
Thanks!

#### scubasteve_911

Joined Dec 27, 2007
1,202
I'm very confused about the term "user defined random waveform", it seems very contradictory.

So, you want a random waveform with a definite period? What are you using the RTC for?

I use the PSoC uController often and it has a random number generator of variable resolution. It seems that you may be able to generate a waveform by calling this function for y-amount of datapoints, then vary the clock to your ADC to set the period of the waveform.

Steve