#include <tiny2313.h>
#include <stdio.h>
#include <delay.h>

void main(void)
 {
 int temp=4;
 char k=1;
 
  #pragma optsize-
  CLKPR=0x80;
  CLKPR=0x00;
  #ifdef _OPTIMIZE_SIZE_
  #pragma optsize+
  #endif
 
  PORTB=0x00;
  DDRB=0xFF;

  PORTD=0xFF;
  DDRD=0x00;



  // Universal Serial Interface initialization
  // Mode: Disabled
  // Clock source: Register & Counter=no clk.
  // USI Counter Overflow Interrupt: Off
  USICR=0x00;

  // USART initialization
  // Communication Parameters: 8 Data, 1 Stop, No Parity
  // USART Receiver: On
  // USART Transmitter: On
  // USART Mode: Asynchronous
  // USART Baud Rate: 9600
  UCSRA=0x00;
  UCSRB=0x18;
  UCSRC=0x06;
  UBRRH=0x00;
  UBRRL=0x19;


  while (1)
   {
    k=getchar();
     delay_ms(500);   
    putchar(k);
    delay_ms(500);
    printf("%i\r\n", temp);

   };
 }