ADC DAC External Memory(RAM)

This is what I am assigned to do, what are the aim

  • Generate Sinewave through DAC (why not PWM?)
  • Read the sinewave(through ADC810)
  • Save the values in a 32KB Ram.

And the tradeoffs are

  • Generate the highest frequency which will lead to impure sinewave.
  • DAC and ADC speed must match.
  • Simultaneously i have to save the data in RAM

 
 

The microcontroller U5 (AT89C51) is generating sinewave, loaded with the following code

#include<reg51.h>

void delay(int k)

{int i,j=k*10;

for(i=0;i<j;i++)

{}

}

main()

{

while(1)

{

    /*

P1=0x01;delay(5000);

P1=0x00;delay(5000);

P1=0x80;delay(5000);

P1=0x00;delay(5000);

*/

// P1=0x80; //delay(3); //10

// P1=0x96;//delay(3); //20

//P1=0xAB;//delay(3); //30

// P1=0xC0; //delay(3);     //40

// P1=0xD2; //delay(3); //50

P1=0xE2;    //delay(3);     //60

// P1=0xEE;    //delay(3);        //70

// P1=0xF8; //delay(3);    //80

//P1=0xFE; //delay(3); //90

//P1=0xFF; //delay(3);         //100

//P1=0xFE;     //delay(3);

P1=0xF8;    //delay(3);          //120

 

//P1=0xEF; //delay(3);

//P1=0xE2;//delay(3);

//P1=0xD2;//delay(3);         //150

//P1=0xC0; //delay(3);

// P1=0xAB; //delay(3);

P1=0x96;    //delay(3);         //180

//P1=0x80;    //delay(3);

//P1=0x69; //delay(3);

//P1=0x54; //delay(3);         //210

//P1=0x40; //delay(3);

//P1=0x2D;     //delay(3);

P1=0x1D;    //delay(3);     //240                

//P1=0x11;//delay(3);

//P1=0x07;//delay(3);

//P1=0x01; //delay(3);     //270

//P1=0x00; //delay(3);

//P1=0x01;    //delay(3);

P1=0x07;    //delay(3);     //300

//P1=0x11; //delay(3);

//P1=0x1D;//delay(3);

//P1=0x2D;//delay(3);     //330

// P1=0x40; //delay(3);

// P1=0x54; //delay(3);

P1=0x69;    //delay(3);     //360

 

                            

     /*

     P1=0x80;

     P1=0xC0;

     P1=0xEE;

     P1=0xFF;

     P1=0xEE;

     P1=0xC0;

     P1=0x80;

     P1=0x40;

     P1=0x11;

     P1=0x00;

     P1=0x11;

     P1=0X40;

     */

}

}

And the U1 doing 2 jobs one is to read the sinewave through a ADC810 and other is two save sinewave data to a external RAM 32KB. U1 loaded with following code

Leave a Reply