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

Re: [booksbybibin,www.booksbybibin.tk] about the use of a function

Expand Messages
  • Kallol Karmakar
    Thanks a lot Steven H. wish you good luck ________________________________ From: STEVEN HOLDER To: booksbybibin@yahoogroups.com
    Message 1 of 7 , Mar 28, 2010
      Thanks a lot Steven H.
      wish you good luck



      From: STEVEN HOLDER <s.holder123@...>
      To: booksbybibin@yahoogroups.com
      Sent: Monday, March 15, 2010 17:59:22
      Subject: Re: [booksbybibin,www.booksbybibin.tk] about the use of a function

       

      The buffer size is entirely up to you and the values that you use in this equation.
       
      The function is integer to char array so you need a buffer that it big enough to hold a char array to represent the number.
       
      Example if the number is 255 you need a 4 item buffer for "2" "5" "5" and the null.
       
      If the number is a maximum (assuming signed int) 32768 so you will need a 6 char buffer.
       
      As a good comprimise you specify a buffer size of 8 , that will be big enough to hold any number presented to this function.
       
      That is assuming your radix is 10. Any other radix and you need to consider the max number that will be represented. If your radix was 2 (binary) then your buffer would need to be bigger (17).
       
      Hope that helps.
       
      Regards


      --- On Mon, 15/3/10, Kallol <kallolkk@yahoo. com> wrote:

      From: Kallol <kallolkk@yahoo. com>
      Subject: [booksbybibin, www.booksbybibin .tk] about the use of a function
      To: booksbybibin@ yahoogroups. com
      Date: Monday, 15 March, 2010, 7:50

       
      Hi everyone,

      i was using char *itoa(int value, char *buffer, int radix); to convert interger data to character.

      avrlibc manual gives the following information:
      (Converts an integer value to a null-terminated string using the specified radix and stores the result in the given buffer.If radix is 10 and value is negative the string is preceded by the minus sign (-). With any other radix, value is always considered unsigned.buffer should be large enough to contain any possible value: (sizeof(int) *8+1) for radix=2, i.e. 17 bytes in 16-bits platforms and 33 in 32-bits platforms.)


      I cant understand how the buffer size is chosen ,when the radix is 10.after a little try i used a character array of 5.(ie char buffer[5]).But dont know why this array size is chosen.Can anyone help me with it.......... .......

      Thanking u all
      Kallol KK



      New Email names for you!
      Get the Email name you've always wanted on the new @ymail and @rocketmail.
      Hurry before someone else does!
    • Bhavin Shah
      can anyone please suggest me a good tutorial for sound generation using atmega16
      Message 2 of 7 , Apr 22, 2010
        can anyone please suggest me a good tutorial for sound generation using atmega16


      • arifuddin2007
        ... http://extremeelectronics.co.in/avr-tutorials/sound-generation-by-avr-micro-tutorial-i/ this is excellent tutorial for sound generation.
        Message 3 of 7 , Apr 26, 2010
          --- In booksbybibin@yahoogroups.com, Bhavin Shah <bhavinshah3671@...> wrote:
          >
          > can anyone please suggest me a good tutorial for sound generation using atmega16
          >


          http://extremeelectronics.co.in/avr-tutorials/sound-generation-by-avr-micro-tutorial-i/

          this is excellent tutorial for sound generation.
        • hieuha
          Hi Bhavin, I did not try before, but you can search about Pulse with modulation method. Example: - We generate 8000 cycle per second (125us period). - In each
          Message 4 of 7 , Apr 26, 2010
            Hi Bhavin,
             
            I did not try before, but you can search about Pulse with modulation method. Example:
            - We generate 8000 cycle per second (125us period).
            - In each cycle:
                Level 255 will be outputed as signal 1 in 125 us.
                Level 127 will be outputed as signal 1 in 62.5 us.
                Level 0 will be outputed as signal 1 in 0 us.
            - Output will be connected with a simple filter circuit (RC circuit) before reach the audio amplifier.
             
            Best regards,
             
            Vu Trung Hieu.


            Từ: Bhavin Shah <bhavinshah3671@...>
            Đến: booksbybibin@yahoogroups.com
            Gửi ngày: 23:51:09, Thứ Năm, 22 tháng 4 2010
            Chủ đề: Re: [booksbybibin,www.booksbybibin.tk] about the use of a function

             

            can anyone please suggest me a good tutorial for sound generation using atmega16



          Your message has been successfully submitted and would be delivered to recipients shortly.