RS232 DB9 DB25 Help!

Status
Not open for further replies.

iwire

Moderator
Staff member
Location
Massachusetts
OK today I was asked to run some data lines from what I think was a 'serial port hub' to CNC milling machines.

Now the factory has a large number of these units and when I started looking at how the current working ones where pined out I found many differences.

Some seemed to be working on three conductors, some five, the DB25s had jumpers in different places.

Whats the deal? How can they be wired so differently but all worked?:confused:

I ended up using 5 conductors and pinned it out per the factory's main headquarters instructions. That pin out was different from any existing machines but also worked. :confused: :confused:
 

realolman

Senior Member
You only really need two if it's one way comms. Three if it'
s two way. Rx Tx and gnd. 2 3 and 5 on a DB9

there's handshaking that can be accomplished with the others

some things need a null modem which is a cord with the two Rx and Tx crossed and some are straight through.

Depends on how the thing is made.

Why? I dunno.

Here s a link to some info ttp://www.lammertbies.nl/comm/cable/RS-232.html
 

iwire

Moderator
Staff member
Location
Massachusetts
realolman said:
You only really need two if it's one way comms. Three if it'
s two way. Rx Tx and gnd. 2 3 and 5 on a DB9

It is two way.

some things need a null modem which is a cord with the two Rx and Tx crossed and some are straight through.

They told me it was null modem.

Thanks, I really appreciate it. :cool:
 

winnie

Senior Member
Location
Springfield, MA, USA
Occupation
Electric motor research
For RS-232, there are really 3 key lines, TXD (transmit data), RXD (receive data), and GND (signal ground). All of the other lines have to do with handshaking of one form or another. Very often the handshaking lines can be ignored; which means that they usually do get ignored, and this only bites one on the posterior infrequently.

TXD and RXD work in exactly the same way; TXD transmits data from the 'data terminal equipment' (computer) to the 'data communications equipment' (modem); RXD transmits data in the opposite direction. This distinction is often quite annoying, because it means that some devices expect to transmit data on a particular pin; other devices expect to receive data on that pin. A 'null modem' cable will cross the TXD and RXD lines, so that two 'computer like' devices can talk to each other.

The signal ground conductor can also be a nightmare. Not infrequently the signal ground is actually bonded via various power supply paths to the equipment ground. As I am sure you can imagine, this can be a mess.

All of the 'handshaking' lines exist so that the communicating devices can signal things such as having data ready to transmit, or having bandwidth available to transmit data. For example, a printer might use handshaking to tell the computer that it can accept more characters to print out. If your software has different handshake settings, you need to be careful to match the settings to the actual hardware, otherwise you might not transmit data at all, or you might continue to transmit data that cannot be accepted on the other side.

I am no expert on RS-232, but I've designed some simple in-house instrumentation that used it, and so have had a chance to bang my head on a bunch of RS-232 issues.

-Jon
 

dbuckley

Senior Member
'Course, what you need is an IT professional with the appropriate equipment...

I'd bring along my posh breakout box, the little bag full of adapters and gender benders, universal pinnable cables, the little RS232 data logger, and have the HP Protocol Analyzer in the car.

And if I still couldn't make it work (which has yet to happen) I'd megger the circuit, and declare that it was an equipment problem :)
 

iwire

Moderator
Staff member
Location
Massachusetts
Thanks for the responses, I am listening. :smile:

And dbuckley, thanks, I figured it would be Hal that would scream I had no right to touch a data cable. :grin:

There is an large in house IT dept. at this factory, they don't like coming out to the factory floor 'cause it's dirty.
 
Last edited:

grich

Senior Member
Location
MP89.5, Mason City Subdivision
Occupation
Broadcast Engineer
dbuckley said:
'Course, what you need is an IT professional with the appropriate equipment...

One of the other guys I work with in town says his IT guys don't know anything about serial :confused: . I guess serial control is so yesterday that it's not taught in school anymore?

Here's another information link that includes RS-422/485 stuff...http://www.bb-elec.com/technical_library.asp
 

dereckbc

Moderator
Staff member
Location
Plano, TX
iwire said:
It is two way.

They told me it was null modem.
Bob NULL MODEM means the TX and RX are reversed at each end of the cable. For example lets say you wanted to connect two computers back-to-back via the RS-232 port. The TX on one side has to be connected to the RX on the other. Computers, printers, and terminals are wired in the DTE configuration (DATA TERMINAL EQUIPMENT).

The opposite of DTE is DCE (DATA COMMUNICATION EQUIPMENT, modems) and these use straight RS-232 cables where TX and RX are are on the same pin on both ends.

Now you are going to love this. This is where grounding can be a problem in the site because RS-232 uses ground as a signal path, and if the EGC's are noisy, you can have problems. :D
 

gar

Senior Member
Location
Ann Arbor, Michigan
Occupation
EE
080402-0712 EST USA

iwire:

