130 likes | 259 Views
Data Representation – Chapter 3. Section 3-1. Terminology. “Digital” Discrete, well defined values/steps Opposite of analog Analogy: digital is to analog as int is to double “Binary” A system consisting of two states on/off, true/false, yes/no, high/low, 0/1 Basis for modern computers.
E N D
Data Representation – Chapter 3 Section 3-1
Terminology • “Digital” • Discrete, well defined values/steps • Opposite of analog • Analogy: digital is to analog as int is to double • “Binary” • A system consisting of two states • on/off, true/false, yes/no, high/low, 0/1 • Basis for modern computers
Terminology • “Bit” • Binary-digit • Smallest unit of storage in modern computers
Data Representation • 1000001 – what does this “mean”? • one million, one • sixteen million, seven hundred seventy seven thousand, two hundred, seventeen • two hundred sixty two thousand, one hundred forty five • sixty five • “A” • AJMP assembly language instruction
Data Representation • 1000001 • Decimal number • Hexadecimal number • Octal number • Binary number • ASCII character • 8051 machine instruction
Number Systems • A number system is defined by its base or radix • The number of unique digits used in the system • Digits range in value from 0 to radix-1 • Larger values are created by stringing together digits • Resultant value is defined by • d: digit, b: base, i: position with 0 being the first position to the left of the “base point”, increasing to the left, decreasing to the right
Number Systems • Binary is convenient/efficient for use in a computer… • Electronic circuits can be easily designed to deal with two distinct levels • e.g. TTL 0-volts and 5-volts • … but extremely inconvenient for human consumption • Humans were designed to work with ten distinct levels • e.g. fingers • We’ll concentrate on decimal, hexadecimal, octal, and binary
Conversion • Base b to decimal, b = 2 (binary) • Decimal to base b • Integer divide value by b • Output remainder • Repeat on quotient • Until quotient is zero
Conversion • Binary to octal • Separate binary number into groups of 3 binary digits padding the left with 0’s if necessary • Convert groups to decimal digits 10012 -> 001001 -> 118
Conversion • Binary to hexadecimal • Separate binary number into groups of 4 binary digits padding the left with 0’s if necessary • Convert groups to decimal digits 10102 -> 1010 -> 1016(?) • Not exactly • 1010—1510 -> A16—F16 • i.e. 0123456789ABCDEF
Conversion • Octal to hexadecimal and hexadecimal to octal • Convert to binary then to the target radix using previous methods
Conversion • Octal and hexadecimal are useful when working closely with the architecture • Designing circuits • Designing device interfaces • Writing assembly language programs • In such situations one is generally concerned with bit patterns rather than the decimal value • The conversions can be done in your head
Homework – chapter 3 • 3-1, 3-2, 3-3, 3-4, 3-5, 3-6, 3-7, 3-8 • Due Thursday • Will discuss in class