ASCII to Something

ASCII-to-Something
I get a number of questions every week about moving ASCII data. Moving ASCII data in and out of PLCs. Moving it across protocols; everything from J1939 to Modbus, EtherNet/IP and Profinet IO.

There is no trick to it. You just have to understand a few basics to get it done right. Here is a primer on moving ASCII to EtherNet/IP, ASCII to Profinet IO, ASCII to Modbus and all the rest:

1.       Electrical Issues – First, get your wiring right. Look at how your data is coming in (or going out). Is it RS232 or is it RS485? RS232 is point to point and is usually 12 VDC. There’s a Transmit Pin, a Receive Pin and a Ground. RS485 is Multidrop. It’s differential. 5 Volts. Only two wires are needed. Since, you are moving ASCII data and there is no way to arbitrate messages, you will only want to have one device on the link. Two ASCII devices transmitting at the same time means nothing comes through.

2.       Termination – Once you are wired let’s understand how the receiver is going to find the end of the message. Is it fixed length? Is it terminated by a Carriage Return, Line Feed or even a “?” or “$”? In fact, you need to understand how that works in both directions.

3.       Byte Ordering – Most PLCs are going to store your ASCII data in PLC locations that are 16 bits or 2 bytes long. That means that two of your ASCII characters are stored in each PLC location. When the PLC moves that data to an HMI or database or someplace else, the byte order might be wrong. “123456” can come out as “214365”.

If you are going to use one of our ASCII gateways that move ASCII gateways over networks to networked devices like a Siemens PLC (Profibus or Profinet IO) or Rockwell PLC (EtherNet/IP or DeviceNet) or something else, maybe using Modbus, there are other considerations.

For example, if a PLC is sending labels to a printer over an Ethernet link, how does the gateway know that the PLC has a new label to print? It might want to print the same label a second time.

The same applies in the reverse direction. If your system allows duplicate barcodes, how does the gateway tell the PLC that this is new ASCII data?

Remember that in all these networks (EtherNet/IP, Profinet IO, DeviceNet and everything else), data is flowing constantly. A PLC that writes a label to a printer out as I/O data is going to send that same label every 10msec. A gateway device that is sending a barcode to a PLC as I/O data is going to send that barcode to the PLC every 10 or 20msec. There has to be some way to recognize new data.

RTA has implemented a simple handshaking protocol for sending and receiving ASCII data over EtherNet/IP, Profinet IO, DeviceNet, Profibus and Modbus networks. Using a control bit, status bit and sequence number, each side of the network can know exactly if it is looking at new data or data that it has already processed. Since our communications manuals and our applications notes for exact instructions on using the handshaking protocol.

Moving ASCII data between serial devices and networked devices is not difficult. There is just a bit more complexity that you have to manage.

Good Luck,

John

Attn: Our office is closed Monday, 5/27/24 in observance of Memorial Day. Orders placed after 2 pm CST 5/24/24 will be processed 5/28/24.