To develop skills to interface DAC with 8051 and generate different analog waveforms. Visit Website

To develop skills to interface DAC with 8051 and generate different analog waveforms.

 

Exp 14: Aim: To develop skills to interface DAC with 8051 and generate different analog waveforms.

Flowchart: 



Algorithm: 

  1. Initialize port P1 as output port.
  2. Send maximum value at port P1.
  3. Call delay for calculated time interval to generate square wave i.e time delay,
  4. Send min value to port P1.
  5. Call same delay to obtain 50% duty cycle.
  6. Repeat from step2.

Diagram:


Program:

Step 3: ‘C’ Language Program

#include<reg51.h>

void delay_ms(unsigned int);

void main (void)

 {

 P1=0x00;

 while(1)

  {

   P1=0xff;  

   delay_ms(1);

   P1=0x00;     

   delay_ms(1);

  }

}

void delay_ms(unsigned int k)

{

 unsigned int i,j;

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

  {

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

  }

}

Comments

/* Special function register declarations */

//Function prototype declaration

//Main program

 

//Define port as output

//Infinite loop

 

//Send max value

 

//Send min value

 

 

 

//Delay function

Step 3: ‘C’ Language Program

 

#include <reg51.h>

void main (void)

{

unsigned char x;

while(1)

{

for(x=0; x<255; x++)

{

P1=x;

}

for(x=255; x>0; x- -)

{

P1=x;

}

}

}

Comments

 

/* Special function register declarations */

 

 

 

// Infinite loop

 

 

//send value 00 to FF

 

 

 

//send value FF to 00

 

 

 

Conclusion: In this experiment, we learnt to execute square wave and triangular waveform using interface of DAC 0808. Also we learnt to make algorithm, flowchart and code.







Post a Comment

Visit Website
Visit Website