You are on page 1of 26

Serial Komunikasi Kode Morse

RS232C
RS-232 is a standard that describes a common method of serial signaling using a voltage that switches between a positive level for logic "0" and a negative level for logic "1". Per the standard,
+2.5 to +15V = logic 0 -2.5 to -15V = logic 1

An international standard for serial communication ( 1960s).

RS-232 voltages are inverted with respect to normal logic.


That is, we normally represent a logic 1 using the higher voltage in a given circuit, say 5V. In RS-232 it's the opposite: a "1" is the lower, or negative supply voltage.

When an RS-232 line is powered up but idle (not conveying data) it is in its lower voltage state, be that approximately 0V or negative. When data is to be sent, RS-232 jumps to its higher voltage state momentarily to alert the receiver. This is called a start bit (figure 1). So, if you're checking a serial line for proper operation, a quick check with a multimeter should show an idle state of close to 0V or negative.

Mekanisme dan Pewaktuan


Let's walk through the transmission of one byte of data. Per figure 1, the serial line starts off low, in its idle or stop-bit state. It can stay in this state forever--the receiving device understands this to mean that no data is available. When there is data to send, the following sequence of events occurs (from the perspective of the sender): The sender outputs a high level for one bit time1--the start bit At intervals of 1 bit time, the sender outputs the data bits in inverted form (i.e., with a high voltage meaning "0" and a low or negative voltage meaning "1"). The data bits are sent in order from leastsignificant bit (lsb)2 to most-significant bit (msb)2. After the final data bit, the msb, is sent, the sender returns to the low/stop-bit state for at least one bit time. After this, it may send another byte or remain idle.

Pengiriman Data Serial

Notes: 1. A bit time is defined as 1/bps. For example, at 9600 bps the bit time is 1/9600 = 104 microseconds. 2. The "significance" of a bit or digit is its relative value. When we write numbers, the most-significant bit/digit is the one furthest to the left.

Baudrate
The rate of transmission of a data bit stream in bits per second (bps or b/s) is called the bit rate. Standard bit rates are
110 ( the old teletype or TTY rate), 300 (early PC modems), 1200, 2400, 9600, 14.4K, 19.2K, 28.8K, 38.4K, 57.6K, and115.2 bps.

Signaling
Idle line in mark state (logic 1 - -15V) Baud means number of signal changes on the line per second. Commonly equal to bits per second (bps).

The asynchronously transmitted character is composed of


5 to 8 data bits, an optional parity bit, and either 1, 1.5, or 2 stop bits.

The most used form of character encoding is the American Standard Code for Information Interchange (ASCII). This is a seven bit code which allows for 128 characters. Codes that are less than 20H are not alpha-numeric characters but control codes such as carriage return or backspace.
numbers 0 - 9 are encoded as 30H -39H. capitol letters A - Z have codes 41H - 5AH , and lower case letters a - z are 61H - 7FH.

When start and stop bits and a parity bit are added to
the ASCII code, 9 to 11 bits are transmitted.

The rate of transmission of a data bit stream inbits per second (bps or b/s) is called the bit rate.

Sinkronisasi
Since digital data are transmitted as a stream of bits, synchronization is required between the source and destination of the data.
Asynchronous communication transmits one character at a time by adding start and stop bits to the character code. Synchronous transmission transmits a block of data and a clock signal or known known bit pattern that can be used for synchronization.

A block number and check sum are also transmitted.

Sinkronisasi
There is no common clock between sender and receiver. How does receiver know when to test levels? A1: Synchronus mode rarely used. Continuous stream of characters. A2: Asynchronus mode start bit is known to be logic 0. Falling (rising?) edge triggers a local clock in the receiver.

Multiplexing
Terms: Simplex One sender and one receiver. Half Duplex One side can send at a time. Full Duplex Both sides can send at same time. Typical serial communication today is Full Duplex.

Simplex

Half Duplex

Full Duplex

Wiring
Minimum 3 wires:
TX (transmit) RX (receive) gnd (V=0 reference)

Maximum 23 wires!

Connections
Must have: TX RX RX TX Cables are easier to make if pins are straight through. i.e. pin n connects to pin n.

Connectors
23 pin (ancient, un-needed) 9 pin (IBM PC standard)
Two connector wiring types DTE: pin 2 = RX, pin 3 = TX Data Terminal Equipment DCE: pin 2 = TX, pin 3 = RX Data Communications Equipment

Thus, DCE can talk to DTE with a straight through cable. DTE, DCE are ancient names from time sharing days. Typical today:
PC == DTE modem, printer, etc, == DCE

Null Modem
What if you want to connect a DTE to another DTE (such as PC-PC)?
Use a special cable which connects all lines straight through except pin 2 pin 3 and pin 3 pin 2

Flow Control
Sometimes a slow device cannot handle data as fast as sender (even at same baud rate). Receiver needs a way to stop and start sender. Hardware solution: Additional wires:
RTS Request to Send. DTE sets this to mark to allow data to be sent to it by DCE.

CTS Clear to Send. DCE sets this to mark to allow data to be sent to it by DTE. Hardware flow control can be enabled/disabled. Software solution: Special Control Characters:
XON (ctl Q) Start Transmitting XOFF(ctl S) Stop Transmitting

Note: If you use Hardware Flow control, then null modem cable must also cross the RTS and DTS wires (pins 7,8 on 9-pin IBM standard).

Error Control
Unfortunately, serial communication is subject to errors. Sources:
Electrical interference Long wire lengths Ground potential differences between communicating systems. Timing errors between sender and receiver clocks (should be within 1%).

Solutions
Character Parity 9th data bit. Very weak and bandwidth hog. Checksum Add up a group of bytes. Send sum at end of packet. Compare. Parity Send parity of some group of bits (rows or colums) in the packet. CRC Use theory of binary polynomials. Send a code so that combined message is divisible by some known polynomial.

You might also like