To avoid confusing I never refer to a termination as DTE or DCE. Rather I only think in terms of whether a signal is a transmitter or receiver (source or destination). Internally in the equipment is a UART (Univeral Asynchronous Receiver and Transmitter) and it will have pins labeled TxD (transmit) and RxD (receive). One always connects a transmitter to a receiver.

The signal definitions for DTE are what I use. That is TxD is transmit, and RxD is receive.

Many CNC machines are wired as DTE pinouts. HAAS and Fanuc in particular. Computers are also wired as DTE pinouts.

HAAS and Fanuc use a 25 pin Female chassis connector. Pin 2 is TxD, pin 3 is RxD, and pin 7 is signal common. Chassis common is pin 1 and would normally be connected to a cable shield. Pin 1 and 7 may be directly connected together in the CNC or computer, but in the case of HAAS there is a 100 ohm resistor between pin 7 and the internal common of the machine which is also machine chassis.

IBM compatible PCs with a 25 pin serial connector are classified as DTE and pin 2 is TxD and pin 3 is RxD, but the connector on the computer is male. To connect the 25 pin PC to the 25 pin CNC you cross over pins 2 and 3 so that PC TxD goes to CNC RxD and PC RxD comes from CNC TxD.

IBM with a 9 pin male chassis connector for serial communication is also classified as DTE and pin 2 is RxD, pin 3 is TxD, and pin 5 is signal common. There is no separate pin for chassis common. In virtually all non-isolated 9 pin connections pin 5 will go directly to the computer chassis. This also means to the equipment grounding wire in the AC power cable. Connection between HAAS or Fanuc and IBM 9 pin connector will have pin 2 to 2 and 3 to 3 and 7 on CNC to 5 on IBM.

With any modern CNC machine you must use some form of handshaking -- hardware (usually RTS- CTS is the primary handshake) (requires more than 3 wires), or software ( XON/XOFF, DC codes, Xmodem) (requires only 3 wires). Handshaking is used to modulate the flow of data from the source to destination. Primary need is for drip feeding (DNC) to a CNC machine.

With a voltmeter you can generally tell which pins on an RS232 connector are outputs.

Generally for a directly connected RS232 link cable length is approximately inversely proportional to baud rate.

I believe the bigest problem with directly connected RS232 ports is ground path noise because it is additive to the data signal.

For some more information see my web site www.beta-a2.com .

.
 
To muddy the waters, real RS-232 has TWO ground leads: pin 1 as 'protective ground' and pin 7 as 'signal ground'. Almost everyone ignores pin 1, but it's sometimes used for the cable shield, if any. (IIRC, real RS232 doesn't actually specify the connector, but pretty much everybody uses the common one.)

To further muddy the waters: of course, you must have one end's RX connected to the other end's TX, and they both need some sort of reference (SG). But, some devices need the various leads/jumpers to make them think that there's a device on the other end (DCD, DTR, DSR) and that it's ready to accept data (RTS/CTS). All the latter fall in the loose group called hardware flow control. In general, all of those are set up by reading the device's manuals, cursing the poor/wrong/missing documentation, looking at the signals with a breakout box, and playing around until things work. I've done this all far many too times :D.

And, now that the mud is all stirred up... There is no such thing as a DB9 connector, it's really a DE9. The first letter refers to the shape and the second letter refers to the size of the shell. For instance, a B size usually has 25 regular pins, but might have 13 regular pins and 3 coaxial pins (DB13W3), an A has space for 15 pins, and an E has space for 9 pins. (There're also C and D sizes.)
 
Last edited:

dbuckley

Senior Member
grich said:
One of the other guys I work with in town says his IT guys don't know anything about serial :confused: . I guess serial control is so yesterday that it's not taught in school anymore?

Probably very true.

Its an 'old skool' thing, and I'm old, so still have all the stuff used to troubleshoot it. Most of my gear is probably older than the younger members of this forum. The HP protocol analyser cost me a flippin' fortune, back in the day, yet theses tools are dumped on eBay now for at most a few hundred bucks.

Mind you, if you think RS232 is rare, try finding someone with X.25 skills these days. I had the chops, a decade or two ago, but it would be a long slow haul to get back up to speed these days. Yet still there is plenty of X.25 holding finance systems together...

RS232 over RJ45 is far more interesting, there are so many pinout variations on that theme...
 

grich

Senior Member
Location
MP89.5, Mason City Subdivision
Occupation
Broadcast Engineer
dbuckley said:
Mind you, if you think RS232 is rare, try finding someone with X.25 skills these days...

RS232 over RJ45 is far more interesting, there are so many pinout variations on that theme...

Been awhile since our place had any X.25 modems in service (might be one in the basement)...

99 percent of my RS232 is RJ45'ed onto CAT5e cables. Luckily most of my RS232 is 3-wire, so it's not too tough.
 

Rampage_Rick

Senior Member
grich said:
Been awhile since our place had any X.25 modems in service (might be one in the basement)...

