RS-232 via the MAX3232

Genuine RS-232 signals are bipolar in nature, swinging below and above ground. If this is what you need for your application, then consider the Maxim MAX3232 chip. This integrated circuit (which runs on +5V) will convert TTL levels to bipolar, and vice-versa. The signal comes out to something like +/- 5V. Incidentally, greater noise immunity is the key benefit of going with true RS-232 levels. While not absolutely necessary, perhaps you'd like to look over the data sheet:

The chip requires some caps for the charge pumps, but it's far simpler to just purchase a breakout board which includes them. That's what I did, for besides, my eyes and hands are just too old for surface mount parts. Here's what the rig looks like:

I bought it off of Amazon for around $7. One unusual thing to keep in mind is that the breakout board is labeled in a way you might not expect. As rule, with most RS-232 devices (and MIDI), it is customary to connect the RxD of one device to the TxD of the other, and vice-versa. Not so with this breakout board: RxD goes to RxD, and TxD to TxD. Popping it into the circuit, you'll get something like this:

The demo program is identical to the previous two serial communication exercises. With it, you'll be able to turn some LEDs on, and see the communication in both directions.

Click to get the source code.
Click to get the schematic PDF.

Next Project: I2C -- EEPROM

No comments:

Post a Comment