Title: Review multiplying powers
1Review multiplying powers
- For common bases, add powers
ab ? ac abc
26 ? 210 216 65,536 or 26 ? 210 64 ? 210
64k
2Binary Addition (1 of 2)
two
pp. 36-38
3Binary Addition (2 of 2)
- Two n-bit values
- Add individual bits
- Propagate carries
- E.g.,
1
1
10101 11001
4Binary Addition (2 of 2)
- Two n-bit values
- Add individual bits
- Propagate carries
- E.g.,
1
1
10101 21 11001 25
5Binary Addition (2 of 2)
- Two n-bit values
- Add individual bits
- Propagate carries
- E.g.,
1
1
10101 21 11001 25 46
6Binary Addition (2 of 2)
- Two n-bit values
- Add individual bits
- Propagate carries
- E.g.,
1
1
10101 21 11001 25 101110 46
7Multiplication (1 of 3)
35x 105 175 000 35 3675
pp. 39
8Multiplication (2 of 3)
9Multiplication (3 of 3)
- Binary, two n-bit values
- As with decimal values
- E.g.,
1110 x 1011 1110 1110 0000
111010011010
10Fractions
- Decimal to decimal (just for fun)
3.14 gt 4 x 10-2 0.04 1 x 10-1 0.1 3 x
100 3 3.14
pp. 46-50
11Fractions
10.1011 gt 1 x 2-4 0.0625 1 x 2-3
0.125 0 x 2-2 0.0 1 x 2-1 0.5 0 x 20
0.0 1 x 21 2.0 2.6875
pp. 46-50
12Fractions
.14579x 20.29158x 20.58316x
21.16632x 20.33264x 20.66528x
21.33056 etc.
3.14579
11.001001...
p. 50
13Exercise Convert ...
Skip answer
Answer
14Exercise Convert
Answer
152. Data Formats
Chapt. 3
16Introduction
Input device
pp. 59.-61
17Format must be appropriate
- The internal representation must be appropriate
for the type of processing to take place (e.g.,
text, images, sound)
18Rules/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)
pp. 61-62
19Standards Organizations
- ISO International Organization for
Standardization - CSA Canadian Standards Association
- ANSI American National Standards Institute
- Founded in 1918 and member of the ISO
- Works within the industries to coordinate and set
standards in the United States - ASCII is one of the ANSI standards
- IEEE Institute for Electrical and Electronics
Engineers - Etc.
20Examples of Standards
21Why Standards?
- Standard are arbitrary
- They exist because they are
- Convenient
- Efficient
- Flexible
- Appropriate
- Etc.
22Alphanumeric Data
- Problem Distinguishing between the number 123
(one hundred and twenty-three) and the characters
123 (one, two, three) - Four 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
pp. 63-69
23Standard Alphanumeric Formats
Next 2 slides
24Binary-Coded Decimal (BCD)
Note the following bit patterns are not
used 1010 1011 1100 1101 1110 1111
25Example
7 0 9 3 0111 0000 1001 0011
26Standard Alphanumeric Formats
Next 22 slides
27The Problem
- Representing text strings, such as Hello,
world, in a computer
28Codes 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
29ASCII Features
- 7-bit code
- 8th bit is unused (or used for a parity bit)
- 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)
30Hint
Memorize codes for blank space, period,
digit zero (0), capital A, small
a, carriage return (CR)
/Kc
31ASCII Chart
32(No Transcript)
33Most significant bit
Least significant bit
34e.g., a 1100001
3595 Graphic codes
3633 Control codes
37Alphabetic codes
38Numeric codes
39Punctuation, etc.
40Hello, world Example
41Common Control Codes
- CR 0D carriage return
- LF 0A line feed
- HT 09 horizontal tab
- DEL 7F delete
- NULL 00 null
Hexadecimal code
42(No Transcript)
43Terminology
- Learn the names of the special symbols
- brackets
- braces
- ( ) parentheses
- _at_ commercial at sign
- ampersand
- tilde
44(No Transcript)
45Standard Alphanumeric Formats
Next 1 slides
46EBCDIC
- Extended BCD Interchange Code (pronounced
ebb-se-dick) - 8-bit code
- Developed by IBM
- Rarely used today
- IBM mainframes only
47Standard Alphanumeric Formats
Next 2 slides
48Unicode
- 16-bit standard
- Developed by a consortia
- Intended to supercede older 7- and 8-bit codes
49Unicode 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
50Keyboard 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.
pp. 69
51Keyboard to binary
Figure 3.7 Keyboard operation
52Shift Key
- inhibits bit 5 in the ASCII code
a
a
Shift
53Control Key
- inhibits bits 5 6 in the ASCII code
c
c
Ctrl
Controlcode
54Data Input Devices
- OCR optical character recognition
- Bar code readers
- Voice/audio input
- Punched cards
- Images / objects
- Pointing devices
pp. 69-86
55OCR
Optical scan
10110110
Page of text
Computer file
56Data Input Devices
- OCR optical character recognition
- Bar code readers
- Voice/audio input
- Punched cards
- Images / objects
- Pointing devices
pp. 69-86
57Bar Codes
- An automatic identification (Auto ID) technology
that streamlines identification and data
collection - See
- http//www.digital.net/barcoder/barcode.html
58Data Input Devices
- OCR optical character recognition
- Bar code readers
- Voice/audio input
- Punched cards
- Images / objects
- Pointing devices
pp. 69-86
59Voice/audio Input
- Input device microphone
- Audio input is digitized and stored
- Processed in two ways
- As is (no recognition)
- Recognized and converted to alphanumeric data
(ASCII)
Digitize
10110010
60Audio data formats
- MIDI
- Used for storing instrument sound
- WAV
- Used to store sound snippets
- MP3
- Derived from MPEG-2
- High quality
61WAV data format
Figure 3.16 .WAV sound format
62Video images
- Require large amounts of data
- Example 640 x 480 x 30 frames/s x 3 colors bits
27.65 Mb/s 1.6 GB / minute - Solutions
- Reduce Size, colors, sampling frequency
- Compress
- Complication real-time streaming
63Data Input Devices
- OCR optical character recognition
- Bar code readers
- Voice/audio input
- Punched cards
- Images / objects
- Pointing devices
pp. 69-86
64Punched Cards
- Invented by Herman Hollerith (founder of IBM)
- Each card holds 80 characters
65Data Input Devices
- OCR optical character recognition
- Bar code readers
- Voice/audio input
- Punched cards
- Images / objects
- Pointing devices
pp. 69-86
66Images
- Typically images are pictures that are optically
scanned and saved as a bit map or in some other
format - Many formats
- gif, jpeg,
67Typical Save As Dialog
68Types 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.)
69Bitmap 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)
70GIF format
Figure 3.10 GIF screen layout
71GIF image format
Figure 3.11 GIF file format layout
72Objects
- Images made of geometrically definable shapes
- Offer efficiency, flexibility, small size, etc.
73Object images Postscript, PDF
- Postscript
- Set of graphical statements
- Includes scalable fonts
- Advantages
- PDF
74Data Input Devices
- OCR optical character recognition
- Bar code readers
- Voice/audio input
- Punched cards
- Images / objects
- Pointing devices
pp. 69-86
75Pointing Devices
- Originally used for specifying coordinates (x, y)
for graphical input - Today used as general purpose device for
graphical user interfaces (GUIs)
76Data compression
- Many algorithms
- Types lossless, lossy
- Example of algorithm (compression 35, not good
for streaming) - Store repeated characters as (char, of
occurrences) - Replace repeated sequences by one value
- Examples ZIP, GIF (losslessly), Z, .gz, .tgz
- Losssy algorithms
- Can reduce the size by 10 times
- Example MPEG2 (compression ratio 1001)
77Representing Integer Data
477
666
( Subject has no point !! )
1
A99ACF
11011011011011
7652993002
3419
Book Chapter 4
78Representing Integers
- Basic definition
- Positive integers
- Adding binary numbers
- Turning addition into subtraction
- Twos complement
- Example
79Basic Definition
- An integer is a number which has no fractional
part.
Examples -2022 -213 0 1 666 54323434565
434
8032-bit Data Word
Figure 4.1 Storage of a 32-bit data word
81Ranges for Data Formats
82Positive Integers Examples
- All data must be stored as binary numbers
- Positive integers have direct conversion
- 000 0 001 1 010 2 011 3
- 100 4 101 5 110 6 111 7
83In General (binary)
Remember !!
84Signed Integers
- Previous examples were for unsigned integers
(positive values only!) - Must also have a mechanism to represent signed
integers (positive and negative values!) - E.g., -510 ?2
- Two common schemes 1) sign-magnitude
2) twos complement
85Sign-Magnitude
- Extra bit on left to represent sign
- 0 positive value
- 1 negative value
- E.g., 6-bit sign-magnitude representation of 5
and 5
86Ranges (revisited)
87In General (revisited)