title: Read a txt file from PC using UART - Atmega32A
body: <p>I am a beginner in microprocessor programming. I created an array and sent datas using UART. I want to read a text file and create this array using datas in the text file with the simplest way possible. Any suggestion to proceed? Thanks in advance. </p>
  
  <pre><code>#include &lt;avr/io.h&gt;
  #include &lt;stdio.h&gt;
  #include &lt;avr/interrupt.h&gt;
  #include &lt;util/delay.h&gt;
  #define F_CPU 8000000UL  // Clock freq
  
  char flag = 0;
  
  void usart_init(void){
   UCSRA = 0x02;
   UCSRB = 0x98; // Enable transmitter Enable receiver Enable Interrupt
   UCSRC = (1&lt;&lt;UCSZ1) | (1&lt;&lt;UCSZ0); // set as 8 bit data, no parity bit and 1 stop bit. 
   UBRRH = 0x00;
   UBRRL = 109;
  }
  
  int main(void){
   usart_init();
  
   while(1){
  
    unsigned char array[5]={0x44,0xAA,0x33,0xBB,0x55};
  
    for (int i=0;i&lt;5;i++){
     UDR = array[i];
     UDR = 0xFF;
     _delay_ms(100);
    }
  
    sei();
    if(flag == 1)
    {
     flag = 0;
     UCSRB = 0x98;
    }
   } 
  }
  
  ISR(USART_RXC_vect){
  
    UCSRB = (0&lt;&lt;RXEN)|(0&lt;&lt;TXEN)|(0&lt;&lt;RXCIE);
    flag = 1;
  }
  </code></pre>