//////////////////////////////////////////////////////////////////////////////////////////////
//FUNCTION:
//  itoa
//
//PURPOSE:
//  To convert a floating point number into a binary string
//
//INPUTS:
//  Value: unsigned int
//    The unsigned integer that should be converted into a binary string
//  Str: char[33];
//    A char array that has at least 33 elements (32 for the bits and 1 for the null
//    character at the end.
//
//RETURNS: 
//  NONE
//
#include <stdio.h>              /* Standard Input Output  */
#include <math.h>               /* Standard Math stuff    */
#include <stdlib.h>             /* Standard Library stuff */
#include <string.h>
    
void itoa(unsigned int Value, char* Str){

  //Looping number and test value
  int i=0;

  //This will be the integer that will be used to hold the bit
  unsigned int a=0x00000001;
  
  for (i=0;i<32;++i){

    //Do the OR and assign the string value 
    if ((a & Value) > 0) 
      Str[31-i] = 0x31;
    else
      Str[31-i] = 0x30; 
 
    //Now bit shift to test the next bit 
    a=a<<1;

  }
  
  //Now append the null character
  Str[32] = 0x0; 

}

