Tech Tuesday: What is RS-232 Communications

Posted March 15, 2022 11:39 am   Published by    BobCAD-CAM ">

RS-232 is a method of communication between two electronic devices using a serial data protocol and it defines the hardware required. Serial communication is a method of communication that can be completed with as few as 3 wires yet also supports more advanced features requiring more wires in the cable. Each wire in the cable used can communicate in only a single direction.

An example of the simplest connection can be seen below:

RS-232 Simplest Connection
In the above image you can see we have pin 2 on the left connected to pin 2 on the right. The left pin 2 is the RD (Receive Data) pin on the PC side of the connection. Pin 2 on the right is the TX (Transmit Data) pin on the controller side. We can also see that pin 3 on the left is connected to pin 3 on the right. On the left pin 3 is the TX (Transmit Data) pin and pin 3 on the right is the RD (Receive Data) pin. So the TX is connected to RD with this wiring. Pin 5 (left) and pin 7 (right) in this example are the SG (Signal Ground).

Ok, so now we have seen the simplest connection but what are the settings that make this communication work?

The common settings you will see in RS-232 communication software is shown below:

RS-232 Common Connection

Overview of the Process

Using the selected COM port the system generates the transmission using the TX pin. The first transmission is a bit called the Start Bit. This start bit indicates to the receiver that the transmission of data is beginning and will follow. After this start bit comes the Data Bits. The Data Bits contain the actual data of the transmission. Next is the parity bit and finally the Stop Bit which indicates the end of the transmission for that chunk of data. Below is a brief overview of these specific parameters.

Parameters:

Port: This is usually found on the PC end but sometimes even a CNC controller will have options to select which COM port to use for the RS-232 communication. You simply need to ensure you select the port that exists on each device or errors will result and communication will fail.
Baud Rate: The baud rate is the speed the communication will take place.  The design of the RS-232 communication protocol does not provide for a signal to automatically synchronize the speed the data is transmitted; each device must be set to the same communication speed (Baud Rate) so the data can be successfully transmitted and received.

This speed is defined in Bits Per Second. So, an example would be 9600 baud. This means 9600 Bits Per Second. In a computer it takes 8 bits to represent a single character so RS-232 communication set at 9600 baud could transmit a maximum of 1200 characters per second. But there are other pieces of information that must also be transmitted so the actual number will be lower.

Parity: Parity is a method of detecting errors in the communication. It is an extra Bit of information that is included in the sent data. The options are Odd, Even and None. Though you can use the None option for any cable length greater than 6 feet it is recommended that you DO use a parity option. Both devices must have the parity option matching for proper communication.
Stop Bits: The stop bit defines a period of time before the next set of data will be transmitted. Tuning of the stop bit can aid in communication over long distances or at very high baud rates to allow the hardware to send and receive data with possibly less data corruption.

What is Handshaking?

Handshaking is used to allow the two devices to communicate in such a way so that the buffer on the receiving end does not get overwhelmed and communication can be “paused” to allow the receiving end clear some of the buffer before communication continues.

  • Hardware Handshaking uses physical pin connections in the cable that must be connected to work. This is a more reliable handshaking method however it is used less often due to the extra wiring required. The signals and their meaning are:
    • TR – Data Terminal Ready
    • DSR – Data Set Ready
    • RTS – Request To Send
    • CTS – Clear To Send
  • Software Handshaking is a method of flow control where special characters are inserted into the data stream to indicate for the sending unit to pause sending while the buffer empties on the receiving end. Once the buffer is ready for more data a resume character is then sent to signal to resume sending data. The characters used are commonly referred to as XOn and XOff.

The following is example RS-232 cable wiring between PC and CNC Controller to support software handshaking.

RS-232 Db9 to DB25
RS-232 DB25 to DB25
RS-232 DB25 to DB9
RS-232 DB9 to DB9

 

Using RS-232 communications with a Gen 1 HAAS? Click here for additional information.

Download a free demo version of BobCAD-CAM today!

Here are a few resources to use for all things BobCAD-CAM:
Our support site allows you to submit a ticket to technical support online:
www.bobcadsupport.com Our user forum is a community of other BobCAD-CAM users to share ideas and projects in BobCAD-CAM:
forum.bobcad.com

BobCAD-CAM has provided CAD-CAM CNC Software products to the global manufacturing industry for over 30 years. BobCAD-CAM software can be found to increase CNC productivity for many applications in aerospace, automotive, production manufacturing, mold making, general machining, woodworking as well as the medical manufacturing industry, consumer products, musical instruments, custom fabrication, defense industry and many others due to the products ability to automatically generate NC programming code for such a wide variety of CNC controllers. BobCAD-CAM software is also found in educational institutions throughout the world as well as independent hobby home use. Products include machining technology for 2, 3, 4 & 5 Axis CNC Milling, Routing, Waterjet, Plasma and Laser machines as well as 2 Axis CNC Lathe. BobCAD-CAM is modular allowing shops to start off at a reduced technology level and add technology as it is needed including an add-on, BobART, for artistic machining. Unique technology includes adaptive high-speed machining multiaxis milling and routing which is a first in the world of CAD-CAM software. BobCAD-CAM also provides a variety of quality training products that include regional and online training classes or private sessions tailored to specific applications. Professional certification and multi-tiered support solutions are available. Contact BobCAD-CAM directly for more information at 877-262-2231 or 727-442-3554

New Feature Spotlight – Tell us the topics that are most important to you Click Here 

Leave a Reply

Your email address will not be published.