RS-232 Tutorial - RS232 Basics

RS232 tutorial, RS232 basics - Serial adapters, Serial converters, RS232 Analyzer, RS232 to RS485, RS232 to RS422, RS232 to TTL, USB to RS232, USB to serial adapters, Serial Analyzer, RS232 repeater, RS232 extender, RS232 isolator

 Home | Downloads | Purchase | Buy in Bulk | Login | Contact Us | Distributors

rs232 serial analyzer    
 

RS232/RS485/RS422/TTL ANALYZER

  - Control serial devices from PC
  - Monitor communications between serial devices
  - Advanced Protocol Checksum Calculator
  - Timestamps in milliseconds
  - Windows 98/2000/XP/Vista compatible
     
         
  Products  

RS232 TUTORIAL / RS232 BASICS

     
 

Standard Serial Converters

 
 

Isolated Serial Converters

 
 

Serial Repeaters

 
 

Fiber Optic Converters

 
 

USB Serial Adapters

 
 

RS232 Monitor Cables

 
 

RS232 Serial Analyzer

 
 
 

All CommFront's hardware products come with a 3-year  warranty.


Worldwide Shipping with Tracking:
USPS Priority / Registered Article.

3 easy steps to understand and control your RS232 devices
   

Step 2: Learn about the Protocol

A protocol is one or a few sets of hardware and software rules agreed to by all communication parties for exchanging data correctly and efficiently.

Synchronous and Asynchronous Communications

Synchronous Communication requires the sender and receiver to share the same clock. The sender provides a timing signal to the receiver so that the receiver knows when to "read" the data. Synchronous Communication  generally has higher data rates and greater error-checking capability. A printer is a form of Synchronous Communication.

Asynchronous Communication has no timing signal or clock. Instead, it inserts Start/Stop bits into each byte of data to "synchronize" the communication. As it uses less wires for communication (no clock signals), Asynchronous Communication is simpler and more cost-effective. RS-232/RS-485/RS-422/TTL are the forms of Asynchronous Communications.

Drilling Down: Bits and Bytes

Internal computer communications consists of digital electronics, represented by only two conditions: ON or OFF. We represent these with two numbers: 0 and 1, which in the binary system is termed a Bit.

A Byte consists of 8 bits, which represents decimal number 0 to 255, or Hexadecimal number 0 to FF. As described above, a byte is the basic unit of Asynchronous communications.

Baud rate, Data bits, Parity, and Stop bit


                    RS-232 Logic Waveform (8N1)

The baud rate is the communication speed that measures the number of bit transfers per second. For example, 19200 baud is 19200 bits per second.

Data bits are a measurement of the actual data bits in a communication packet. For example, the above graphic shows eight (8) data bits in a communication packet. A communication packet refers to a single byte transfer, including Start/Stop bits, Data bits and Parity. If you are transferring a standard ASCII code (0 to 127), 7 data bits are enough. If it is an extended ASCII code (128 to 255), then 8 data bits are required.

Parity is a simple way to error-check. There are Even, Odd, Mark and Space indicators. You can also use no parity. For Even and Odd parity, the serial port sets the parity bit (the last bit after the data bit) to a value to ensure that the data packet has an Even or Odd number of logic-high bits. For example, if the data is 10010010, for Even parity, the serial port sets the parity bit as 1 to keep the number of logic-high bits Even. For Odd parity, the parity bit is 0 so that the number of logic-high bits is Odd. Mark parity simply sets the parity bit to logic-high and Space sets the parity bit to logic-low, so that the receiving party can determine if the data is corrupted.

Stop bits are used to signal the end of a communication packet. This also helps to synchronize different clocks on the serial devices.

Handshaking (Flow Control)

Handshaking is also called "Flow Control". The main purpose of Handshaking is to prevent receiver overloading. By using Handshaking signals, receivers will be able to tell the sending device to pause data transmission if the receiver is overloaded. There are three types of handshaking: Software handshaking, Hardware handshaking and Both.

Software handshaking uses two control characters: XON and XOFF. The receiver sends these control characters to pause transmitter during communication. XON is decimal 17 and XOFF is decimal 19 in the ASCII chart. The drawback of Software handshaking is that these two control characters can not be used in data. This is quite important when you are transmitting Binary data as you might need to use these two codes in your data.

Hardware handshaking makes use of actual hardware lines, such as RTS/CTS, DTR/DSR, and DCD/RI (for modem).

