Forums

The connection of MAX232

Started by circuitcyco October 11, 2005
Hello, can anyone here give me some information on the connection of
host PC to MCU? I used MAX232 for voltage level conversion.I got few
version of schematics from the internet and I am not sure which one is
the correct one. I am not sure whether I should connect the XIRQ to the
MAX232 or not. Please give me some feedback on this. Thanks a lot.



circuitcyco wrote:
> Hello, can anyone here give me some information on the connection of
> host PC to MCU? I used MAX232 for voltage level conversion.I got few
> version of schematics from the internet and I am not sure which one is
> the correct one. I am not sure whether I should connect the XIRQ to the
> MAX232 or not. Please give me some feedback on this. Thanks a lot.

There is no "the correct one".

I don't know how knowledgeable you are about RS232, so if I'm
talking below you, just ignore the extra detail, ok?

Whether to connect XIRQ is a personal decision. There may be several
considerations involved. I personally would not do that. In fact,
I wouldn't connect XIRQ off-board through any commonly used connector,
and I'd heavily condition the connection. Just a momentary glitch
on that line during connect/disconnect and you can generate an
edge.

When I've needed to do this particular conversion, I either use
(1) a quick'n'dirty connection with no voltage conversion at all,
just a couple of transistors and steal the negative voltage from
the control signals on the PC or (2) a MAX232.

Exactly what connections you make are dependent on your needs.
Some may get away with three connections TxD, RxD, and GROUND.
I usually use DCE connections, so straight through cables
may be used. I also use 9 pin female connectors so a standard
cable may be used.

Also, ususally I put a male connector on the board, the
type with just square pins sticking up, and a little
short ribbon cable to the female 9 pin "RS232" connector.

Anyway, I usually use these connections for permanent stuff...

Pin Signal Direction Connection
1 DCD uC->PC From pin 4 (DTR)
2 RxD uC->PC SCI TD --|>o--- Pin 2
3 TxD uC<-PC SCI RD --o<|--- Pin 3
4 DTR uC<-PC To pins 1 (DCD) and 6 (DSR)
5 GND uC<->PC Ground
6 DSR uC->PC From pin 4 (DTR)
7 RTS uC<-PC To pin 8 (CTS)
8 CTS uC->PC From pin 6 (RTS)
9 RI none no connection

Legend:

--|>o--- TTL->RS232 level converter, input on left
--o<|--- TTL<-RS232 level converter, output on left

Note:

The signal conventions used in RS232 are from the view of the
data terminal equipment (DTE), not the view of the data
communication equipment (DCE) (i.e. modem). So RxD is
data received by the DTE (PC) from the DCE (uC). Hence
we connect RxD to the SCI transmitter.

End of note.

This way, when the PC (wired as DTE) asserts data terminal
ready (DTR), it automatically sees data set ready (DSR) and
carrier detected (DCD) so the "modem" automatically says it
is ready to talk. Then when the PC asserts request to send
(RTS), the "modem" automatically responds with clear
to send (CTS) meaning it has negotiated the direction of the
line.

So the connections make the uC look to the PC like a modem
connected on the other end, and it is always ready to
go when the PC wants to send.

The necessary connections depend on the communication
software used.

Mike
--
p="p=%c%s%c;main(){printf(p,34,p,34);}";main(){printf(p,34,p,34);}
This message made from 100% recycled bits.
You have found the bank of Larn.
I can explain it for you, but I can't understand it for you.
I speak only for myself, and I am unanimous in that!



Mike McCarty wrote:

[some boring stuff, and then some stuff which was WRONG]

Sorry, made a mistake typing...

> Anyway, I usually use these connections for permanent stuff...
>
> Pin Signal Direction Connection
> 1 DCD uC->PC From pin 4 (DTR)
> 2 RxD uC->PC SCI TD --|>o--- Pin 2
> 3 TxD uC<-PC SCI RD --o<|--- Pin 3
> 4 DTR uC<-PC To pins 1 (DCD) and 6 (DSR)
> 5 GND uC<->PC Ground
> 6 DSR uC->PC From pin 4 (DTR)
> 7 RTS uC<-PC To pin 8 (CTS)
> 8 CTS uC->PC From pin 6 (RTS)

WRONG! We get this signal from Pin 7, not from Pin 6.

Sorry about that!

Note that other connections may also work. Some connect

4->1->6->8 so DTR asserts DCD, DSR, and CTS.

YMMV

Mike
--
p="p=%c%s%c;main(){printf(p,34,p,34);}";main(){printf(p,34,p,34);}
This message made from 100% recycled bits.
You have found the bank of Larn.
I can explain it for you, but I can't understand it for you.
I speak only for myself, and I am unanimous in that!



Thanks for the feedbacks. You are very supportive . Again, thanks a lot.

Mike McCarty <Mike.McCarty@Mike...> wrote:Mike McCarty wrote:

[some boring stuff, and then some stuff which was WRONG]

Sorry, made a mistake typing...

> Anyway, I usually use these connections for permanent stuff...
>
> Pin Signal Direction Connection
> 1 DCD uC->PC From pin 4 (DTR)
> 2 RxD uC->PC SCI TD --|>o--- Pin 2
> 3 TxD uC<-PC SCI RD --o<|--- Pin 3
> 4 DTR uC<-PC To pins 1 (DCD) and 6 (DSR)
> 5 GND uC<->PC Ground
> 6 DSR uC->PC From pin 4 (DTR)
> 7 RTS uC<-PC To pin 8 (CTS)
> 8 CTS uC->PC From pin 6 (RTS)

WRONG! We get this signal from Pin 7, not from Pin 6.

Sorry about that!

Note that other connections may also work. Some connect

4->1->6->8 so DTR asserts DCD, DSR, and CTS.

YMMV

Mike
--
p="p=%c%s%c;main(){printf(p,34,p,34);}";main(){printf(p,34,p,34);}
This message made from 100% recycled bits.
You have found the bank of Larn.
I can explain it for you, but I can't understand it for you.
I speak only for myself, and I am unanimous in that! SPONSORED LINKS
Freescale semiconductor inc Microcontrollers Pic microcontrollers 8051 microprocessor

---------------------------------
YAHOO! GROUPS LINKS --------------------------------- ---------------------------------
Yahoo! Music Unlimited - Access over 1 million songs. Try it free.