The pinout of the DB-9 connector can be confusing when cabling an RS232 line. There are a lot of details to consider when arranging the pins between Male and Female connectors on a serial cable or serial device. The two main things to be concerned about are the pinout and the gender.
The Male connector has pins and the Female connector has sockets. The pins are numbered oppositely when looking directly at the connectors.
A male has to connect to a female.
There are two standard pinout arrangements for the DB-9 connector, DTE and DCE. In most cases a Male will be DTE and a Female will be DCE, but not always. For a basic RS232 connection, you will only need Rx, Tx and Ground. Some equipment may require the additional control pins. Notice how the pin arrangement puts Tx to Rx, DTR to DSR, and RTS to CTS.
A DTE has to connect to a DCE
Note: - In most cases a Male will be a DTE and a Female will be DCE
Combine the Two
From these two details you should be able to find the right pin combination for your device. Take the details you know about the current connector and apply the opposite to find the right mate.
If you have a MALE with a DTE pinout, it will need to connect to a FEMALE with a DCE pinout.
If you have a MALE with a DCE pinout, it will need to connect to a FEMALE with a DTE pinout.
Null Modem vs. Gender Changer
Any DTE-DTE or DCE-DCE connection should use a null modem.
Any Male-Male or Female-Female connection will require a gender changer.
If you have a MALE with a DTE pinout and a FEMALE with a DTE pinout, it will require a Null Modem.
If you have a MALE with a DTE pinout and a Male with a DCE pinout, it will require a Gender Changer.
If you have a MALE with a DTE pinout and a MALE with a DTE pinout it will require a Null Modem Gender Changer. This is the most common scenario.