title: Converting to ASCII in C
body: <p>Using a microcontroller (PIC18F4580), I need to collect data and send it to an SD card for later analysis. The data it collects will have values between 0 and 1023, or 0x0 and 0x3FF.</p>
  
  <p>So what I need to do is convert 1023 into a base 10 string of literal ASCII values (0x31, 0x30, 0x32, 0x33, ...).</p>
  
  <p>My problem is that the only way I can think of to split the digits apart requires a lot of division.</p>
  
  <pre><code>char temp[4];
  temp[0] = 1023 % 10;
  temp[1] = (1023 % 100) / 10;
  temp[2] = (1023 % 1000) / 100;
  temp[3] = (1023 % 10000) / 1000;
  </code></pre>
  
  <p>Using this method, finding the ASCII values of an n digit decimal number requires 2n-1 divisions. Is there a method that would be faster?</p>
  
  <p>The end goal of this is to wind up with a .csv file on the SD card that can quickly be plugged into any laptop to see a graph of the data in Excel.</p>