Home » Serial Communication Interview Questions and Answers
Communication Interview Questions

Serial Communication Interview Questions and Answers

We prepared a list of Serial Communication Interview Questions for your interview preparation. Go ahead with this article and get your basics back. Hope you will love this article. share your comments.

Serial Communication Interview Questions

Serial Communication Interview Questions

Control System Engineer Interview Questions

What is Serial communication?

The concept of serial communication is simple. The serial port sends and receives bytes of information one bit at a time. This is slower than parallel communication, which allows the transmission of an entire byte at once; however, it is simpler and can be used over longer distances.

For example, the IEEE 488 specifications for parallel communication state that the cabling between equipment can be no more than 20 meters total, with no more than 2 meters between any two devices; serial can extend as much as 1200 meters.

Typically, serial is used to transmit ASCII data. Communication is completed using 3 transmission lines:

  1. Ground,
  2. Transmit, and
  3. Receive.

Since serial is asynchronous, the port is able to transmit data on one line while receiving data on another. This is referred to as Full-Duplex transmission.

Other lines are available for handshaking, but are not required. The important serial characteristics are baud rate, data bits, stop bits, and parity. For two ports to communicate, these parameters must match:

Baud rate

Baud rate is a speed measurement for communication. It indicates the number of bit transfers per second.

For example, 300 baud is 300 bits per second. When we refer to a clock cycle, in the context of serial, we mean the baud rate.

For example, if the protocol calls for a 4800 baud rate, then the clock is running at 4800Hz.

This means that the serial port is sampling the data line at 4800Hz.

Common baud rates for telephone lines are 14400, 28800, and 33600.

Baud rates greater than these are possible, but these rates reduce the distance by which devices can be separated. These high baud rates are used for device communication where the devices are located near one another.

Data bits

Data bits are a measurement of the actual data bits in a transmission.

When the computer sends a packet of information, the amount of actual data may not be a full 8 bits.

Standard values for the data packets are 5, 7, and 8 bits. Which setting you choose depends on what information you are transferring.

For example, standard ASCII has values from 0 to 127 (7 bits). Extended ASCII uses 0 to 255 (8 bits).

If the data being transferred is simple text (standard ASCII), then sending 7 bits of data per packet is sufficient for communication.

A packet refers to a single byte transfer, including start/stop bits, data bits, and parity. Since the number of actual bits depend on the protocol selected, the term packet is used to cover all instances.

Stop bits

Stop bits are used to signal the end of communication for a single packet.

Typical values are 1, 1.5, and 2 bits. Since the data is clocked across the lines and each device has its own clock, it is possible for the two devices to become slightly out of sync.

Therefore, the stop bits not only indicate the end of transmission but also give the computers some room for error in the clock speeds.

The more bits that are used for stop bits, the greater the lenience in synchronizing the different clocks, but the slower the data transmission rate.

Parity

Parity is a simple form of error checking that is used in serial communication.

There are four types of parity: even, odd, marked, and spaced.

The option of using no parity is also available.

For even and odd parity, the serial port will set the parity bit (the last bit after the data bits) to a value to ensure that the transmission has an even or odd number of logic high bits.

For example, if the data was 011, then for even parity, the parity bit would be 0 to keep the number of logic high bits even.

If the parity was odd, then the parity bit would be 1, resulting in 3 logic high bits.

Marked and spaced parity does not actually check the data bits, but simply sets the parity bit high for marked parity or low for spaced parity.

This allows the receiving device to know the state of a bit which enables the device to determine if noise is corrupting the data or if the transmitting and receiving devices’ clocks are out of sync.

What is RS-232?

RS-232 (ANSI/EIA-232 Standard) is the serial connection historically found on IBM-compatible PCs.

It is used for many purposes, such as connecting a mouse, printer, or modem, as well as industrial instrumentation.

Because of improvements in line drivers and cables, applications often increase the performance of RS-232 beyond the distance and speed listed in the standard.

RS-232 is limited to point-to-point connections between PC serial ports and devices. RS-232 hardware can be used for serial communication up to distances of 50 feet.

RS 232 Pin Functions

What is RS-422?

RS-422 (EIA RS-422-A Standard) is the serial connection historically used on Apple Macintosh computers.

RS-422 uses a differential electrical signal, as opposed to unbalanced signals referenced to ground with the RS-232.

