title: How do I send data with USB and read with driver?
body: <p>Via my usb connection I receive some commands, which I would like to make them readable for my driver. </p>
  
  <p>First char is a letter S and afterwards a few numbers (4) come inside.
  I want to transform this numbers from asci to decimal and then write them as HEX in other function. Maximum size can be 20 bits.</p>
  
  <p>Since I am new with C I have problems with this transforming.</p>
  
  <p>I would be glad if someone could give me some advices.</p>
  
  <pre><code>u8 x;
  u8 xx;
  u8 xxx;
  u8 xxxx;
  u32 y;
  
  void ProcessCommandUSB(u8 b_Data[USB_COMMAND_LENGTH],u8 b_DataLength) 
  { 
      switch (b_Data[0])  // process first byte
      {
      case '\r':  // ignore
          break;
  
      case '\n':  // ignore
          break;
  
      ////// SPEED ///////
      case 'S':
          x= b_Data[1];
          xx= b_Data[2];
          xxx= b_Data[3];
          xxxx= b_Data[4];
  
  // I NEED TO CHECK IF VARIABLES ARE NUUMBERS, OTHERWISE ERROR.
  if (x,xx,xxx,xxxx =='0')|(x,xx,xxx,xxxx =='1')|(x,xx,xxx,xxxx =='2')\
    |(x,xx,xxx,xxxx =='3')|(x,xx,xxx,xxxx =='4')|(x,xx,xxx,xxxx =='5')\
  |(x,xx,xxx,xxxx =='6')|(x,xx,xxx,xxxx =='7')|(x,xx,xxx,xxxx =='8')|(x,xx,xxx,xxxx =='9');
  {
          //to make asci char, decimal
          x = (x-48)* 1000; 
          xx = (xx-48)* 100;
          xxx =(xxx-48)* 10;
          xxxx -= 48;
      y=x+xx+xxx+xxxx;  
  }
      //THIS PART OF CODE DOWN WORKS, AND I WANT TO WRITE THE BYTES RECEIVED 
      //WITH S COMMAND (Y), IN FUNCTION RUN INSTEAD OF 0x034444. 
  
      else
  {
      sprintf(vrni, "D Error\r");
  }
  
  USB_Send_String (vrni);
      break;
  
      case 'D':  // version
  
          if(b_Data[1] == '&lt;')
          {
              RUN(REV, 0x034444);
              sprintf(vrni, "nazaj\r");
  
               ....... //REST OF THE CODE WORKS
  </code></pre>