Loading ...
Sorry, an error occurred while loading the content.
 

Re: [booksbybibin,www.booksbybibin.tk] atmega8535 ADC problem

Expand Messages
  • subrat nayak
    http://www.mil.ufl.edu/courses/eel5666/handouts/Atmel_Code/adc_tst.c http://www.mil.ufl.edu/courses/eel5666/handouts/Atmel_Code/adc_test.c try this two pieces
    Message 1 of 5 , Mar 31, 2008
      http://www.mil.ufl.edu/courses/eel5666/handouts/Atmel_Code/adc_tst.c
      http://www.mil.ufl.edu/courses/eel5666/handouts/Atmel_Code/adc_test.c

      try this two pieces of codes,, its ADC and LCD ..connect accelerometer to adc and this code will take u thru.... this is for 1 channel, u have 3 channels so read thru the datasheet and do the rest,..

      http://www.engr.sjsu.edu/bjfurman/courses/ME106/ME106pdf/A2D_ATmega128.pdf
      may be helpful..

      On Sat, Mar 22, 2008 at 8:59 AM, nitin chaudhary <nitin2162000@...> wrote:



      rainie800 <rainie800@...> wrote:

      halo all...i m newbie in AVR..for my project,i connect the 3 axis
      accelerometer to atmega8535 and then the data must be displayed on
      LCD..I using WinAVR software..I bit confused about the code and please
      help me if got any references.. Thanks..

      It is for atmega8.For more help download bibin avr book.
      void Init_ADC(void)
      {

          
          ADMUX|=(_BV(ADLAR) | _BV(REFS1)| _BV(REFS0)) ;
          // RFS1 and RFS0 are for Internal Reference voltage of 2.56V  AND 8 BIT CONVERSION
          ADMUX&=~(_BV(MUX0)|_BV(MUX1)|_BV(MUX2)|_BV(MUX3)|_BV(MUX4)); //SELECTING CHANNEL0
          ADCSRA|=(_BV(ADEN) | _BV(ADPS2) | _BV(ADPS0)) ; //normal conversion without interrupt
          ADCSRA&=~(_BV(ADSC)|_BV(ADATE)|_BV(ADIF)|_BV(ADIE)|_BV(ADPS1));//clock/32 speed
            
      }

      int Read_ADC(void)
      {
      ADCSRA|=_BV(ADSC); //start conversion
      while(!((ADCSRA&_BV(ADIF))>>ADIF));
      return ADCH;
      }


      Chat on a cool, new interface. No download required. Click here.



      --
      Thanks and Regards,
      Subrat Nayak
    Your message has been successfully submitted and would be delivered to recipients shortly.