??? 08/01/04 20:57 Read: times |
#75217 - Serial connection. |
The more I search, the more I get lost. I think I got it but there's too many crossings on the RS232 connection to embrace them all, so please check my step-by-step walkthrough for any misconceptions/errors.
There are 3 kinds of RS232 cables: DTE-DCE, DTE-DTE and Null-modem. For communication between PC and '51 I need the lines crossed over - either in DTE-DTE/NullModem cable or on board (then I use "straight" DTE-DCE cable). Let's trace, say, the MCU TX line (RX obviously is complementary to that). It goes out of the pin 4 (P1.3) of your average '51 pin-compatibile MCU, reaches pin 10 (T2in) of MAX232, goes out on the opposite side (T2out, pin 7) and into pin 2 of a DB9 male socket (looking into pins side, second from left in top (the longer) row.) It goes into pin 2 of DB9 female socket of the cable (second this time from right) and through the cross-over inside the cable goes out through RX pin (3, the middle one) of the fem DB9 on the other end, by PC. Then Pin3 of PC socket (male) and PC UART. Alternatively I connect pin 7 of MAX232 (T2out) with pin 3 of the DB9 socket and pin 8 (R2in) of MAX232 with pin 2 of DB9, then use straight (DTR-DTS) cable. To enable transmission with hardware handshake settings on PC I connect pins 1-4-6 and 7-8 of the socket too. Right? I just wanted to double check before I start buying and soldering things. (measure twice cut once) |