phones off (please) Hardware 8 Basic Communications Dr John Cowell 1 Overview Communication issues speed (baud, bps, cps) direction (simplex, half-duplex and full-duplex) data bits and parity modes (asynchronous and synchronous) packets and frames bandwidth and capacity Communication protocols serial and parallel communication other communication methods Data compression techniques 2 3 Speed Maximum speed of data transmission is limited by the hardware. the type of cable / line / media the capabilities of the device controllers Speed is measured in several (related) ways bits per second (bps) The preferred way. The number of bits of information transmitted every second. A 2400 bps second modem may have a baud rate of 1200 sending symbols of 2 bits. baud rate the rate at which ‘symbols’ can be sent. Each symbol may be 1 or more bits. characters per second (cps) the number of characters transmitted every second 4 Direction Communication takes place in certain directions Simplex transmission allows data to flow in a single direction only, e.g. sending data to a basic printer sending display information to screens in airports / stations Half-duplex transmission data can flow in both directions, but not at same time e.g. CB radio or ‘walkie-talkies’ Full-duplex transmission data can flow in both directions at the same time, e.g. a (voice) telephone line most network communications 5 Data-bits Original ASCII only uses 7 bits to code characters most computers store a character in one byte (8 bits) 8th bit is always zero, so it does not have to be transmitted! only 7 bits need to be transmitted Original ASCII encoded only limited characters and so it has been extended, e.g. 8th bit is used to code an extra 128 characters quotes (‘ = 145), bullets (• = 149), pound-sign (£ = 163), etc. in this case 8 bits need to be transmitted International character sets (UNICODE) now use 16 bits to encode each single character 6 Parity Parity is a technique where an extra bit is included in each transmitted character to detect errors e.g. for 7 bit ASCII an eighth parity bit is added • In even-parity, the eighth bit is set to ‘0’ or ‘1’ so that there are an even number of ‘1’s in the byte ASCII ‘A’ 1 0 0 0 0 0 1 0 1 0 0 0 0 0 1 ASCII ‘C’ 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 • In odd-parity, the eighth bit is set to ‘0’ or ‘1’ so that there are an odd number of ‘1’s in the byte ASCII ‘A’ 1 0 0 0 0 0 1 1 1 0 0 0 0 0 1 ASCII ‘C’ 1 0 0 0 0 1 1 0 1 0 0 0 0 1 1 7 Modes Transmitting data only works if the receiving device is ready for it There are two aspects to being ready available in step There are two communication modes used to ensure that the transmitting and receiving devices keep in step once transmission has begun asynchronous and synchronous modes 8 Asynchronous Mode A special start signal is transmitted at the start of each group of message bits a group is usually just a single character Another special stop signal is transmitted at the end of each group When the receiving device gets the start signal, it sets up the timing mechanism to accept the group of message bits Usually, start / stop signals are additional (fixed value) bits, e.g. start is a ‘0’ bit, stop is a ‘1’ bit’ 9 Synchronous Mode A larger group of message bits usually many characters are transmitted together in a continuous stream There is a single start and stop signal at the beginning and end of each message group there are no start / stop signals for each character the transmitting and receiving devices must synchronise their clocks at the start of transmission these must be accurate enough to keep time with each other Usually, error-checking bits are transmitted at the end of each message to ensure accuracy 10 Comparison asynchronous start character stop start character stop start character stop synchronous start message (many characters) error stop checking Synchronous mode is + faster (less start / stop signals) more complex more expensive 11 Frames - 1 Frames or packets are a further extension used in synchronous transmission a transmitted message is divided into a series of message groups called frames (carrying packets) frames may arrive at any time, in any order the receiving device has to rebuild the message by testing the received frames requesting the re-transmission of damaged/missing frames control information control start information start packet 1 packet 2 error stop checking error stop checking 12 Frames - 2 Control information includes source address destination address important for routing actual number of data bytes sequence number important for when frames arrive out of order frame type start of message continuation of message end of message Not all bits transmitted are useful data data transfer rate is less than byte transfer rate 13 Bandwidth For analogue media, bandwidth is the difference between the highest and lowest frequencies at which a medium can transmit measured in Hertz (cycles per second) for example, telephone bandwidth is from 300 Hz to 3300 Hz = 3000 Hz but available bandwidth on copper wire 2 MHz ADSL technology exploits this gap 14 Capacity For digital media, bandwidth is the rate at which data can be transmitted usually measured in bits-per-second it is sometimes referred to as the capacity of the link limited by parameters of transmission medium With all data transmission, not all data sent is useful e.g. start/stop characters, control info., error-checking, etc. all slow down the effective data rate 15 16 Serial Communication In serial communication, each bit is transmitted one at a time over a single wire 01000100 01000001 01100011 01000001 D A T A • Only a single wire (plus an earth) is needed for each direction of transmission, i.e. – simplex requires just one wire plus earth – full-duplex requires two wires plus earth • this makes it very cheap 17 Serial Uses Because serial communication is so cheap, it is widely used for slow speed peripherals modems slow printers mice other input devices barcode readers, magnetic card readers, etc. Unfortunately, there are a wide variety of cable standards and specifications e.g. RS232 , RS432 18 Parallel Communications In parallel communication, all eight bits in one byte (character) are send over eight different wires all at once 0 1 0 0 0 1 0 0 0 1 0 0 0 0 0 1 0 1 1 0 0 0 1 1 0 1 0 0 0 0 0 1 D A T A – faster than serial, but more expensive 19 Parallel Uses Printers original PC parallel ports were simplex ports capable of transmitting information only suitable for printers modern printers are often half- or full-duplex so that they can send status information such as ‘out-of-paper’ Add-on peripheral devices external hard disk drives external CD-ROM drives tape backup devices 20 Other Protocols Parallel and serial connectors are point to point need one port (connector) per device USB (Universal Serial Bus) combines serial communications with bus technology multiple devices (up to 128) from one port is now the ‘standard’ Infra red technology is similar in concept multiple ‘serial’ devices from one port no physical connection (wires) required 21 22 Data Compression Techniques The effective data rate of a communications link can usually be increased through the use of data compression (and decompression) techniques as the communications link is the slowest link in the chain, a processor at either end of the link can afford to spend time converting data into a compressed form Data is examined prior to transmission and then recoded so that unnecessary redundant and duplicate bits are eliminated text can often be compressed by 75% or more graphics (bitmaps) can often be compressed over 90% 23 Text Compression Some compression methods are used for all types of information (but especially text) ‘lossless’ compression / decompression all information is preserved (perfectly) on decompression Huffman coding determines how often each character occurs The more common the character, the shorter the code that replaces it. Lempel-Ziv-Welch (LZW) searches for repeated strings in a document e.g. ‘communications’, ‘compression’ replaces these with special short codes 24 Graphics Compression Other techniques can be used for graphics files including ‘lossy’ compression / decompression decompressed image is an approximation of original Run length encoding (RLE) many graphics files have long sections of identical value bytes, e.g. 0’s for an area of black image repeated sequences are replaced by a code for ‘the next 2000 bytes are all zero’ JPEG (Joint Photographics Experts Group) a ‘lossy’ technique designed specially for photographic images, taking into account capabilities of the human eye in distinguishing adjacent colours and pixels 25 MPEG A set of standards for video and audio compression developed by the Moving Picture Experts Group. Started in 1988. Achieves video compression between 25:1 and 50:1 MPEG-1 - coding video at about 1.5MBits/s. The audio layer 3 is MP3. MPEG-2 – coding for transmission rates above 4Mbits/s. Used for DVD and digital TV and HDTV. MPEG-3 – never released – incorporated into MPEG-2. MPEG-4 – used for Blu-ray disk encoding. 26 MPEG Compression Uses 5 different compression techniques: 1. A frequency based transform – Discrete Cosine Transform (DCT). 2. Quantization, lossy compression, removes detail which may not be too noticeable to the viewer. 3. Huffman coding (lossless compression) using code table based on encoded data. 4. Motion compensated predictive coding – comparing the differences between successive images. 5. Bi-directional prediction – images are predicted from images before and after the image. 27 MPEG encoding There are many references on the web giving great detail. 28 Summary Communication issues speed (baud, bps, cps) direction (simplex, half-duplex and full-duplex) data bits and parity modes (asynchronous and synchronous) packets and frames bandwidth and capacity Communication protocols serial communication parallel communication other communication methods Data compression techniques 29