Monday, January 26, 2009

Further research on how to interface the serial port

I choose the 9-pin serial port, so how do I proceed now? I asked myself the following questions:
  • What does each of the 9 pins do?
  • Which pins do I actually need?
  • What will my cable look like?
  • What does the signal coming from the data pin look like?
The connector
So I fired up Google, did a search on “serial port” and lots of information about the connectors showed up, I'll summarize it here (for the 9-pin variant):


Pin #

Abbreviation

Name

Function

1

CD

Carrier Detect

Used by modem to signal that it is connected to a working phone line.

2

RD

Receive Data

Local device receives data sent from the other device.

3

TD

Transmit Data

Local device transmits data to the device at the other end.

4

DTR

Data Terminal Ready

Local device sends a signal that it is ready to transmit.

5

SG

Signal Ground

Ground.

6

DSR

Data Set Ready

Remote device signals if it's ready to transmit.

7

RTS

Request To Send

Local device requests if remote device is ready to receive data.

8

CTS

Clear To Send

Remote device acknowledges that it's ready to receive data.

9

RI

Ring Indicator

Used by modem to indicate that it has detected a ringing signal on the phone line.

Well, since my IC is not a modem, I am not going to use pins 1 and 9. My IC does not send feedback, so that excludes pin 2. So far, that leaves pins 3 – 8. Let's examine pins 4 and 6 a little closer: pin 4 sends a signal out that to tell that it's ready to transmit, and pin 6 is waiting for an incoming signal which means the other device is also ready to transmit. The IC is ready to receive data at any given time, so I will connect pin 4 to pin 6, which in fact tells the port that it's ready to transmit as soon the computer itself is ready. I also will connect pin 7 to pin 8 (check out the table to see why that is). Pin 5, I will leave this pin unconnected, since my IC is already grounded at another point. And last but not least, the Transmit Data pin (#3) will be used to send data to the IC.

So the connector which goes into my computer will look like this:


Side note: there are 9 pin connectors which are easy to disassemble, specially designed to be altered to your own needs. I used one that looks like this:



Side note #2: on Ubuntu, I used the program “statserial” to inspect the idle state of my serial port, when my connector was connected.


The question remaining here, is how does the signal (or wave) coming from the TD pin look like? I will be going into more detail about this in my next post. Stay tuned!

8 comments: