+ Post New Thread
Results 1 to 9 of 9
  1. #1
    Advanced Member level 1
    Points: 5,813, Level: 18
    Maverickmax's Avatar
    Join Date
    Dec 2004
    Posts
    404
    Helped
    8 / 8
    Points
    5,813
    Level
    18

    serial communication between two microcontrollers

    Greeting everyone

    Do you know any good tutorial for me to learn how to set up a serial communication between two AT89C51 chips in C language and a schematic layout?

    Thank in advance

    Maverickmax

  2. #2
    Advanced Member level 5
    Points: 160,151, Level: 95
    Awards:
    Helpful silver

    Join Date
    Oct 2004
    Location
    West Coast
    Posts
    7,943
    Helped
    2300 / 2300
    Points
    160,151
    Level
    95

    at89c51 uart

    To connect 2 51 microcontrollers you even dont need drivers (unless they are some distance apart). Just connect Rx os the first on with Tx of the second one and Tx of the first one with Rx of the second one + Common GND and your hardware is ready.

    You will have to set-up boyh UART for the same baud-rate and configuration.

    Other thing to consider is the use of serial port interrupts.

    Another issue is the use of command-response protocol but this may put one controller in MASTER position and the other in SLAVE.



    •   Alt15th January 2005, 08:37

      advertising

        
       

  3. #3
    Advanced Member level 1
    Points: 5,813, Level: 18
    Maverickmax's Avatar
    Join Date
    Dec 2004
    Posts
    404
    Helped
    8 / 8
    Points
    5,813
    Level
    18

    serial communication between two at89c51 chips

    Oic.....

    I will do that but can you please tell me more about serial interrupt port?

    Is there any C programs for transmitting data between two devices?

    Maverickmax



    •   Alt15th January 2005, 08:42

      advertising

        
       

  4. #4
    Advanced Member level 1
    Points: 5,813, Level: 18
    Maverickmax's Avatar
    Join Date
    Dec 2004
    Posts
    404
    Helped
    8 / 8
    Points
    5,813
    Level
    18

    at89c51 serial communication

    I am kind of struck at the moment because I am not sure how to transmit data from 8051 chip to another.

    Please advise or give me some links

    Maverickmax



    •   Alt15th January 2005, 15:38

      advertising

        
       

  5. #5
    Member level 3
    Points: 1,866, Level: 10

    Join Date
    Jan 2004
    Posts
    64
    Helped
    2 / 2
    Points
    1,866
    Level
    10

    at89c51 uart interrupt

    Hi Maverickmax,

    Your question has an complete answer in the book

    "Patterns for time triggered Embedded systems" by M. J. Pont

    (for 8051 micros)

    in chapter 27 is presented a complete solution

    One uC is declared master, and others are declared slaves.

    Master emit 9 bit messages: 8bits=data (or adress for the selected slave)
    Distinction between 8 bit data or 8bit adress of the slave is made by the 9'th bit emited by the master

    UART is in mode 3 for both masters and slaves


    Unfortunately an eletronic version of the "bible" doesn't exist , anyway here is some sample code in C (K*il) to get a fillng:

    SCU_Am.c master
    SCU_As.c slave software



  6. #6
    Advanced Member level 1
    Points: 5,813, Level: 18
    Maverickmax's Avatar
    Join Date
    Dec 2004
    Posts
    404
    Helped
    8 / 8
    Points
    5,813
    Level
    18

    at89c51 serial communication code in c

    Hi

    I would find the master and slave in the scheduler approach very useful for my future project but I only want to send data across to another AT89C51 (Receiver) in one way mode via wire.

    For example, the first AT89C51 is designed to send a temperature reading across the wire to another AT89C51. That's it

    Maverickmax



  7. #7
    Advanced Member level 2
    Points: 4,981, Level: 16
    Ace-X's Avatar
    Join Date
    Jan 2002
    Location
    Germany
    Posts
    530
    Helped
    41 / 41
    Points
    4,981
    Level
    16

    communication between two at89c51

    Quote Originally Posted by Maverickmax
    ... I only want to send data across to another AT89C51 (Receiver) in one way mode via wire.

    For example, the first AT89C51 is designed to send a temperature reading across the wire to another AT89C51.
    Check attached file. You should use function UART_CommInit to initialize once every of two uC UARTs. Then one uC can use function UART_Putchar to send single char to another uC. And second uC will use UART_Getchar to receive this char. Also, to send more than one char you can use function UART_Printf.

    This small UART lib is interrupt-driven with send/receive buffers, so you don't have to worry to check state of UART before sending/receiving new char. Buffer size is defined by TBUF_SIZE constant.

    Good luck!



  8. #8
    Full Member level 3
    Points: 2,929, Level: 12
    hm_fa_da's Avatar
    Join Date
    Sep 2003
    Location
    Iran
    Posts
    189
    Helped
    10 / 10
    Points
    2,929
    Level
    12

    at89c4051 hardware serial communication

    hi ;

    i have made a serial communication between 89c2051 and 89c51 ,
    but i didn't get a good results ,
    i guessed it is because of their ossilators are seprate , i mean sender may change data when receiver is sampling input , so an invalid data whould be received ,
    i at last wrote a program using 2 input/output pin for serial communication , but this way it was too slower than a ready UART .
    i have talked about this problem in :
    http://www.edaboard.com/viewtopic.ph...hlight=#316254



  9. #9
    Advanced Member level 2
    Points: 4,981, Level: 16
    Ace-X's Avatar
    Join Date
    Jan 2002
    Location
    Germany
    Posts
    530
    Helped
    41 / 41
    Points
    4,981
    Level
    16

    example of serial communication at89c51

    Quote Originally Posted by hm_fa_da
    i have made a serial communication between 89c2051 and 89c51 ,
    but i didn't get a good results ,
    i guessed it is because of their ossilators are seprate , i mean sender may change data when receiver is sampling input , so an invalid data whould be received ,
    UART uses an asynchronous protocol, so separate oscillators have nothing related to your problem and you should search for bug in your program, especially in initialization procedure.


    1 members found this post helpful.

+ Post New Thread
Please login