1 Inside “The Box”. 2 CRT Display Keyboard Mouse “The Box” CD-ROM Drive Floppy Disk Drive...

Preview:

Citation preview

1

Inside “The Box”

2

CRT Display

Keyboard

Mouse

“The Box”CD-ROM Drive

FloppyDiskDrive

Computing Devices – Old and New

3

Motherboard

4

CPU(Central Processing Unit)

5

SIMM(Single Inline Memory Module)

6

HDD(Hard Disk Drive)

7

Power Supply

8

Schematic Diagram of a Personal Computer...

Ports

CPU

RAM

Diskcontroller

Graphicscard

Soundcard

Networkcard

Printer

Mouse

Keyboard

ModemMonitor

Speakers

bus

Computer

Schematic Diagram of a Personal Computer...

10

Data Formats

Textbook: Chapter 4

11

Figure 3.1 Data conversion and representation

Data input

12

Introduction

• Examples (discreet, continuous)

Real World

Data

Computer

DataInput device

Dear Mom: Keyboard 10110010…

Digitalcamera

10110010…

13

Format must be Appropriate

• The internal representation must be appropriate for the type of processing to take place (e.g., text, images, sound)

• Problem: Since computers store everything in binary code, how does it know what a particular stored item is?

14

Rules/Conventions

• Proprietary formats– Unique to a product or company– E.g., Microsoft Word, Corel Word Perfect, IBM Lotus

Notes

• Standards– Evolve two ways:

• Proprietary formats become de facto standards (e.g., Adobe PostScript, Apple Quick Time)

• Committee is struck to solve a problem (Motion Pictures Experts Group, MPEG)

Text : pg 63-64

15

Standards Organizations

• ISO – International Standards Organization

• CSA – Canadian Standards Association

• ANSI – American National Standards Institute

• IEEE – Institute for Electrical and Electronics Engineers

Rv.kc

16

Examples of StandardsType of Data Standards

Alphanumeric ASCII, EBCDIC, Unicode

Image JPEG, GIF, PCX, TIFF

Motion picture MPEG-2, Quick Time,MP4

Sound Sound Blaster, WAV, AU,MP3

Outline graphics/fonts

PostScript, TrueType, PDF

Hint - Learn What kind is which!

17

Why Standards?• Standards are “arbitrary”

• They exist because they are:– Convenient– Efficient– Flexible– Appropriate

Plus, they provide some consistency andpredictability for applications.

Rv.kc

18

Alphanumeric Data• Problem: Distinguishing between the number 123 (one

hundred twenty-three) and the characters “123” (one, two, three)

• In software: data is given a type• Four Main standards for representing letters (alpha)

and numbers– BCD – Binary-coded decimal– ASCII – American standard code for information interchange– EBCDIC – Extended binary-coded decimal interchange

code– Unicode

19

Standard Alphanumeric Formats

• BCD (Binary Coded Decimal)

• ASCII

• EBCDIC

• Unicode

20

Next slides

Standard Alphanumeric Formats

• BCD

• ASCII

• EBCDIC

• Unicode

21

The Problem

• Representing text strings, such as “Hello, world”, in a computer

After all, computers store binary digits, not letters!

22

Codes and Characters

• Each character is coded as a byte

• Most common coding system is ASCII (Pronounced ass-key)

• ASCII = American National Standard Code for Information Interchange

• Defined in ANSI document X3.4-1977

23

ASCII Features

• 7-bit code• 8th bit is unused (or used for a parity bit or

to indicate “extended” character set)• 27 = 128 codes• Two general types of codes:

– 95 are “Graphic” codes (displayable on a console)– 33 are “Control” codes (control features of the

console or communications channel)

R/kc

24

+/Kc

Memorize codes for: blank space,

period, digit zero (0),capital A,small a,carriage return

(CR)

Hint

25

ASCII chart0 1 2 3 4 5 6 7

0 NULL DLE 0 @ P ` p1 SOH DC1 ! 1 A Q a q2 STX DC2 " 2 B R b r3 ETX DC3 # 3 C S c s4 EDT DC4 $ 4 D T d t5 ENQ NAK % 5 E U e u6 ACK SYN & 6 F V f v7 BEL ETB ' 7 G W g w8 BS CAN ( 8 H X h x9 HT EM ) 9 I Y i yA LF SUB * : J Z j zB VT ESC + ; K [ k {C FF FS , < L \ l |D CR GS - = M ] m }E SO RS . > N ^ n ~F SI US / ? O _ o DEL

26

e.g., ‘a’ = 1100001

Example: character ‘a’0 1 2 3 4 5 6 7

0 NULL DLE 0 @ P ` p1 SOH DC1 ! 1 A Q a q2 STX DC2 " 2 B R b r3 ETX DC3 # 3 C S c s4 EDT DC4 $ 4 D T d t5 ENQ NAK % 5 E U e u6 ACK SYN & 6 F V f v7 BEL ETB ' 7 G W g w8 BS CAN ( 8 H X h x9 HT EM ) 9 I Y i yA LF SUB * : J Z j zB VT ESC + ; K [ k {C FF FS , < L \ l |D CR GS - = M ] m }E SO RS . > N ^ n ~F SI US / ? O _ o DEL