In DTE/DCE communication, RTS (Request to Send) is an output on the DTE and input on the DCE. CTS (Clear to Send) is the answering signal coming from the DCE. Before sending a data, the DTE asks permission by setting its RTS output to high. No data will be sent until the DCE grants permission by using the CTS line.

The DTE uses the DTR (Data Terminal Ready) signal to indicate it is ready to accept information, whereas the DCE uses the DSR signal for the same purpose. DTR/DSR are normally ON or OFF for the whole connection session (e.g. Off-hook), while RTS/CTS are ON or OFF for each data transmission.

DCD (Data Carrier Ready) is used by the modem when a connection has been established with remote equipment, while RI (Ring Indicator) is used by the modem to indicate a ring signal from telephone line

Data formats (Binary, Hex, Dec, Oct, and ASCII)

Serial devices use Binary for communication, which consists of just two unique numbers: 0 and 1. Binary is the Base-2 numbering system. One byte of data consists of 8 binary digits, from 0000 0000 to 1111 1111.

Hexadecimal is the base-16 system, which consists of 16 numbers: 0 to 9 and the letters A to F (decimal number 15). The Hexadecimal numbering system is useful because it can represent every byte as two consecutive hexadecimal digits, and it is easier for humans to read Hexadecimal numbers than Binary numbers. Most of the manufacturers use Hexadecimal in their protocol documentation. It is simple to convert a value from Hexadecimal to Binary. Just translate each Hexadecimal digit into its 4-bit binary equivalent. E.g. Hexadecimal number F3 equals Binary number 1111 0011.

Octal refers to the base-8 numbering system, which uses just eight unique symbols (0 to 7). Programmers often use Octal format because it is relatively easy for people to read and can easily be translated into binary format: each Octal digit represents 3 binary digits. E.g. Octal number 73 equals to Binary number 111 011.

Decimal refers to numbers in base 10, which is the numbering system we use most in everyday life. It's not as easy as Hexadecimal and Octal to converter Decimal to Binary number, but it is easier for us to understand Decimal.

ASCII (American Standard Code for Information Interchange) is a character encoding based on the English alphabet. ASCII codes (both readable and unreadable) are widely used in communications, such as Modem communications. Letters A to Z and numbers 0 to 9 are readable ASCII codes. Some ASCII codes are unreadable, such as the control codes: XON and XOFF, which are used in Software flow control.

Checksum

Many serial protocols use checksum (additional bytes added at the end of the data string) to check the data integrity, as errors might occur during data transmission.

There are many types of checksum, from the simplest uses of it in Modula or BCC to sophisticated CRC calculation. Using Modula as an example, we learn that before data transmission, the sender adds all command bytes together then mod it by 255 (decimal) to get an additional byte. This is to be added at the end of the command string. When the receiver receives the command string, it will first check the added byte to see whether data remain unchanged or not. If that is the case, it will accept the data, and if not, it will ask the sender to resend the data.

Examples of protocol commands

A protocol command is a data string sent from one serial device (e.g. a Computer) to another (i.e. a Modem). Here are some examples:

ASCII command example: ATI1<CR><LF> to query Modem manufacturer's information. (Note: <CR><LF> are the control codes: Carriage Return and Line Feed)

Convert the command string above to Hexadecimal and it becomes:
41 54 49 31 0D 0A

Convert the command string above to Decimal and it becomes:
065 084 073 049 013 010

Convert the command string above to Octal and it becomes:
101 124 111 061 015 012

Convert the command string above to Binary and it becomes:
01000001 01010100 01001001 00110001 00001101 00001010

Step 1: Understand RS-232 Connections & Signals
Step 3: Start controlling your RS-232 devices by using 232Analyzer

 
 

Payment gateways - Serial converters, RS232 Serial Protocol analyzer monitor software CommFront distributor - RS232 Serial Analyzer, Serial adapters, RS232 Serial Port monitor Serial converters, RS485 converters

 

CommFront Communications
Http://www.CommFront.com
Http://www.232Analyzer.com
E-mail: Sales@CommFront.com
Fax (USA): 1-732-676-7928
Fax (Singapore): 65-6491-5729

CommFront FedEx shipping - Serial Adapter, Serial port monitor CommFront USPS shipping - Serial Converter, RS232 Serial Monitor CommFront Singpost shipping - Serial Adapter, RS232 Serial port monitor

   
Terms & Conditions | Privacy Policy | Site Map | Support
USB RS232 RS485 RS422 TTL Serial Ethernet Data Fiber Optic Media Converter Adapter Repeater Isolator Modem Analyzer Monitor Terminal Software