Differential transmission uses two lines each for transmit and receive signals which results in greater noise immunity and longer distances as compared to the RS-232.

These advantages make RS-422 a better fit for industrial applications.

What is RS-485?

RS-485 (EIA-485 Standard) is an improvement over RS-422, because it increases the number of devices from 10 to 32 and defines the electrical characteristics necessary to ensure adequate signal voltages under maximum load.

With this enhanced multi-drop capability, you can create networks of devices connected to a single RS-485 serial port.

The noise immunity and multi-drop capability make RS-485 the serial connection of choice in industrial applications requiring many distributed devices networked to a PC or other controller for data collection, HMI, or other operations.

RS-485 is a superset of RS-422; thus, all RS-422 devices may be controlled by RS-485. RS-485 hardware may be used for serial communication with up to 4000 feet of cable.

Pin Functions for RS-485 and RS-422

Also Read: HART Communication Interview Questions & Answers

How do RS-232, RS-422, and RS-485 Compare?

RS-232 is the most common serial interface and used to ship as a standard component on most Windows-compatible desktop computers.

Now it is more common to use RS-232 over USB using a converter. RS-232 only allows for one transmitter and one receiver on each line.

RS-232 also uses a Full-Duplex transmission method. Some RS-232 boards sold by National Instruments support baud rates up to 1 Mbit/s, but most devices are limited to 115.2 kbits/s.

RS-422 (EIA RS-422-A Standard) is the serial connection used on legacy Apple computers.

It provides a mechanism for transmitting data up to 10 Mbits/s. RS-422 sends each signal using two wires to increase the maximum baud rate and cable length.

RS-422 is also specified for multi-drop applications where only one transmitter is connected to, and transmits on, a bus of up to 10 receivers.

RS-485 is a superset of RS-422 and expands on the capabilities. RS-485 was made to address the multi-drop limitation of RS-422, allowing up to 32 devices to communicate through the same data line.

Any of the slave devices on a RS-485 bus can communicate with any other 32 slave devices without going through a master device. Since RS-422 is a subset of RS-485, all RS-422 devices may be controlled by RS-485.

Both RS-485 and RS-422 have multi-drop capability, but RS-485 allows up to 32 devices and RS-422 has a limit of 10.

For both communication protocols, you should provide your own termination. All National Instruments RS-485 boards will work with RS-422 standards.

The following table compares mode of operation, total number of drivers and receivers, maximum cable length, and maximum data rate.

Specifications of RS-232, RS-422, and RS-485

What is Handshaking?

The method used by RS-232 for communication allows for a simple connection of three lines: TX, RX, and ground.
For the data to be transmitted, both sides have to be clocking the data at the same baud rate.

Although, this method is sufficient for most applications, it is limited in being able to respond to problems such as the receiver getting overloaded. This is where serial handshaking can help.

In this section we will discuss three of the most popular forms of handshaking with RS-232: Software Handshaking, Hardware Handshaking, and Xmodem.

Software Handshaking:

The first form of handshaking we will discuss is software handshaking. This style uses actual data bytes as control characters, similar to the way GPIB uses command strings.

The lines necessary are still the simple three line set of TX, RX, and round since the control characters are sent over the transmission line like regular data. The function SetXMode allows the user to enable or disable the use of two control characters, XON and XOFF.

These characters are sent by the receiver of the data to pause the transmitter during communication.As an example, assume that the transmitter begins to transmit data at a high baud rate.

During the transmission, the receiver finds that the input buffer is becoming full due to the CPU being busy with other duties. To temporarily pause the transmission, the receiver sends XOFF, typically decimal 19 or hex 13, until the input buffer has been emptied.

Once the receiver is ready for more data it sends XON, typically decimal 17 or hex 11, to resume communication. LabWindows will send XOFF when its input buffer becomes half full.

In addition, in case the XOFF transmission was corrupted, LabWindows will also transmit XOFF when the buffer has reached 75% and 90% capacity.

Obviously, the transmitter must also be following this protocol for it to succeed.The biggest drawback to this method is also the most important fact to keep in mind: decimal 17 and 19 are now off limits for data values.

In ASCII transmissions this typically does not matter since these values are non-character values; however, if the data is being transmitted via binary, it is very likely that these values could be transmitted as data and the transmission would fail.