27

Code types: 95 graphic codes0 1 2 3 4 5 6 7

0 NULL DLE 0 @ P ` p1 SOH DC1 ! 1 A Q a q2 STX DC2 " 2 B R b r3 ETX DC3 # 3 C S c s4 EDT DC4 $ 4 D T d t5 ENQ NAK % 5 E U e u6 ACK SYN & 6 F V f v7 BEL ETB ' 7 G W g w8 BS CAN ( 8 H X h x9 HT EM ) 9 I Y i yA LF SUB * : J Z j zB VT ESC + ; K [ k {C FF FS , < L \ l |D CR GS - = M ] m }E SO RS . > N ^ n ~F SI US / ? O _ o DEL

28

See text page 69 / 71 for details

Code types: 33 control codes0 1 2 3 4 5 6 7

0 NULL DLE 0 @ P ` p1 SOH DC1 ! 1 A Q a q2 STX DC2 " 2 B R b r3 ETX DC3 # 3 C S c s4 EDT DC4 $ 4 D T d t5 ENQ NAK % 5 E U e u6 ACK SYN & 6 F V f v7 BEL ETB ' 7 G W g w8 BS CAN ( 8 H X h x9 HT EM ) 9 I Y i yA LF SUB * : J Z j zB VT ESC + ; K [ k {C FF FS , < L \ l |D CR GS - = M ] m }E SO RS . > N ^ n ~F SI US / ? O _ o DEL

29

Code types: alphabetic codes0 1 2 3 4 5 6 7

0 NULL DLE 0 @ P ` p1 SOH DC1 ! 1 A Q a q2 STX DC2 " 2 B R b r3 ETX DC3 # 3 C S c s4 EDT DC4 $ 4 D T d t5 ENQ NAK % 5 E U e u6 ACK SYN & 6 F V f v7 BEL ETB ' 7 G W g w8 BS CAN ( 8 H X h x9 HT EM ) 9 I Y i yA LF SUB * : J Z j zB VT ESC + ; K [ k {C FF FS , < L \ l |D CR GS - = M ] m }E SO RS . > N ^ n ~F SI US / ? O _ o DEL

30

Code types: numeric codes0 1 2 3 4 5 6 7

0 NULL DLE 0 @ P ` p1 SOH DC1 ! 1 A Q a q2 STX DC2 " 2 B R b r3 ETX DC3 # 3 C S c s4 EDT DC4 $ 4 D T d t5 ENQ NAK % 5 E U e u6 ACK SYN & 6 F V f v7 BEL ETB ' 7 G W g w8 BS CAN ( 8 H X h x9 HT EM ) 9 I Y i yA LF SUB * : J Z j zB VT ESC + ; K [ k {C FF FS , < L \ l |D CR GS - = M ] m }E SO RS . > N ^ n ~F SI US / ? O _ o DEL

31

Code types: punctuation codes, etc.0 1 2 3 4 5 6 7

0 NULL DLE 0 @ P ` p1 SOH DC1 ! 1 A Q a q2 STX DC2 " 2 B R b r3 ETX DC3 # 3 C S c s4 EDT DC4 $ 4 D T d t5 ENQ NAK % 5 E U e u6 ACK SYN & 6 F V f v7 BEL ETB ' 7 G W g w8 BS CAN ( 8 H X h x9 HT EM ) 9 I Y i yA LF SUB * : J Z j zB VT ESC + ; K [ k {C FF FS , < L \ l |D CR GS - = M ] m }E SO RS . > N ^ n ~F SI US / ? O _ o DEL

32

“Hello, world” Example

============

Hexadecimal48656C6C6F2C207767726C64

Decimal72

1011081081114432

119103114108100

Hello, world

============

33

Common Control Codes

• CR 0D carriage return

• LF 0A line feed

• HT 09 horizontal tab

• DEL 7F delete

• NULL 00 null

Hexadecimal code

34

Common control codes in the table

0 1 2 3 4 5 6 70 NULL DLE 0 @ P ` p1 SOH DC1 ! 1 A Q a q2 STX DC2 " 2 B R b r3 ETX DC3 # 3 C S c s4 EDT DC4 $ 4 D T d t5 ENQ NAK % 5 E U e u6 ACK SYN & 6 F V f v7 BEL ETB ' 7 G W g w8 BS CAN ( 8 H X h x9 HT EM ) 9 I Y i yA LF SUB * : J Z j zB VT ESC + ; K [ k {C FF FS , < L \ l |D CR GS - = M ] m }E SO RS . > N ^ n ~F SI US / ? O _ o DEL

