Before Internet technology TCP/IP, asynchronous serial communication was often used. In embedded control system area, it is used at the present time.
Key words
- Asynchronous serial communication
- Control Code and Character, Ascii
- Command Answer Protocol
- Physical Layer
Synchronous communication requires a set of synchronous signal and data signal.
Asynchronous communication needs no synchronous signal, so it is a simple way to communicate.
Sender and receiver agree with communication speed, bit rate each other.
Receiver waits start bit then decides one or zero of the bit received by own timer.
One character consists of bits like below.
Bit | Number of Bit | Remarks |
---|---|---|
Start | 1 | |
Data | 7 or 8 | Ascii code |
Parity | 1 | Option |
Stop | 1 | |
Total | 9 to 11 bit |
See also
Wiki: Asynchronous serial communication
This is Ascii (American Standard Code for Information Interchange) code table. Characters are assigned to 8 or 7 bit like below.
ASCII CODE Table
b3 | b2 | b1 | b0 | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
b7 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | |||||
b6 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 0 | 0 | |||||
b5 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 1 | 0 | 0 | |||||
b4 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | |||||
0 | 0 | 0 | 0 | NUL | DE | 0 | @ | P | p | ||||||
0 | 0 | 0 | 1 | SH | D1 | ! | 1 | A | Q | a | q | ||||
0 | 0 | 1 | 0 | STX | D2 | " | 2 | B | R | b | r | ||||
0 | 0 | 1 | 1 | ETX | D3 | # | 3 | C | S | c | s | ||||
0 | 1 | 0 | 0 | ET | D4 | $ | 4 | D | T | d | t | ||||
0 | 1 | 0 | 1 | ENQ | NAK | % | 5 | E | U | e | u | ||||
0 | 1 | 1 | 0 | ACK | SN | & | 6 | F | V | f | v | ||||
0 | 1 | 1 | 1 | BL | EB | ' | 7 | G | W | g | w | ||||
1 | 0 | 0 | 0 | BS | CN | ( | 8 | H | X | h | x | ||||
1 | 0 | 0 | 1 | HT | EM | ) | 9 | I | Y | i | y | ||||
1 | 0 | 1 | 0 | LF | SB | * | : | J | Z | j | z | ||||
1 | 0 | 1 | 1 | HM | EC | + | ; | K | [ | k | { | ||||
1 | 1 | 0 | 0 | FF | + | L | \ | l | | | ||||||
1 | 1 | 0 | 1 | CR | M | ] | m | } | |||||||
1 | 1 | 1 | 0 | S0 | . | N | ^ | n | |||||||
1 | 1 | 1 | 1 | S1 | / | ? | O | _ | o |
1 Control Code
A example of using control code is below.
Receiver send back ACK, 0x06 if it received message correctly. ACK means ACKnowledge.
2 Message Frame
Detail of the protocol is entrusted to the designer of the system. So many protocols are present. Typical organization of message transfered is like below.
Element | Code | Remarks |
---|---|---|
STX | 0x02 | Start of Text |
Text | Ascii exclusive of control code | Message Body |
ETX | 0x03 | End of Text |
BCC | - | Block Check Code |
3 Protocol
Most often used protocol is command/reply or command/answer protocol. There are one master and slave(s) in this case. Master starts communication and slave wait STX of master's message. The slave sends a reply to master when slave receives a command from master correctly.
4 Timer
Some timers are used to manage communication.
They are
- Wait reply
- Inter character
RS232C or RS485 are hardwares which allow asynchronous serial communication. TXD(Transfer Data) is a port of send data and RXD(Receive Data) is a port of received data. TXD is connected to RXD of opposite side each other.