Hardware Handshaking:

The second method of handshaking is to use actual hardware lines. Like the TX and RX lines, the RTS/CTS and DTR/DSR lines work together with one being the output and the other the input.

The first set of lines are RTS (Request to Send) and CTS (Clear to Send). When a receiver is ready for data, it will assert the RTS line indicating it is ready to receive data.

This is then read by the sender at the CTS input, indicating it is clear to send the data. The next set of lines are DTR (Data Terminal Ready) and DSR (Data Set Ready).

These lines are used mainly for modem communication. They allow the serial port and the modem to communicate their status.

For example, when the modem is ready for data to be sent from the PC, it will assert the DTR line indicating that a connection has been made across the phone line. This is read in through the DSR line and the PC can begin to send data.

The general rule of thumb is that the DTR/DSR lines are used to indicate that the system is ready for communication where the RTS/CTS lines are used for individual packets of data.

USB Communication

USB handles communication between a single host – a computer in most cases – and a variety of nodes (peripherals with particular functions), and hubs (which repeat the USB signaling to allow more nodes to be connected to the host).

You can add more USB devices by adding a hub to an available port. You can connect up to 127 devices, with no more than five hubs between any given node and the host.

When you plug a USB device into an active host, the host immediately queries the device for its characteristics.

Based on those characteristics, the host USB driver loads device-specific drivers to control the device.

Those drivers complete the initialization process and set up any pipes, or communication channels, that applications may need to use.

A device can have multiple interfaces so that different applications can communicate with it in different ways. The device connects to the host pipes through endpoints, which are unidirectional ports for data transfer.

Each endpoint has certain characteristics that define its functionality. USB does not have a standard for communication as RS232/485 does.

USB versus RS232/485 Speed

With the older USB 1.1 specification, throughput reaches a maximum of 1.5 Mbytes/s.

The current generation of USB products incorporates the USB 2.0 specification which further increases the bus throughput up to 60 Mbytes/s.

The speed of serial communication is determined by the baud rate (related to bits per second or b/s). Typically, the fastest possible baud rate is 115.2 kbytes/s, but with the correct hardware speeds, up to 1 Mbytes/s is possible.

USB – Plug-and-Play Compatible

Because the USB is a plug-and-play technology, the USB host automatically detects when a new device has been added, queries the device for its identification, and configures the device drivers appropriately.

Thus USB devices are “hot swappable,” which means you can plug in or disconnect the device without the having to power down.

Devices that are connected to an RS232/485 port are not plug-and-play compatible; they are configured manually every time you connect them to a PC.

RS232 vs RS485 CommunicationRS232 vs RS485 Communication

Explain briefly about Different Serial Communication Protocols ?

RS485 (2-wire, half-duplex, differential, multi-drop (32 nodes), communications standard for distances up to 4000ft.)

The RS485 standard addresses the problem of data transmission, where a balanced (differential) transmission line is used in a multi-drop (party line) configuration (or point-to-point if only two devices are on the network). Up to 32-nodes (drivers and receivers) are allowed on one multi-drop, bi-directional network.

Data rates of up to 10M bps are supported over short distances (40ft.). At the four-thousand foot distance limit, data rates of up to 100K bps are allowable.

