title: AVR UART String transmission (not every char is transmited)
body: <p>I program an AtMega 32 UART module. I try to send strings with my function, but it works in very special way. In general it sends some chars from that string. Some, not all. I wrote that function in three different ways, every time with the same result. I use RS232/USB converter to check how is it works.</p>
  <p>This is my program, and below are results of transmission.</p>
  <pre><code>#define F_CPU 8000000
  #include &lt;avr/io.h&gt;
  #include&lt;avr/interrupt.h&gt;
  #include&lt;util/delay.h&gt;
  #include&lt;string.h&gt;
  
  #define BAUD_RATE 19200
  #define BAUD_PRESCALER (((F_CPU / (BAUD_RATE * 16UL))) - 1) 
  
  static void BAUD_SETTINGS(){
      UBRRH=(BAUD_PRESCALER&gt;&gt;8);
      UBRRL=BAUD_PRESCALER;
  }
  
  static void TRANSMIT_SETTINGS(){
      UCSRB=(1&lt;&lt;TXEN) | (1&lt;&lt;RXEN) | (1&lt;&lt;RXCIE);
      UCSRC=(1&lt;&lt;UCSZ0) | (1&lt;&lt;UCSZ1) | (1&lt;&lt;URSEL);
  }
     
  void UART_TX(unsigned char znak);
  void UART_String_TX(char *command);
  
  //MAIN//
  int main(void)
  {
      
      BAUD_SETTINGS();
      TRANSMIT_SETTINGS();
          
      DDRA=0xff;
      PORTA=0xff;
      PORTD=0x02;
      sei();
      
      _delay_ms(1500);
      for(;;){
          PORTA=0xff;
          UART_String_TX(&quot;Hello World!&quot;);
          _delay_ms(1000);
      }
  }
  
  void UART_TX(unsigned char znak){
      while(!(UCSRA &amp; (1&lt;&lt;UDRE)));
      UDR = znak;
  }
  
  void UART_String_TX(char *command){
      
  while(*command != 0x00){
      UART_TX(*command);
  command++;}
  }
      
  ISR(USART_RXC_vect){
      char RXC_byte;
      RXC_byte=UDR;
      UDR=RXC_byte;
      PORTA=0x00;
  }
  </code></pre>
  <p>There are two other variants of sending function, but it works the same.</p>
  <pre><code>/*
      void UART_TX(char *command){
          
          while(*command){            / *!='\0'* /
              if(UCSRA&amp;(1&lt;&lt;UDRE)){
                  UDR=command;
                  command++;
              }
          }
      }*/
      /*
      void UART_TX(char *command){
          int i=0;
              while(command[i]){          / *!='\0'* /
                  while(!(UCSRA&amp;(1&lt;&lt;UDRE)));
                  UDR=command[i];
                  while(!(UCSRA&amp;(1&lt;&lt;UDRE)));
                  i++;
                          
          }
      }*/
  </code></pre>
  <p>Result of sending &quot;Hello World!&quot; few times (with 1s delay) is:</p>
  <blockquote>
  <p>loWrd!</p>
  <p>loWrd!</p>
  <p>elë]Wrd!</p>
  <p>el od!</p>
  <p>el ol!</p>
  <p>Hl ol!</p>
  <p>HloWrd!</p>
  <p>Hl ol!</p>
  <p>HloWr!</p>
  <p>HloWo#‘!</p>
  </blockquote>
  <p>Memory adresses of that chars are (from other text):</p>
  <blockquote>
  <p>97 99 101 103 104 106 108 110 112 113 115 117</p>
  <p>96 98 100 102 104 106 107 109 111 113 114 116 117</p>
  <p>96 98 99 101 103 105 107 108 110 111 113 115 117</p>
  </blockquote>
  <p>There is no problem when i use &quot;echo&quot; function with RXC interrupt.</p>
  <p>What's going on?</p>