Connect with us

Send serial data from A device to B through AVR

Discussion in 'Microcontrollers, Programming and IoT' started by Dada Krauter, Feb 23, 2015.

  1. Dada Krauter

    Dada Krauter

    28
    0
    Feb 22, 2015
    Hello everyone, :)

    I want to connect two devices to one FT232RL(A device: AVR | B device: xBee).

    I want to make two modes:
    First: Debug mode > PC communicates only with AVR.
    Second: Configure mode > X-CTU program configures xBee through AVR (It sends data to AVR, AVR sends to xBee, xBee sends data back to AVR and than AVR sends back to FT232RL, PC)

    Im working with Atmel Studio 6 C code;

    See my attachment for detailed schematic>>>

    Thanks ;)

    DADA
     

    Attached Files:

    • 10.jpg
      10.jpg
      File size:
      49.9 KB
      Views:
      151
  2. Harald Kapp

    Harald Kapp Moderator Moderator

    9,366
    1,901
    Nov 17, 2011
    That should be entirely possible.
    What is your question?
     
  3. Dada Krauter

    Dada Krauter

    28
    0
    Feb 22, 2015
    Thank you Harald Kapp for your fast reply :)

    So I want to write this function in C language. Only one part, where AVR sends to xBee received data from FT232RL and where AVR sends data back to FT232RL received from xBee.
    Im making flight controller, I have onboard xBee module and I want to configure xBee module by connecting controller to PC without any other FTDI boards like that> https://www.sparkfun.com/products/11812 <(X-CTU>xBee config. program> http://www.digi.com/products/wireless-wired-embedded-solutions/zigbee-rf-modules/xctu <) and also I don't want to use two FT232RL chips, one for debugging and one for xBee config. So I need a simple C code... :) That will written to AVR.
    Again>AVRs function:

    PC>FT232RL>AVR>xBee
    PC<FT232RL<AVR<xBee

    AVR gives direction to serial data, receives from FTDI and sends to xBee or receives from xBee and sends to FTDI(PC)
    For debugging mode AVR will not send serial data to xBee.

    Thanks again ;)

    DADA
     
  4. Dada Krauter

    Dada Krauter

    28
    0
    Feb 22, 2015
    AND can you tell me how to convert data[] to result? I have following code:

    i=0;
    while(data(i)!=',')
    {
    uartprint(data(i)); I can't write this [] so used that ()
    i++;
    }

    the code prints separately each digit. e.g. prints 1 then 2 then 3 (123)

    so i want to save each digit together to one integer, let's say to result.

    how can I do it in C code?

    Thanks again :)

    DADA
     
    Last edited: Feb 25, 2015
  5. Harald Kapp

    Harald Kapp Moderator Moderator

    9,366
    1,901
    Nov 17, 2011
    Not my domain. Someone else come to the rescue?
     
  6. Dada Krauter

    Dada Krauter

    28
    0
    Feb 22, 2015
  7. Dada Krauter

    Dada Krauter

    28
    0
    Feb 22, 2015
    Someone knows how to do that?? I need C code :)

    Thanks :))

    DADA
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-