RS485 specifies a 2-wire, half-duplex communications bus. Because there are differences between RS485 and RS422(minor in many instances, except for loading [12K vs. 4K) many people refere to 4-wire RS485.

While RS485 is a 2-wire standard, it does offer 32 nodes on a network, on the other hand RS422 (a 4-wire standard) only specifies up to 10 nodes.

Therefore, while not technically correct, it does make some sence to refer to a 4-wire RS485 network that would extend the number of nodes on a 4-wire network to 32 standard loads.

The RS485 standard only specifies electrical characteristics of the driver and the receiver, it does not specify or recommend any protocol.

Because matters of protocol are left to the user, it is often difficult (if not impossible) to connect RS485 devices from different manufacturers on the same network.

The RS485 standard allows the user to configure inexpensive local networks and multidrop communications links using twisted pair wire.

A typical RS485 network can operate properly in the presence of reasonable ground differential voltages, withstand driver contentious situations, provide reliable communications in electrically noisy environments (good common mode rejection using twisted pair cable, shielding provides additional protection), and support thirty-two or more (many IC manufacturers have 1/2, 1/4, 1/8 unit load devices) drivers and receivers on the line.

The Twisted pair wire with a characteristic impedance of 120 ohms is recommended with 120 ohm termination at each end of the communications line. The common-mode voltage range is -7V to +12V.

A driver in the high impedance (off) state is able to remain in this state over the common mode range, whether power is applied or not. The receiver is able to respond to differential signal levels of 200mV over the common mode range.

The receiver load impedance is 12K ohms (or higher) and transmitter “leakage” current is ±100µA (or less) in either the powered or un-powered state.

Unloaded driver output differential voltage can be as high as ±6V. Loaded driver voltage (32 nodes on the network and termination) should typically exceed ±1.5V.

RS422 (4-wire, full-duplex, differential, multi-drop (10 nodes), communications standard)

While RS422 is comparable to RS485, it is limited to unidirectional data traffic, and is terminated only on the end of the line opposite the transmitter.

One transmitter and 10 receivers are allowed on a network, with a distance limit of 3600ft.

RS422 was on the market prior to RS485; however, due to loading limitations, one of the best uses of RS422 is probably in point-to-point communications, such as RS232 extension cords.

By converting from single-ended RS232 to differential RS422 and then, converting back from RS422 to RS232 at the other end of the line, distance and noise immunity can be greatly improved.

RS232 (3-wire, full-duplex, single-ended, 50ft cable limit)

RS232 was developed in the 1960s, and among other things, specified an electrical standard, a protocol standard, handshaking, and connector pin-out.

In general, many current applications for RS232 use only the electrical standard (3-wires, TDX, RXD, Common) and connector pin-out.

While handshaking is still with us, it is usually best to disable it in software (if possible) and/or “loop-back” the pairs of signals (RTS to CTS, DTR to DSR, etc.)

While RS232 was rumored to be on the “way out” with the advent of many of the new communications standards, it is still alive and well today.

The standard only supports low data rates and short line length (50ft.) it is still widely used and, very useful in many applications.

With an external converters (RS232<=>RS485) many of the limitations of RS232 can be improved, to take advantage of, the superior properties of differential communications (2-wire or 4-wire).

Converters (RS232<=>RS485, RS232<=>RS422, RS485<=>RS422)

The Converters in general can be used to change the electrical characteristics of one communications standard into another, to take advantage of the best properties of the alternate standard selected.

For example, an Automatic RS232<=>RS485 converter, could be connected to a computer’s RS232, full-duplex port, and transform it into an RS485 half-duplex, multi-drop network at distances up to 4000ft. Converters in most instances, pass data through the interface without changing the timing and/or protocol.

While the conversion is “transparent” the software must be able to communicate with the expanded network features. An “Automatic Converter” (RS232<=>RS485) will turn on the RS485 transmitter when data is detected on the RS232 port, and revert back into the receive mode after a character has been sent. This avoids timing problems (and software changes) that are difficult to deal with in typical systems.

When the full-duplex is converted into half-duplex only one device at a time can transmit data. Automatic Converters take care of the timing problems and allow fast communications without software intervention.

Articles You May Like :

Similar Articles:

Related Articles

Conductivity Analyzers Interview Questions & Answers

S Bharadwaj Reddy

Top 100 Control Systems Objective Questions & Answers

S Bharadwaj Reddy

Foundation Fieldbus Tutorials

S Bharadwaj Reddy

SCADA Interview Questions and Answers

S Bharadwaj Reddy

Fiber Optic Sensors

S Bharadwaj Reddy

4 comments

Himanshu September 24, 2016 at 8:10 am

sir you are doing really a great work…..Highly appreciated.

Reply
Sudheer November 10, 2016 at 6:23 am

Wonderful job!!!
You have summarized Serial Communication covering all the important aspects.
But, I cannot either save/print/copy this page. I can’t even save the link for future reference.

Reply
Rehan Khurshid December 5, 2016 at 11:25 am

You have wrote very concise and to the point on serial communication but i can take a print of that document. if i use browser print option, it print in small fonts and adds in the side.
please mail me that document
Regards

Reply
S Bharadwaj Reddy December 6, 2016 at 3:38 am

Forwarded to your mail. Thanks.

Reply

Leave a Comment

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More

WordPress Image Lightbox