Assignment 3: ADC | EMBEDDED AND ROBOTICS

Assignment 3: ADC


MAKE PROGRAMS:


  1. GLOW LED ACCORDING TO  INPUT TO ADC
    0-99       1 LED
100-150      2LED
151-200      3 LED
200-255      4LED


2.  MAKE  DIGITAL VOLTMETER 
3.  MAKE DIGITAL WATTMETER



___________________________________________________________________________
learn how to set up adc in cvavr

___________________________________________________________________________


led glow using adc:

int a;
char c[5];
DDRB=255;                   //making output port for led glow
while (1)
      {
      a=read_adc(0);                 //1st pin of port A for ADC input
      itoa(a,c);
      if(a<=99){PINB.0=1;}
      if(a<=150 && a>=100){PINB.0=1;PINB.1=1;}
   
      if(a<=200 && a>=151){PINB.0=1;PINB.1=1;PINB.2=1;}
      if(a<=255 && a>=201){PINB.0=1;PINB.1=1;PINB.2=1;PINB.3=1;}
      }

_____________________________________________________________________________

voltmeter using adc:

configure new project in cvavr with adc and lcd both..lcd interfaced with port other than A
float v;
int a;
char c[5];
while (1)
      {
      a=read_adc(0);                 //1st pin of port A for ADC input
      
      v=5*a/255;                           //coverts input at A.0 to voltage
      itoa(v,c);                              //voltage stored in v
      lcd_clear();
      lcd_puts(c);                    //display c
      }
      
_______________________________________________________________________________

wattmeter using adc:
      

configure new project in cvavr with adc and lcd both..lcd interfaced with port other than A


float v;
int a;
char c[5];
while (1)
      {
      a=read_adc(0);                 //1st pin of port A for ADC input
      
      v=5*a/255;                           //coverts input at A.0 to voltage
      v=v*.5;                     //  *****
      itoa(v,c);                              //voltage stored in v
      lcd_clear();
      lcd_puts(c);                    //display c
      }
      
*****multiply with current in the circuit because power=v*i
note:- if you are using 7805 voltage regulator , its output current is 0.5 ampere.
_______________________________________________________________________________

circuit for adc on proteus ; apply different voltage on port A.0 pin

proteus adc lcd  led circuit

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...

Popular Posts