serial communication

Discussion in 'The Projects Forum' started by th3play3r, May 23, 2007.

  1. th3play3r

    Thread Starter New Member

    May 23, 2007

    i'm new to electronics and i have some problems making my project work. i can't make the serial communication work. the communication is between a PC and a AT89S52. i use a MAX232 to convert the RS232 signals to TTL and vice-versa. i read some datasheets, in some the caps of the MAX232 are 0.1, 1 or even 10 microF. what is the corect value?

    and another question ... regarding the serial connector on the PCB, i saw some schemes where RTS and CTS are connected, and DTR, DSR and CD are connected as well. do i need to wire them in my case also.

    thanks a lot.
  2. bloguetronica

    AAC Fanatic!

    Apr 27, 2007
    The capacitors used in MAX232 are used to store charge for the voltage doubler and the inverter. They recommend the use of 1.0micro capacitors, but you can use bigger ones (within a limit, so the current spikes won't damage the MAX232 chip).

    Refer to:
  3. Papabravo


    Feb 24, 2006
    The RS232 handshaking signals(RTS,CTS,DSR,DTR et. al.) are an anachronism left over from the time of dialup modems. In those early devices you could not send and receive at the same time(RTS,CTS) and you could do nothing at all if there was no telephone connection(DTR,DSR,DCD).

    In most applications you only need TxD, RxD, and GND, because both ends of the communications pipe have the capability to drink from the firehose. If there is a need for flow control then the XON/XOFF mechanism works quite well.
  4. John Luciani

    AAC Fanatic!

    Apr 3, 2007
    There are a few different versions of the MAX232 IC that require different values
    of the doubler and inverter capacitors. The ICs which run the doubler and inverter
    at higher frequencies require lower values of capacitance. At the top of the
    electrical characteristics table there is a list of conditions that state the
    value of capacitance required to achieve the specified performance. Unless
    you have an unusual application you should be able to use the listed value.

    Those are hardware flow control lines. They are used to enable and disable transmission
    of data. If your AT89S52 application is not going to use hardware flow control you
    can connect the lines as you described and use software flow control.

    I usually use software flow control rather than hardware flow control. It saves a few
    I/O lines an the uC.

    (* jcl *)
  5. lightingman

    Senior Member

    Apr 19, 2007
    I use 10uF caps.Do bear it in mind that the MAX232 will invert the the signal, and sometimes this will make a difference to the serial data...Daniel.
  6. andi

    New Member

    Jul 5, 2007

    I am interfacing a microcontroller with a PC and was wondering how to use software handshaking for this. Is there any example code out there for software flow control? How to integrate this into my embedded program?

    Thanks in advance
  7. Papabravo


    Feb 24, 2006
    There probably is but it might be more time and trouble to find then to implement. It is fairly straightforward. There are two control characters called XON and XOFF, also known as DC1 and DC3 or ^Q and ^S. When you want to slow down another transmitter you send an XOFF. When you want him to start again you send an XON. In your receiver you look for the XON and XOFF characters. When you receive an XOFF you stop your transmitter and wait for an XON.
  8. a_kent

    Active Member

    Jun 12, 2007
    Yep, and the Xoff in most of my code happens inside the receive interrupt and sets a stopped flag, when the buffer is nearing full.
    Then the main code sees that flag when the buffer is near empty and issues an Xon, clearing the stopped flag.
    This is all much easier with a half duplex connection.
  9. dionaide

    New Member

    Jul 30, 2007
    thanks for your ideas.
    i learned a lot.