title: AVR, UART, Proteus simulation, not all data displayed on virtual terminal
body: <p>I am writing a code for a MCU until that will transmit data via UART (RS232).
  [ATmega8A]</p>
  
  <p>Currently, I am testing my code in Proteus:</p>
  
  <pre><code>#include &lt;avr/io.h&gt;
  #include &lt;avr/interrupt.h&gt;
  #include &lt;util/delay.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;compat/twi.h&gt;
  
  #define FOSC 16000000                                       //Clock Speed
  #define BAUD 9600                                           //Baud rate set to 9600
  #define MYBRR FOSC/16/BAUD-1
  
  void USART_Init (void)
  {
  UBRRH = (MYBRR &gt;&gt; 8);                                //Code for setting
  UBRRL = MYBRR;                                       //the baud rate
  UCSRB = (1 &lt;&lt; RXEN) | (1 &lt;&lt; TXEN);                   //Enable receiver and transmitter
  UCSRC = (1 &lt;&lt; URSEL) | (1 &lt;&lt; UCSZ0) | (1 &lt;&lt; UCSZ1);  //Frame format setting: 8 Data, 2 Stop bit
  }
  
  /* USART transmit function */
  void USART_Transmit(unsigned char data)
  {
       while(!(UCSRA &amp; (1 &lt;&lt; UDRE)));                     //Wait until transmit buffer is empty
  
       UDR = data;
  }
  
  /* USART receive function */
  unsigned char USART_Receive(void)
  {
       while(!(UCSRA &amp; (1 &lt;&lt; RXC)));                      //Wait until data is received
  
       return UDR;                            //Get the data from buffer and return it
  }
  </code></pre>
  
  <p>and the test code in main:</p>
  
  <pre><code> int main(void)
   {
   unsigned char c;
  
  while(1)
  {
      a = USART_Receive();
      c = 10;
      USART_Transmit(c);
      _delay(10000);
  }
  }
  </code></pre>
  
  <p>In Proteus, the virtual terminal displays 0. However, I am expecting to see 10.
  This is just one example, in general only the last digit/character is getting displayed on the virtual terminal.
  I cannot explain this. Proteus bug or logic error?</p>
  
  <p>Thank you for any advise.</p>