How to read from RS232 into ATMega64

Discussion in 'Embedded Systems and Microcontrollers' started by premsuku, Aug 19, 2008.

  1. premsuku

    Thread Starter New Member

    Aug 19, 2008
    3
    0
    Hi,

    I am trying to read the message entered from 1 hyperterminal connected to UART1 and write that message into another hyperterminal connected to UART0.
    Please help if some one know how to do this

    Thanks
     
  2. nanovate

    Distinguished Member

    May 7, 2007
    665
    1
    You can use a null modem cable
     
  3. premsuku

    Thread Starter New Member

    Aug 19, 2008
    3
    0
    Thanks for the reply, could you explain how I can program that in c
     
  4. hgmjr

    Moderator

    Jan 28, 2005
    9,030
    214
    Do you have a schematic and any starting code at this point?

    If so go ahead and post it.

    hgmjr
     
  5. premsuku

    Thread Starter New Member

    Aug 19, 2008
    3
    0
    Thanks for the reply I found the solution..

    #include avrlib/uart2.h
    main(){
    uartInit(); // initialize UARTs (serial ports)
    uartSetBaudRate(0, 115200); // set UART0 speed to 115200 baud
    uartSetBaudRate(1, 115200); // set UART1 speed to 115200 baud
    timerInit(); // initialize the timer system

    while(1){

    rprintfInit(uart0SendByte); // configure rprintf to use UART0 for output

    char c = (char)uart1GetByte();
    rprintfChar(c);
    timerPause(500);
    }
    }
     
  6. hgmjr

    Moderator

    Jan 28, 2005
    9,030
    214
    That is good news.

    How do you like designing with AVR microcontrollers?

    hgmjr
     
Loading...