35

Terminology

• Names of special symbols

• [ ] brackets

• { } braces

• ( ) parentheses

• @ commercial ‘at’ sign

• & ampersand

• ~ tilde

36

Special symbols in the table0 1 2 3 4 5 6 7

0 NULL DLE 0 @ P ` p1 SOH DC1 ! 1 A Q a q2 STX DC2 " 2 B R b r3 ETX DC3 # 3 C S c s4 EDT DC4 $ 4 D T d t5 ENQ NAK % 5 E U e u6 ACK SYN & 6 F V f v7 BEL ETB ' 7 G W g w8 BS CAN ( 8 H X h x9 HT EM ) 9 I Y i yA LF SUB * : J Z j zB VT ESC + ; K [ k {C FF FS , < L \ l |D CR GS - = M ] m }E SO RS . > N ^ n ~F SI US / ? O _ o DEL

37

Escape Sequences

• Extend the capability of the ASCII code set• For controlling terminals and formatting output• Defined by ANSI in documents X3.41-1974 and

X3.64-1977

• The escape code is ESC = 1B16

• An escape sequence begins with two codes:

ESC [ 1B16 5B16

38

Examples

• Erase display: ESC [ 2 J

• Erase line: ESC [ K

39

Next slides

Standard Alphanumeric Formats

• BCD

• ASCII

• EBCDIC

• Unicode

40

Unicode

• 16-bit standard

• Developed by a consortia

• Intended to supercede older 7- and 8-bit codes

41

Unicode Version 2.1

• 1998

• Improves on version 2.0

• Includes the Euro sign (20AC16 = )

• From the standard:…contains 38,887 distinct coded characters derived from the supported scripts. These characters cover the principal written languages of the Americas, Europe, the Middle East, Africa, India, Asia, and Pacifica.

http://www.unicode.org

42

Keyboard Input

• Key (“scan”) codes are converted to ASCII

• ASCII code sent to host computer

• Received by the host as a “stream” of data

• Stored in buffer

• Processed

• Etc.

43

Figure 3.7 Keyboard operation

Keyboard to binary

44

Shift Key

• inhibits bit 5 in the ASCII code

Key(s)

ASCII code

6 5 4 3 2 1 0 Character

1 1 0 0 0 0 1

1 0 0 0 0 0 1

a

A

a

aShift

45

Control Key

• inhibits bits 5 & 6 in the ASCII code

Key(s)

ASCII code

6 5 4 3 2 1 0 Character

1 1 0 0 0 1 1

0 0 0 0 0 1 1

c

ETX

c

cCtrl

Controlcode

46

Data Input Devices

• OCR – optical character recognition

• Bar code readers

• Voice/audio input

• Punched cards

• Images / objects

• Pointing devices

pp. Old: 69-86Rev: 72-89

47

OCR

Hello, world

Page of text

Optical scan 10110110…

Computer file

48

Data Input Devices

• OCR – optical character recognition

• Bar code readers

• Voice/audio input

• Punched cards

• Images / objects

• Pointing devices

pp. 69-86

49

Bar Codes• An automatic identification (Auto ID)

technology that streamlines identification and data collection

• See: http://www.digital.net/barcoder/barcode.html

50

Data Input Devices

• OCR – optical character recognition

• Bar code readers

• Pointing devices

• Punched cards

• Voice/audio input

• Images / objects

pp. 69-86

51

Pointing Devices

• Originally used for specifying coordinates (x, y) for graphical input

• Today used as general purpose device for “graphical user interfaces” (GUIs)

52

Data Input Devices

• OCR – optical character recognition

• Bar code readers

• Pointing devices

• Punched cards

• Voice/audio input

• Images / objects

pp. 69-86

53

Punched Cards

• Invented by Herman Hollerith (founder of IBM)

• Each card holds 80 characters

54

Image data

• Typically images are pictures that are optically scanned and saved as a “bit map” or in some other format

• Many formats– gif, jpeg, …

Note: animated gifs often used on www

55

Typical “Save As” Dialog

56

Types of images

• Bitmaps (raster images)– Examples: photographs, pointing devices– Continuous variation of color, shape, texture– Entered via a scanner or video camera

• Object images– Created with specialized drawing programs– Set of graphical objects (lines, rectangles,

etc.)

57

Bitmap images

• Made of pixels• Require a lot of memory (600 x 800 x 3 = 1.4

MB)• Resolution – defines the detail level of the image• Involve little processing• Formats

– GIF (limited to 256 colors)– JPEG (up to 16 Million of colors; use compression)

Bitmap Images

• Used for realistic images with continuous variations in shading, color, shape and texture

• Preferred when image contains large amount of detail and processing requirements are fairly simple

• Input devices: – Scanners– Digital cameras and video capture devices– Graphical input devices like mice and pens

• Managed by photo editing software or paint software

4-58

Bitmap Images

• Each individual pixel, for pi[x]cture element, in a graphic is stored as a binary number– Pixel: A small area with an associated coordinate

location

– Example: each point below represented by a 4-bit code corresponding to 1 of 16 shades of gray

4-59

Bitmap Display

• Monochrome: black or white– 1 bit per pixel

• Gray scale: black, white or 254 shades of gray– 1 byte per pixel

• Color graphics: 16 colors, 256 colors, or 24-bit true color (16.7 million colors)– 4, 8, and 24 bits respectively

4-60

61

Figure 3.10 GIF screen layout

GIF format

62

Figure 3.11 GIF file format layout

GIF image format

JPEG (Joint Photographers Expert Group)

• Allows more than 16 million colors• Suitable for highly detailed photographs

and paintings• Employs lossy compression algorithm that

– Discards data to decreases file size and transmission speed

– May reduce image resolution, tends to distort sharp lines

4-63

Bitmap vs. Object ImagesBitmap (Raster) Object (Vector)

Pixel map Geometrically defined shapes

Photographic quality Complex drawings

Paint software Drawing software

Larger storage requirements Higher computational requirements

Enlarging images produces jagged edges

Objects scale smoothly

Resolution of output limited by resolution of image

Resolution of output limited by output device

4-64

Video Images

• Require massive amount of data– Video camera producing full screen 1024 x

768 pixel true color image at 30 frames/sec 70.8 MB of data/sec

– 1-minute film clip 4.25 GB storage• Options for reducing file size: decrease

size of image, limit number of colors, or reduce frame rate

• Video format determined by a codec, encoder/decoder

4-65Copyright 2013 John Wiley & Sons, Inc.

Video Images• Best known codec standards: MPEG-2,

MPEG-4, and H.264– Data may be compressed to 10-60 MB or less of

data per minute• Container serves as a superstructure to

encode, decode, hold and stream the video– Examples: Quicktime from Apple, WebM from

Google, and Flash Video from Adobe• Streaming video: video displayed in real time

as it is downloaded from the Web server

4-66Copyright 2013 John Wiley & Sons, Inc.

Audio Data

• Transmission and processing requirements less demanding than those for video

• Analog Waveform: digital representation of sound

• Analog sound converted to digital values by A-to-D converter

• MIDI (Musical Instrument Digital Interface): instructions to recreate or synthesize sounds

4-67Copyright 2013 John Wiley & Sons, Inc.

Waveform Audio

Sampling rate normally 50KHz

4-68Copyright 2013 John Wiley & Sons, Inc.

Sampling Rate

• Number of times per second that sound is measured during the recording process.– 1000 samples per second = 1 KHz (kilohertz)– Example: Audio CD sampling rate = 44.1KHz

• Height of each sample saved as:– 8-bit number for radio-quality recordings– 16-bit number for high-fidelity recordings– 2 x 16-bits for stereo

4-69Copyright 2013 John Wiley & Sons, Inc.

Audio Formats

• MP3 – predominant digital audio data format– Derivative of MPEG-2 (ISO Moving Picture Experts

Group)– Uses psychoacoustic lossy compression techniques

to reduce storage requirements• WAV

– Developed by Microsoft as part of its multimedia specification

– General-purpose format for storing and reproducing small snippets of sound

– Non-compressed 8- or 16-bit sound samples

4-70Copyright 2013 John Wiley & Sons, Inc.

Audio Data Formats

4-71Copyright 2013 John Wiley & Sons, Inc.

WAV file

Data Compression

• Compression: recoding data so that it requires fewer bytes of storage space.

• Compression ratio: the amount file size is reduced• Lossless: inverse algorithm restores data to exact

original form– Examples: GIF, PCX, TIFF, ZIP

• Lossy: trades off data degradation for file size and download speed– Much higher compression ratios, often 10 to 1– Example: JPEG, MP3 – Common in multimedia

• H.264: uses both forms for ratios of 1000:1

4-72Copyright 2013 John Wiley & Sons, Inc.

Recommended