Writing characters to the serial port

The standard RS-232 serial bus is ubiquitous in computing and electronics in general. Every computer I've ever encountered has an RS-232 compatible serial port.  This makes it the ideal bus to communicate text to your computer with. Serial ports can be different shapes and sizes.  On the standard modern PC you will find it as a 9-pin D-sub, on older PCs it may also take the form of a 25-pin D-sub. On the Apple it is a 9-pin round socket.

The original RS-232 standard specifies that the high and low conditions being sent be in the range of -15 volts to +15 volts. Most microcontrollers (including the AT90s2313) are only capable of outputting 0 volts for low and 5 volts for high (off and on).  Luckily most computers will accept 0 volts and low and 5 volts so this is not a big issue.  To assist in acheiving trouble free communications between the microcontroller and the computer I will be using a separate IC to drive and receive the correct voltages associated with the RS-232 standard. The chip I will be using is the widely known MAX232 from Maxim (www.maxim-ic.com) Other manufacturers have similar ICs available also.

MAX232 pin configuration

To physically connect the AT90s2313 to your computer you will need to construct a cable.  I use a cable that has 9-pin plug on one end and a 3.5mm stereo plug on the other (same as the headphone plug for walkmans, CD players etc).  I then connect the 3.5mm stereo plug into a 3.5mm stereo socket that is attached to the MAX232.



Pin labels from datasheet