serial communication

Thread Starter

th3play3r

Joined May 23, 2007
1
hello,

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.
 

Papabravo

Joined Feb 24, 2006
21,225
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.
 

John Luciani

Joined Apr 3, 2007
475
hello,

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?
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.

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.
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 *)
 

lightingman

Joined Apr 19, 2007
374
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.
 

andi

Joined Jul 5, 2007
1
Hi,

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
 

Papabravo

Joined Feb 24, 2006
21,225
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.
 

a_kent

Joined Jun 12, 2007
30
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.
 
Top