RS-232 garbage due to pinout?

matt.hoy

Member
Join Date
Aug 2009
Location
Indianapolis, IN
Posts
10
I am trying to make a Symbol LS4208 BC scanner talk to a Micrologix 1500 LSP through the Ch0 port via ASCII protocol. I have verified the output of the scanner using hyperterminal. I have successfully fed ASCII into the PLC with hyperterminal, but every time I connect the scanner to the PLC, I get garbage data (sometimes nothing). Also, I can scan the same barcode three times, and get three different piles of garbage. I had assumed that because I am getting *something* that the pinout had to be correct. I have been down every other road I can think of. Baud rate, parity, stop bits, # of data bits, CR appending, etc.

Is it possible that I got some of the pinout criss-crossed and that is causing this? The only reason I am even contemplating this is because if each unit works as expected by itself, the only change is the wiring when they are plugged in. I am also a little fuzzy on the whole RX TX CTS RTS stuff. I can't remember if they connect to the same one or do you connect the RX of one to the TX of the other?

HELP!

File attached.
 
Try this:
- First ACB to read numbers of characters in buffer, - Check when number of characters in buffer is greater than X then instruction ARD, now in the string you have what was read by the scanner, move it from there and wait for next item.
 
This sounds typical of a link where the two ends don't match, sometimes the written description doesn't match reality.
Slow the baud rate down e.g 1200 until you get it to work properly.
Are you sure you have a good ground connection between the two devices, noise on the ground will give you odd characters.
Connect your Hyperterminal PC into the cable as well then compare the results.
If your connection is RS-422 or 485 connect the PCs RS-232 Rx Data to the Tx- (negative) and ground
Roy
 
Last edited:
Pinout diagrams

Thanks for the tips so far.

I went back and looked at the pinout, and I think I had it jacked up.
Attached is a pdf of the AB pinout for the mini-DIN that I am using on the PLC. I don't have the actual cable shown, so I have a pigtail with the DIN on one end. I have the various wires connected to a DB9 breakout board that I am plugging the barcode reader into. The second page of the file is the barcode reader pinout. I have added numbers to each page to show what wire is connected to what pin on the other page.

I think I have everything matched up except the mini-DIN wants its pin 3 to be connected to a DTS signal. The BCR doesn't have a DTS signal. The BCR doesn't have its RTS signal attached to anything. The AB diagram shows the RTS tied to GND, but I am not sure that will make the BCR happy.

Anybody got a guess on what I should do with these connections?
 
In RS232 the 3 wires you need to worry about are Tx Rx and Grd. RTs and CTS should not even be needed. Those 2 are for Hardware control and you have that turned off in your PLC.


If I was wiring this up below is what I would try first:

PLC Din Scanner
2 GND 3 GND
7 TXD 5 RxD
4 RXD 4 TXD

Notice I only used 3 wires. TXD= transmit RXD= recieve GND= Ground

I would make sure Hardware control is turned off. Then make sure both sides have there bits and buads set right. If this doesn't work then swap TXD and RXD on one side.

To check with a PC GND goes to pin 5 on the PC side TXD goes to Pin 2 and RXD goes to pin 3. You should be able to check bothg sides now. If you have a null modem you should need it on one side. Either the PLC side or the scanner side will have to flip to get things to work with the PC.

As far as data integrity that is usually a noise issue. One trick I like to use is look for a leading character and make it a condition of my read function. This way I start in the same place in the string everytime. Another trick is to do a character number compare. If what you read is a different length than it should be, then what just came in on the port is obviously garbage so then you clear the que and read again.


I do not care what anybody tells you. Serial Comm's is a black art, every setup seems to have its on set of quirks. There alaways seems to be some garbage the PLC picks up.

Most important thing to remember, Hyperterminal is alot more forgiving than a PLC. It will ignore a lot of garbage and only show you what data it understands. A PLC takes it just the way it is, warts and all and processes it.

Hope this helps. Main thing required with Serial comms....patience...lots of patience.....in my case lots of these:beer:🍺🍺🍺🍺🍺
 
Ground I do not care what anybody tells you. Serial Comm's is a black art said:
I couldn't agree more with Clay B
You can easily find which pin is Tx, it's the one with voltage on it Rx is at ground potential. Once you figure that out connect Tx at one device to Rx at the other
 
Thanks all

I just wanted to post an update to all of this. I followed the advice of Roy and Clay. I still wasn't having much success. Eventually I had two revelations.
1. The diagram from the AB documentation was hosed up. It had two column of pinouts with arrows showing the connections. They never made much sense to me. I finally figured out that the arrows were shifted down relative to both pinouts! After that adjustment, TX was connected to RX and things seemed to make more sense.

2. I realized that what I was trying to duplicate with my breakout board was to convert a DB9 to a round mini-DIN. That is exactly what my PROGRAMMING CABLE DOES!!! I quickly took a DMM to my cable and copied that into my breakout board wiring. It worked as predicted.

I think I had probably mis-mapped some of the pins on the DIN is why the advice I received didn't work.

I am now firmly mired up to my eyeballs in the programming side. I am slightly stuck there, but I suppose that warrants a new thread.

You guys on this forum are lifesavers!
Here's to you! 🍺
 
DB9SignalDB9Signal
2RD 3TD
3TD 2RD4
6,1DSR, DCD to 4 DTR
4 dtr to 6,1 DSR,DCD
RTS8 CTS7
CTS7 RTS8
SGND 5 SGND 5
9RI 9RI
FYI this is a typical full duplex connection (with hardware handshaking)
however full-duplex is seldom used very seldom so the two most common
configurations in rs-232 half-duplex

is rx to tx 2 to 3
tx to rx 3-2
ground to ground 5-5
in a null modem its rx to rx tx-tx ground to ground

You'll notice in full duplex cts goes to rts and vice versa
dsr to dtr and vice versa alot of configurations yu see typically send dtr to DSR in the same db9 and same with RTS to DTS this is actually a better configuration than the standard half duplex configuration as it prevents those signals from free floating another common trick is to tie those signals to ground for the same reason when they are looped back in the same cable it is still a half- duplex mode. Full duplex is only achieved when you send the handshaking from one comport to the other.
 
Last edited:

Similar Topics

Hello, I am trying to communicate with a resistance tester that will allow me to read the current resistance being tested via RS232. In order to...
Replies
16
Views
12,755
I have a piece of equipment that is operated by a PanelView Plus 600 HMI touch screen via RS232 into a Micrologix 1500 PLC. I am trying to...
Replies
5
Views
152
i have an device which can support serial (RS485,RS232),CAN protocol . i want to connect it to an existing MIB 1553B bus ,what device will I need...
Replies
0
Views
105
Hello: I have to connect a RS232 Modbus RTU slave that only has Tx, Rx and GND signals to a Modbus RTU master. However, all RS232 to RS485...
Replies
3
Views
250
Hi to everybody. I need to read the first 12 characters of the message that a barcode reader sends to the ascii card (1734-rs232 ascii) and I...
Replies
8
Views
741
Back
Top Bottom