-------- Most significant three bits ---------- | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
H E X | B I N | 0 000 | 1 001 | 2 010 | 3 011 | 4 100 | 5 101 | 6 110 | 7 111 | HEX BIN | |
0 | 0000 | NUL | DLE | SP | 0 | @ | P | ` | p | ||
1 | 0001 | SOH | DC1 | ! | 1 | A | Q | a | q | ||
2 | 0010 | STX | DC2 | " | 2 | B | R | b | r | ||
3 | 0011 | ETX | DC3 | # | 3 | C | S | c | s | ||
4 | 0100 | EOT | DC4 | $ | 4 | D | T | d | t | ||
5 | 0101 | ENG | NAK | % | 5 | E | U | e | u | ||
6 | 0110 | ACK | SYN | & | 6 | F | V | f | v | ||
7 | 0111 | BEL | ETB | ' | 7 | G | W | g | w | ||
8 | 1000 | BS | CAN | ( | 8 | H | X | h | x | ||
9 | 1001 | HT | EM | ) | 9 | I | Y | i | y | ||
A | 1010 | LF | SUB | * | : | J | Z | j | z | ||
B | 1011 | VT | ESC | + | ; | K | [ | k | { | ||
C | 1100 | FF | FS | , | < | L | \ | l | | | ||
D | 1101 | CR | GS | - | = | M | ] | m | } | ||
E | 1110 | SO | RS | . | > | N | ^ | n | ~ | ||
F | 1111 | SI | VS | / | ? | O | <- | o | DEL |
These are generated from the keyboard by holding down the CTRL key whilst hitting a letter key. An ASCII code which is $40 less than the upper-case character is generated.
Control codes may be used for any purpose, but in the interests of standardisation, the majority have a defined usage, for example:
$0A line feed (LF) = CTRL-J $0D carriage return (CR) = CTRL-M $08 backspace (BS) = CTRL-H $09 horizontal tab (HT) = CTRL-ISuch representations of characters are used within a microprocessor system. A standard character set is especially important when transferring data between systems.
Parallel data transfers are commonly used for printers. Here, fast data transfer is possible as the distance from computer to printer is normally short. The 'Centronics' interface is one example of a parallel port.
With long lines and (or) high data rates, parallel interfaces run into problems with data skew or differential delay. At the remote end, the bits of data may no longer be aligned and it will be difficult to reconstruct the original data.
Another problem with long parallel lines is that of cross-talk where data from an adjacent line interferes with the data, so corrupting it.
For these reasons, parallel interfaces are normally only used for short distances.
A higher-performance parallel interface has been defined and is known as the General Purpose Interface Bus (GPIB) or HPIB (Hewlett-Packard Interface Bus, since HP originated the specification), or by its American Standard - IEEE 488.
A parity bit may also be used to detect single-bit errors.
The data may be sent as 8-bit ASCII or 7-bit ASCII and this format must be agreed in advance by transmitter and receiver.
e.g. 7-bit ASCII, 1 STOP bit
start | 0 | 1 | 2 | 3 | 4 | 5 | 6 | parity | stop |
---|
In the format above, in order to transmit a 7-bit ASCII code, 10 bits are used in the frame.
Between characters, a continuous STOP bit is sent. This is a '1'. The START bit is always a '0' so a high-to-low transition defines the start of a character. The baud rate is agreed in advance, so that on receipt of a start bit, a half-bit delay is generated and each bit is then sampled at intervals of one bit (i.e. in the centre of each bit).
All the '1's in the data transmitted are counted (excluding START and STOP bits).
If even parity is selected, the parity bit is set so that the total number of bits which are '1' is an even number.
If odd parity is selected, the parity bit is set so that the total number of bits which are '1' is an odd number.
Some RS232 derivative specifications use 0V and 5V levels. These are acceptable for short distances only.
The full RS232 specification allows for +/-15V to be sent by the transmitter. The receiver has a +/-3V threshold to allow for attenuation.
A SPACE (logic '0') is transmitted as a positive voltage and the MARK (logic '1') is transmitted as a negative voltage. It should be noted that negative logic is used here.
Tx 2 -------------\ /-------------- 2 Tx \/ Rx 3 ______________/\_______________ 3 Rx GND 7 ------------------------------- 7 GNDIn spite of the 'standard', there are numerous variations in RS232 connections found in equipment. This is why there are several RS232 analysers on the market. It may be necessary to experiment before achieving successful RS232 communications.