Many PLC Devices support Asynchronous Serial Communications, where data is sent 1 bit at a time.
The structure of data sent serially is:
Start Bit | 5 - 8 Data bits | Optional Parity bit | 1 - 2 Stop Bits |
Within this structure there are a number parameters:
To successfully connect two devices using serial communications, both devices must use the same set of parameters.
The Baud Rate is the speed at which data bits are sent. Common values for the Baud Rate used in PLC Devices include: 1200, 9600, 19200, 38400.
The Data Bits is the number of bits of data in each frame. Common values used by PLC Devices include 7 or 8 data bits. All binary protocols use 8 data bits. ASCII data can be sent using 7 or 8 bits, for example Modbus ASCII.
The Parity bit can provide a simple form of error detection:
Parity | Description |
---|---|
None | No parity bit is added to the data. |
Even | The parity bit is set to space (0) if the total number of data bits in the mark (1) state is even. |
Odd | The parity bit is set to space (0) if the total number of data bits in the mark (1) state is odd. |
Mark | The parity bit is set to mark (1). |
Space | The 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.
The Stop Bits is the number of bits used to mark the end of a frame. Common values used by PLC Devices are 1 or 2 stop bits.
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:
Standard | Mode | Mark | Space |
---|---|---|---|
RS-232 | Single Ended | -3v to -15v | +3v to +15v |
RS-422 | Differential | 0v to -6v | 0v to +6v |
RS-485 | Differential | -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 15 metres. Differential mode can work up to 1500 metres.
Very few computers have a built-in serial RS-422/RS-485 port. Common ways of providing an RS-422/RS-482 serial ports include:
For information on how to use RS-422/RS-485 adapters see the following guides:
To learn about configuring serial port mode strings in Fernhill SCADA.
To learn about the editor that can edit serial port mode strings.