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

Re: [booksbybibin,www.booksbybibin.tk] AVR microcontroller with ADC

Expand Messages
  • alexandru sorin
    I use that in my project. I use the aff_float (convert float in to char then send to LCD).   ________________________________ From: Arian
    Message 1 of 10 , Jun 4, 2009
    I use that in my project. I use the aff_float (convert float in to char then send to LCD).
     

    From: Arian <happyman757@...>
    To: booksbybibin@yahoogroups.com
    Sent: Wednesday, June 3, 2009 4:37:36 AM
    Subject: [booksbybibin,www.booksbybibin.tk] AVR microcontroller with ADC

    Hi dears :)

    Dears, I am using ATmega16 microcontroller and I need help for about it. I have interfaced a sensor to portA0 and using ADC which is built in it i have digitized its output then showing the output on LCD.

    So i need a code for HEX to ASCII conversion for AVRs. Can any one help me plzzzzz.

    Thanks in Advance.

    Regards
    Engr. Naveed Khowaja
    B.E(electronics)
    Electronic Engineer(DCC Technology)


  • Mihai Galos
    Stefan, you never fail to amaze me. If this code was written by you, I respect your knowledge in C coding, I myself understand pointer arithmetic but I am
    Message 2 of 10 , Jun 5, 2009
      Stefan,
      you never fail to amaze me.

      If this code was written by you, I respect your knowledge in C coding, I myself understand pointer arithmetic but I am certain most on this group would avoid it with any cost, because it is a beginner-level group.

      Keep up the good work,
      Mihai

      --- In booksbybibin@yahoogroups.com, "s.holder123@..." <s.holder123@...> wrote:
      >
      > This might do it,
      >
      >
      > #define U16_NIBBLE(val) ((uint_8)((val >> 12) & 0x0F))
      >
      > /*!
      > \note Hex_Ascii.
      > \note Convert unsigned int value into ascii string.
      > \param unsigned int hex value.
      > \param Char pointer to data.
      > */
      > void Hex_Ascii(uint_16 Hex_Val, char * Data)
      > {
      > uint_8 Cnt = 0;
      > uint_8 Temp = 0x00;
      >
      > *Data++ = '0';
      > *Data++ = 'x';
      >
      > for(Cnt = 0; Cnt < 4; Cnt++)
      > {
      > /*! <!-- This gives us a 4 bit hex value. --> */
      > Temp = U16_NIBBLE(Hex_Val);
      > if(Temp < 0x0A)
      > {
      > /*! <!-- This value = 0 - 9 , add 0x30 to give us a acsii number. --> */
      > *Data++ = (Temp + 0x30);
      > }
      > else
      > {
      > /*! <!-- This value = A - F , add 0x37 (i.e 0x37 + 0x0A = 0x41 = 'A') to give us a acsii letter(capital). --> */
      > *Data++ = (Temp + 0x37);
      > }
      > /*! <!-- Shift the value up. --> */
      > Hex_Val << 4;
      > }
      >
      > /*! <!-- Terminate the string. --> */
      > *Data++ = '\0'
      > return;
      > }
      >
      >
      > Regards
      >
      >
      > --- In booksbybibin@yahoogroups.com, "Arian" <happyman757@> wrote:
      > >
      > > Hi dears :)
      > >
      > > Dears, I am using ATmega16 microcontroller and I need help for about it. I have interfaced a sensor to portA0 and using ADC which is built in it i have digitized its output then showing the output on LCD.
      > >
      > > So i need a code for HEX to ASCII conversion for AVRs. Can any one help me plzzzzz.
      > >
      > >
      > > Thanks in Advance.
      > >
      > >
      > >
      > >
      > > Regards
      > > Engr. Naveed Khowaja
      > > B.E(electronics)
      > > Electronic Engineer(DCC Technology)
      > >
      >
    • Arian
      Thanks :) Can u send ASM code Regards
      Message 3 of 10 , Jun 7, 2009
        Thanks :)

        Can u send ASM code

        Regards
        > Engr. Naveed Khowaja
        > B.E(electronics)
        > Electronic Engineer(DCC Technology)
        >



        --- In booksbybibin@yahoogroups.com, alexandru sorin <alexandru_sorin@...> wrote:
        >
        > I use that in my project. I use the aff_float (convert float in to char then send to LCD).
        >  
        >
        > ________________________________
        > From: Arian <happyman757@...>
        > To: booksbybibin@yahoogroups.com
        > Sent: Wednesday, June 3, 2009 4:37:36 AM
        > Subject: [booksbybibin,www.booksbybibin.tk] AVR microcontroller with ADC
        >
        >
        >
        >
        >
        > Hi dears :)
        >
        > Dears, I am using ATmega16 microcontroller and I need help for about it. I have interfaced a sensor to portA0 and using ADC which is built in it i have digitized its output then showing the output on LCD.
        >
        > So i need a code for HEX to ASCII conversion for AVRs. Can any one help me plzzzzz.
        >
        > Thanks in Advance.
        >
        > Regards
        > Engr. Naveed Khowaja
        > B.E(electronics)
        > Electronic Engineer(DCC Technology)
        >
      • STEVEN HOLDER
        Mihai,   Thanks for the line, Hows it going out there ? well i hope, didn t realsie that pointers would be such a problem, sorry. It works fine though i am
        Message 4 of 10 , Jun 8, 2009
          Mihai,
           
          Thanks for the line, Hows it going out there ? well i hope, didn't realsie that pointers would be such a problem, sorry. It works fine though i am not entirely sure this is what the user was asking for, it could be usefull to have a look at though, maybe somebody will use it.
           
          Its a standard function in all my coding for Uarts, perhaps i may be in the wrong group, just thought i may be able to help some of the chaps here.
           
          Take care, talk soon.
           
          Regards


          --- On Fri, 5/6/09, Mihai Galos <mihaigalos@...> wrote:

          From: Mihai Galos <mihaigalos@...>
          Subject: [booksbybibin,www.booksbybibin.tk] Re: AVR microcontroller with ADC
          To: booksbybibin@yahoogroups.com
          Date: Friday, 5 June, 2009, 5:02 PM

          Stefan,
          you never fail to amaze me.

          If this code was written by you, I respect your knowledge in C coding, I myself understand pointer arithmetic but I am certain most on this group would avoid it with any cost, because it is a beginner-level group.

          Keep up the good work,
          Mihai

          --- In booksbybibin@ yahoogroups. com, "s.holder123@ ..." <s.holder123@ ...> wrote:
          >
          > This might do it,
          >
          >
          > #define U16_NIBBLE(val) ((uint_8)((val >> 12) & 0x0F))
          >
          > /*!
          > \note Hex_Ascii.
          > \note Convert unsigned int value into ascii string.
          > \param unsigned int hex value.
          > \param Char pointer to data.
          > */
          > void Hex_Ascii(uint_ 16 Hex_Val, char * Data)
          > {
          > uint_8 Cnt = 0;
          > uint_8 Temp = 0x00;
          >
          > *Data++ = '0';
          > *Data++ = 'x';
          >
          > for(Cnt = 0; Cnt < 4; Cnt++)
          > {
          > /*! <!-- This gives us a 4 bit hex value. --> */
          > Temp = U16_NIBBLE(Hex_ Val);
          > if(Temp < 0x0A)
          > {
          > /*! <!-- This value = 0 - 9 , add 0x30 to give us a acsii number. --> */
          > *Data++ = (Temp + 0x30);
          > }
          > else
          > {
          > /*! <!-- This value = A - F , add 0x37 (i.e 0x37 + 0x0A = 0x41 = 'A') to give us a acsii letter(capital) . --> */
          > *Data++ = (Temp + 0x37);
          > }
          > /*! <!-- Shift the value up. --> */
          > Hex_Val << 4;
          > }
          >
          > /*! <!-- Terminate the string. --> */
          > *Data++ = '\0'
          > return;
          > }
          >
          >
          > Regards
          >
          >
          > --- In booksbybibin@ yahoogroups. com, "Arian" <happyman757@ > wrote:
          > >
          > > Hi dears :)
          > >
          > > Dears, I am using ATmega16 microcontroller and I need help for about it. I have interfaced a sensor to portA0 and using ADC which is built in it i have digitized its output then showing the output on LCD.
          > >
          > > So i need a code for HEX to ASCII conversion for AVRs. Can any one help me plzzzzz.
          > >
          > >
          > > Thanks in Advance.
          > >
          > >
          > >
          > >
          > > Regards
          > > Engr. Naveed Khowaja
          > > B.E(electronics)
          > > Electronic Engineer(DCC Technology)
          > >
          >

        • kudrot elahi
           can u please summerize code and schematic for ur porject and attach as zipped files. Kudrot. ________________________________ From: STEVEN HOLDER
          Message 5 of 10 , Jun 9, 2009
             can u please summerize code and schematic for ur porject and attach as zipped files.
            Kudrot.


            From: STEVEN HOLDER <s.holder123@...>
            To: booksbybibin@yahoogroups.com
            Sent: Monday, June 8, 2009 4:16:18 PM
            Subject: Re: [booksbybibin,www.booksbybibin.tk] Re: AVR microcontroller with ADC

            Mihai,
             
            Thanks for the line, Hows it going out there ? well i hope, didn't realsie that pointers would be such a problem, sorry. It works fine though i am not entirely sure this is what the user was asking for, it could be usefull to have a look at though, maybe somebody will use it.
             
            Its a standard function in all my coding for Uarts, perhaps i may be in the wrong group, just thought i may be able to help some of the chaps here.
             
            Take care, talk soon.
             
            Regards


            --- On Fri, 5/6/09, Mihai Galos <mihaigalos@yahoo. com> wrote:

            From: Mihai Galos <mihaigalos@yahoo. com>
            Subject: [booksbybibin, www.booksbybibin .tk] Re: AVR microcontroller with ADC
            To: booksbybibin@ yahoogroups. com
            Date: Friday, 5 June, 2009, 5:02 PM

            Stefan,
            you never fail to amaze me.

            If this code was written by you, I respect your knowledge in C coding, I myself understand pointer arithmetic but I am certain most on this group would avoid it with any cost, because it is a beginner-level group.

            Keep up the good work,
            Mihai

            --- In booksbybibin@ yahoogroups. com, "s.holder123@ ..." <s.holder123@ ...> wrote:
            >
            > This might do it,
            >
            >
            > #define U16_NIBBLE(val) ((uint_8)((val >> 12) & 0x0F))
            >
            > /*!
            > \note Hex_Ascii.
            > \note Convert unsigned int value into ascii string.
            > \param unsigned int hex value.
            > \param Char pointer to data.
            > */
            > void Hex_Ascii(uint_ 16 Hex_Val, char * Data)
            > {
            > uint_8 Cnt = 0;
            > uint_8 Temp = 0x00;
            >
            > *Data++ = '0';
            > *Data++ = 'x';
            >
            > for(Cnt = 0; Cnt < 4; Cnt++)
            > {
            > /*! <!-- This gives us a 4 bit hex value. --> */
            > Temp = U16_NIBBLE(Hex_ Val);
            > if(Temp < 0x0A)
            > {
            > /*! <!-- This value = 0 - 9 , add 0x30 to give us a acsii number. --> */
            > *Data++ = (Temp + 0x30);
            > }
            > else
            > {
            > /*! <!-- This value = A - F , add 0x37 (i.e 0x37 + 0x0A = 0x41 = 'A') to give us a acsii letter(capital) . --> */
            > *Data++ = (Temp + 0x37);
            > }
            > /*! <!-- Shift the value up. --> */
            > Hex_Val << 4;
            > }
            >
            > /*! <!-- Terminate the string. --> */
            > *Data++ = '\0'
            > return;
            > }
            >
            >
            > Regards
            >
            >
            > --- In booksbybibin@ yahoogroups. com, "Arian" <happyman757@ > wrote:
            > >
            > > Hi dears :)
            > >
            > > Dears, I am using ATmega16 microcontroller and I need help for about it. I have interfaced a sensor to portA0 and using ADC which is built in it i have digitized its output then showing the output on LCD.
            > >
            > > So i need a code for HEX to ASCII conversion for AVRs. Can any one help me plzzzzz.
            > >
            > >
            > > Thanks in Advance.
            > >
            > >
            > >
            > >
            > > Regards
            > > Engr. Naveed Khowaja
            > > B.E(electronics)
            > > Electronic Engineer(DCC Technology)
            > >
            >


          • write_to_ashuji
            dont worry sir, stay in our group coz some people like me are interested in pointers too.keep up the gud work .:) regards, Ashish
            Message 6 of 10 , Jun 11, 2009
              dont worry sir, stay in our group coz some people like me are interested in pointers too.keep up the gud work .:)
              regards,
              Ashish

              --- In booksbybibin@yahoogroups.com, STEVEN HOLDER <s.holder123@...> wrote:
              >
              > Mihai,
              >  
              > Thanks for the line, Hows it going out there ? well i hope, didn't realsie that pointers would be such a problem, sorry. It works fine though i am not entirely sure this is what the user was asking for, it could be usefull to have a look at though, maybe somebody will use it.
              >  
              > Its a standard function in all my coding for Uarts, perhaps i may be in the wrong group, just thought i may be able to help some of the chaps here.
              >  
              > Take care, talk soon.
              >  
              > Regards
              >
              >
              > --- On Fri, 5/6/09, Mihai Galos <mihaigalos@...> wrote:
              >
              >
              > From: Mihai Galos <mihaigalos@...>
              > Subject: [booksbybibin,www.booksbybibin.tk] Re: AVR microcontroller with ADC
              > To: booksbybibin@yahoogroups.com
              > Date: Friday, 5 June, 2009, 5:02 PM
              >
              >
              >
              >
              >
              >
              >
              >
              > Stefan,
              > you never fail to amaze me.
              >
              > If this code was written by you, I respect your knowledge in C coding, I myself understand pointer arithmetic but I am certain most on this group would avoid it with any cost, because it is a beginner-level group.
              >
              > Keep up the good work,
              > Mihai
              >
              > --- In booksbybibin@ yahoogroups. com, "s.holder123@ ..." <s.holder123@ ...> wrote:
              > >
              > > This might do it,
              > >
              > >
              > > #define U16_NIBBLE(val) ((uint_8)((val >> 12) & 0x0F))
              > >
              > > /*!
              > > \note Hex_Ascii.
              > > \note Convert unsigned int value into ascii string.
              > > \param unsigned int hex value.
              > > \param Char pointer to data.
              > > */
              > > void Hex_Ascii(uint_ 16 Hex_Val, char * Data)
              > > {
              > > uint_8 Cnt = 0;
              > > uint_8 Temp = 0x00;
              > >
              > > *Data++ = '0';
              > > *Data++ = 'x';
              > >
              > > for(Cnt = 0; Cnt < 4; Cnt++)
              > > {
              > > /*! <!-- This gives us a 4 bit hex value. --> */
              > > Temp = U16_NIBBLE(Hex_ Val);
              > > if(Temp < 0x0A)
              > > {
              > > /*! <!-- This value = 0 - 9 , add 0x30 to give us a acsii number. --> */
              > > *Data++ = (Temp + 0x30);
              > > }
              > > else
              > > {
              > > /*! <!-- This value = A - F , add 0x37 (i.e 0x37 + 0x0A = 0x41 = 'A') to give us a acsii letter(capital) . --> */
              > > *Data++ = (Temp + 0x37);
              > > }
              > > /*! <!-- Shift the value up. --> */
              > > Hex_Val << 4;
              > > }
              > >
              > > /*! <!-- Terminate the string. --> */
              > > *Data++ = '\0'
              > > return;
              > > }
              > >
              > >
              > > Regards
              > >
              > >
              > > --- In booksbybibin@ yahoogroups. com, "Arian" <happyman757@ > wrote:
              > > >
              > > > Hi dears :)
              > > >
              > > > Dears, I am using ATmega16 microcontroller and I need help for about it. I have interfaced a sensor to portA0 and using ADC which is built in it i have digitized its output then showing the output on LCD.
              > > >
              > > > So i need a code for HEX to ASCII conversion for AVRs. Can any one help me plzzzzz.
              > > >
              > > >
              > > > Thanks in Advance.
              > > >
              > > >
              > > >
              > > >
              > > > Regards
              > > > Engr. Naveed Khowaja
              > > > B.E(electronics)
              > > > Electronic Engineer(DCC Technology)
              > > >
              > >
              >
            • s.holder123@btinternet.com
              Thank you, much appreciated, i will try :) Regards
              Message 7 of 10 , Jun 12, 2009
                Thank you, much appreciated, i will try :)

                Regards

                --- In booksbybibin@yahoogroups.com, "write_to_ashuji" <write_to_ashuji@...> wrote:
                >
                > dont worry sir, stay in our group coz some people like me are interested in pointers too.keep up the gud work .:)
                > regards,
                > Ashish
                >
                > --- In booksbybibin@yahoogroups.com, STEVEN HOLDER <s.holder123@> wrote:
                > >
                > > Mihai,
                > >  
                > > Thanks for the line, Hows it going out there ? well i hope, didn't realsie that pointers would be such a problem, sorry. It works fine though i am not entirely sure this is what the user was asking for, it could be usefull to have a look at though, maybe somebody will use it.
                > >  
                > > Its a standard function in all my coding for Uarts, perhaps i may be in the wrong group, just thought i may be able to help some of the chaps here.
                > >  
                > > Take care, talk soon.
                > >  
                > > Regards
                > >
                > >
                > > --- On Fri, 5/6/09, Mihai Galos <mihaigalos@> wrote:
                > >
                > >
                > > From: Mihai Galos <mihaigalos@>
                > > Subject: [booksbybibin,www.booksbybibin.tk] Re: AVR microcontroller with ADC
                > > To: booksbybibin@yahoogroups.com
                > > Date: Friday, 5 June, 2009, 5:02 PM
                > >
                > >
                > >
                > >
                > >
                > >
                > >
                > >
                > > Stefan,
                > > you never fail to amaze me.
                > >
                > > If this code was written by you, I respect your knowledge in C coding, I myself understand pointer arithmetic but I am certain most on this group would avoid it with any cost, because it is a beginner-level group.
                > >
                > > Keep up the good work,
                > > Mihai
                > >
                > > --- In booksbybibin@ yahoogroups. com, "s.holder123@ ..." <s.holder123@ ...> wrote:
                > > >
                > > > This might do it,
                > > >
                > > >
                > > > #define U16_NIBBLE(val) ((uint_8)((val >> 12) & 0x0F))
                > > >
                > > > /*!
                > > > \note Hex_Ascii.
                > > > \note Convert unsigned int value into ascii string.
                > > > \param unsigned int hex value.
                > > > \param Char pointer to data.
                > > > */
                > > > void Hex_Ascii(uint_ 16 Hex_Val, char * Data)
                > > > {
                > > > uint_8 Cnt = 0;
                > > > uint_8 Temp = 0x00;
                > > >
                > > > *Data++ = '0';
                > > > *Data++ = 'x';
                > > >
                > > > for(Cnt = 0; Cnt < 4; Cnt++)
                > > > {
                > > > /*! <!-- This gives us a 4 bit hex value. --> */
                > > > Temp = U16_NIBBLE(Hex_ Val);
                > > > if(Temp < 0x0A)
                > > > {
                > > > /*! <!-- This value = 0 - 9 , add 0x30 to give us a acsii number. --> */
                > > > *Data++ = (Temp + 0x30);
                > > > }
                > > > else
                > > > {
                > > > /*! <!-- This value = A - F , add 0x37 (i.e 0x37 + 0x0A = 0x41 = 'A') to give us a acsii letter(capital) . --> */
                > > > *Data++ = (Temp + 0x37);
                > > > }
                > > > /*! <!-- Shift the value up. --> */
                > > > Hex_Val << 4;
                > > > }
                > > >
                > > > /*! <!-- Terminate the string. --> */
                > > > *Data++ = '\0'
                > > > return;
                > > > }
                > > >
                > > >
                > > > Regards
                > > >
                > > >
                > > > --- In booksbybibin@ yahoogroups. com, "Arian" <happyman757@ > wrote:
                > > > >
                > > > > Hi dears :)
                > > > >
                > > > > Dears, I am using ATmega16 microcontroller and I need help for about it. I have interfaced a sensor to portA0 and using ADC which is built in it i have digitized its output then showing the output on LCD.
                > > > >
                > > > > So i need a code for HEX to ASCII conversion for AVRs. Can any one help me plzzzzz.
                > > > >
                > > > >
                > > > > Thanks in Advance.
                > > > >
                > > > >
                > > > >
                > > > >
                > > > > Regards
                > > > > Engr. Naveed Khowaja
                > > > > B.E(electronics)
                > > > > Electronic Engineer(DCC Technology)
                > > > >
                > > >
                > >
                >
              • nandan amar
                pls follow the following code and u will get hex code 4m ur compiler/software that u r using *//sample code for ATMEGA 16 #include
                Message 8 of 10 , Jun 15, 2009
                  pls follow the following code and u will get hex code 4m ur compiler/software that u r using
                  //sample code for ATMEGA 16
                  #include<avr\io.h>
                  #include<util\delay.h>
                   
                  #define mid0 10          
                  #define mid1 17
                  #define mid2 52        
                   
                   
                   
                  void delay_ms(unsigned char time_ms)
                  {
                      unsigned short delay_count = F_CPU / 4000;
                   
                      unsigned short cnt;
                      asm volatile ("\n"
                                    "L_dl1%=:\n\t"
                                    "mov %A0, %A2\n\t"
                                    "mov %B0, %B2\n"
                                    "L_dl2%=:\n\t"
                                    "sbiw %A0, 1\n\t"
                                    "brne L_dl2%=\n\t"
                                    "dec %1\n\t" "brne L_dl1%=\n\t":"=&w" (cnt)
                                    :"r"(time_ms), "r"((unsigned short) (delay_count))
                      );
                  }
                   
                   
                      void delay(int a)
                      {  
                          int i;
                          for(i=0;i<=a;i++)
                          delay_ms(100);
                      }
                   
                      void forward()
                      {
                      PORTB=0x01;
                      PORTD=0x01;                                                                         
                      }
                       
                     
                      //             control(left , right)
                      void control(unsigned char x,unsigned char y)  // for pwm
                      {
                      TCCR0=0x6B;
                      TCCR2=0x6B;
                       
                      OCR0=x;
                      OCR2=y;
                      }
                   
                  int main()
                  {
                   
                      int s0;
                    
                   
                   DDRA=0x00;
                   DDRB=0xFF;
                   DDRC=0xFF;
                   DDRD=0xFF;

                    // ADC
                  ADMUX=0xE0;
                  ADCSRA=0xA4;
                   
                   
                  //ADCSRA|=(1<<ADEN);
                  ADCSRA|=(1<<ADSC);
                  delay_ms(1);
                   
                  while(1)  
                  {     
                          ADMUX=0xE3;         
                          delay_ms(10);
                          s0=ADCH;
                        
                      control(255,255);
                          forward();
                  if(s1<mid1&&s0<mid0&&s2<mid2)
                  {
                  forward();
                  }
                   
                  }
                  return 0;
                  }//end of main


                  On Fri, Jun 12, 2009 at 3:33 AM, s.holder123@... <s.holder123@...> wrote:


                  Thank you, much appreciated, i will try :)

                  Regards



                  --- In booksbybibin@yahoogroups.com, "write_to_ashuji" <write_to_ashuji@...> wrote:
                  >
                  > dont worry sir, stay in our group coz some people like me are interested in pointers too.keep up the gud work .:)
                  > regards,
                  > Ashish
                  >
                  > --- In booksbybibin@yahoogroups.com, STEVEN HOLDER <s.holder123@> wrote:
                  > >
                  > > Mihai,
                  > >  
                  > > Thanks for the line, Hows it going out there ? well i hope, didn't realsie that pointers would be such a problem, sorry. It works fine though i am not entirely sure this is what the user was asking for, it could be usefull to have a look at though, maybe somebody will use it.
                  > >  
                  > > Its a standard function in all my coding for Uarts, perhaps i may be in the wrong group, just thought i may be able to help some of the chaps here.
                  > >  
                  > > Take care, talk soon.
                  > >  
                  > > Regards
                  > >
                  > >
                  > > --- On Fri, 5/6/09, Mihai Galos <mihaigalos@> wrote:
                  > >
                  > >
                  > > From: Mihai Galos <mihaigalos@>
                  > > Subject: [booksbybibin,www.booksbybibin.tk] Re: AVR microcontroller with ADC
                  > > To: booksbybibin@yahoogroups.com
                  > > Date: Friday, 5 June, 2009, 5:02 PM
                  > >
                  > >
                  > >
                  > >
                  > >
                  > >
                  > >
                  > >
                  > > Stefan,
                  > > you never fail to amaze me.
                  > >
                  > > If this code was written by you, I respect your knowledge in C coding, I myself understand pointer arithmetic but I am certain most on this group would avoid it with any cost, because it is a beginner-level group.
                  > >
                  > > Keep up the good work,
                  > > Mihai
                  > >
                  > > --- In booksbybibin@ yahoogroups. com, "s.holder123@ ..." <s.holder123@ ...> wrote:
                  > > >
                  > > > This might do it,
                  > > >
                  > > >
                  > > > #define U16_NIBBLE(val) ((uint_8)((val >> 12) & 0x0F))
                  > > >
                  > > > /*!
                  > > > \note Hex_Ascii.
                  > > > \note Convert unsigned int value into ascii string.
                  > > > \param unsigned int hex value.
                  > > > \param Char pointer to data.
                  > > > */
                  > > > void Hex_Ascii(uint_ 16 Hex_Val, char * Data)
                  > > > {
                  > > > uint_8 Cnt = 0;
                  > > > uint_8 Temp = 0x00;
                  > > >
                  > > > *Data++ = '0';
                  > > > *Data++ = 'x';
                  > > >
                  > > > for(Cnt = 0; Cnt < 4; Cnt++)
                  > > > {
                  > > > /*! <!-- This gives us a 4 bit hex value. --> */
                  > > > Temp = U16_NIBBLE(Hex_ Val);
                  > > > if(Temp < 0x0A)
                  > > > {
                  > > > /*! <!-- This value = 0 - 9 , add 0x30 to give us a acsii number. --> */
                  > > > *Data++ = (Temp + 0x30);
                  > > > }
                  > > > else
                  > > > {
                  > > > /*! <!-- This value = A - F , add 0x37 (i.e 0x37 + 0x0A = 0x41 = 'A') to give us a acsii letter(capital) . --> */
                  > > > *Data++ = (Temp + 0x37);
                  > > > }
                  > > > /*! <!-- Shift the value up. --> */
                  > > > Hex_Val << 4;
                  > > > }
                  > > >
                  > > > /*! <!-- Terminate the string. --> */
                  > > > *Data++ = '\0'
                  > > > return;
                  > > > }
                  > > >
                  > > >
                  > > > Regards
                  > > >
                  > > >
                  > > > --- In booksbybibin@ yahoogroups. com, "Arian" <happyman757@ > wrote:
                  > > > >
                  > > > > Hi dears :)
                  > > > >
                  > > > > Dears, I am using ATmega16 microcontroller and I need help for about it. I have interfaced a sensor to portA0 and using ADC which is built in it i have digitized its output then showing the output on LCD.
                  > > > >
                  > > > > So i need a code for HEX to ASCII conversion for AVRs. Can any one help me plzzzzz.
                  > > > >
                  > > > >
                  > > > > Thanks in Advance.
                  > > > >
                  > > > >
                  > > > >
                  > > > >
                  > > > > Regards
                  > > > > Engr. Naveed Khowaja
                  > > > > B.E(electronics)
                  > > > > Electronic Engineer(DCC Technology)
                  > > > >
                  > > >
                  > >
                  >




                  --
                  Amar Kumar Nandan
                Your message has been successfully submitted and would be delivered to recipients shortly.