99 percent of my RS232 is RJ45'ed onto CAT5e cables. Luckily most of my RS232 is 3-wire, so it's not too tough.
We had DataPac 3201 up until a couple years ago when I switched everything to IP. It's basically a bastardized version of X.25 offered by Bell Canada. In the years preceding the changeout, I did get pretty good at supporting it. I could tell the line status just by listening in. We ran poll codes 2D and 44 and I could tell which one wasn't transmitting based on the tone and timing of the blips. Receive would blip continuously at about 4Hz. I remember the DataPac line tech being some grizzled old fossil. If he retired they probably couldn't fix anything.

A lot of changeovers have occured in the past couple years. All the BC Lottery Corp terminals used to run over DataPac. Now they've all got ADSL to a private IP network. (The new ticket terminals are essentially diskless PCs that PXE boot from the BCLC servers over IP... quite ingenious and secure)

Right before I started this job, one of my last jobs as an independent subcontractor was to swap out leased-line CPE for all the Superstores in the Lower Mainland. They too switched over to private IP over ADSL for their in-house banking institutions (office & ATM)
 
dbuckley said:
The HP protocol analyser cost me a flippin' fortune, back in the day, yet theses tools are dumped on eBay now for at most a few hundred bucks.

Ya, I used to tromp about with an ARC comstate-1. Maybe I should get one off ebay.... I also did a little x.25, back in the '80s. The reference cards are still in the collection, but the mental list of tricks is long gone. I still end up doing lots of serial, esp for younger IT folks that don't really understand it.

dbuckley said:
RS232 over RJ45 is far more interesting, there are so many pinout variations on that theme...

Of course, you know that an RJ-45 is an 8-pin modular with T/R on pins 4/5 and a programming resistor on pins 7/8. :D (I certainly agree that there are so many interesting variations (cisco, annex, DEC, intermarriages of all of them, etc). Real RJ numbers don't have serial data on them, unless it's DDS, ISDN, or T-1 carrier. OTOH, I still call them RJ-45's in conversation.

z!
ever the pedant about these things
 

hbiss

EC, Westchester, New York NEC: 2014
Location
Hawthorne, New York NEC: 2014
Occupation
EC
figured it would be Hal that would scream I had no right to touch a data cable.

Rather have you do it than some IT "professional". By the way, isn't "IT professional" an oxymoron?

Don't get me started on those guys...

-Hal
 

iwire

Moderator
Staff member
Location
Massachusetts
Update

Well thanks for all the info, it was starting to make me wonder if I was going to be successful. :)

But so far I am 5 for 7. Five worked fine right away, they have not tried the other two yet. I have one more to do.

The CNC equipment was Matsuura, Makino, Haas, and Hardinge. But the same pin out and jumpers worked on all fine.

Don't hold me to it but from memory I did it like this.

Code:
 [U]9 pin[/U]         [U]25 pin[/U]

2 -------------2

3 -------------3

4 ------------- 6 & 8

5 ------------- 7

6 ------------- 20

 .............. 4 & 5 Jumped
 

gar

Senior Member
Location
Ann Arbor, Michigan
Occupation
EE
080404-1028 EST USA

iwire:

For HAAS or Fanuc the fact that you jumpered 4 and 5 at the CNC implies that software handshake is being used. In turn for HAAS and Fanuc you can jumper 6, 8, and 20 at the CNC, except in the case of HAAS 6, 8, and 20 are internally jumpered. Therefore, for HAAS pins 6, 8, 20 can be left open. In fact on HAAS pins 4 and 5 can be unconnected in XON/XOFF mode (software handshake). Fanuc requires the 4-5, and 6-8-20 to be jumpered.

In hardware handshake on Fanuc or HAAS 4 and 5 have to connect to the appropriate pins at the computer. 6-8-20 must be jumpered at the CNC for Fanuc.

What did you do with the cable shield if there was one? Note: shielding will do nothing for ground path generated noise. Electrostatic shielding only affects capacitively coupled noise.

Do you know the cable capacitance per foot? Belden 8723 is in the range of 60 to 70 pfd per foot, and CAT-5E is about 15 pfd/ft. With 8723 6 ft is a reasonable maximum cable length at 115.2 kbaud, thus CAT-5E might work at 25 feet. At 9600 baud maybe 75 ft, and 300 ft for the corresponding cables. However, longer cables probably mean more noise problems for various reasons.

What baud rates are being used, and the associated cable length?

When were the HAAS machines manufactured? In otherwords did they have brush or brushless servos. Between 96 and 98 the change occurred. The brushless servo machines produce much more electrical noise than the brush type machines. In some cases with the brushless servos on it is impossible to transfer any data in either direction at any baud rate with a directly connected RS232 communication path.

How are the machines and computers grounded?

Does a switch box connect one computer to many different machines? Or are their many RS232 ports on one or more computers? Does the customer drip feed programs?

.
 
Last edited:
Status
Not open for further replies.
Top