Serial Communications

Help Contents

Introduction

Many PLCs support Asynchronous Serial Communications, where data bytes are transmitted 1 bit at a time. The structure of a data byte sent serially is typically:

Start Bit5 - 8 Data bitsOptional Parity bit1 - 2 Stop Bits

Within this structure there is considerable flexibility in the serial communication parameters:

Individual bits are represented by electrical signals. There are a number of standards which define the electrical signals that represent a mark (1) bit or a space (0) bit:

StandardModeMarkSpace
RS-232Single Ended-3v to -15v+3v to +15v
RS-422Differential0v to -6v0v to +6v
RS-423Single Ended-4v to -6v+4v to +6v
RS-485Differential-0.2v to -6v+0.2v to +6v

Single Ended mode uses a single wire where the voltage is measured with respect to ground. Differential mode uses a pair of wires where the voltage is the difference between the two wires. Single Ended mode can be used over short runs of up to 10 metres. Differential mode can work up to 1500 metres.

To successfully connect two devices using serial communications, both ends must use the same Serial Communication Parameters and Electrical Signalling.

Parity

The Parity bit can provide a simple form of error detection. Typical options for parity bits include:

ParityDescription
NoneNo parity bit is added to the data.
EvenThe parity bit is set to space (0) if the total number of data bits in the mark (1) state is even.
OddThe parity bit is set to space (0) if the total number of data bits in the mark (1) state is odd.
MarkThe parity bit is set to mark (1).
SpaceThe parity bit is set to space (0).

Note: Only Even and Odd parity provide a level of error detection.

When a data byte includes Even or Odd parity, the receiver can detect single bit errors. The receiver calculates the expected parity bit for the received data. If the received parity bit does not match the expected parity bit, one or more bits have been corrupted. If a bit error is detected, the receiver can ignore the corrupted data byte.

Further Information

Serial Port Mode String

To learn about configuring serial port mode strings in Fernhill SCADA.

Serial Port Mode Editor

To learn about the editor that can edit serial port mode strings.