570 likes | 767 Vues
Chapter 1 Introduction to Computers. Maran Illustrated Computers CIS 102. Hardware. Software. Getting Help. How Computers Work in General. Input devices. Process (CPU). Output. Storage device. Data representation in Bytes. Computer Memory.
E N D
Chapter 1 Introduction to Computers Maran Illustrated Computers CIS 102
Computer Memory • Memory is comprised of a large collection of bi-state (off/on) electrical devices called bits (binary digits) • A single bit can assume the value 0 or 1. • A single bit is not sufficient to represent all data ; therefore, it is necessary to use a sequence of bits.
Computer Memory • How many bits are needed in a bit pattern to represent a symbol in a language? • A bit pattern of size 1 can represent two different pieces of information. For example, to represent pass / fail we could use 0 - Fail 1 - Pass
Binary system • The binary system is based on 2. • There are only two digits: 0 and 1 • We convert a number from binary to decimal by multiplying each binary digit by its corresponding power of 2. i.e. Multiply the bit at position n (n = 0, 1, 2, …) by
Figure 3-1 Decimal system
Figure 3-2 Binary system
Binary system Binary to Decimal Conversion Binary number
Figure 3-3 Binary to decimal conversion
Exercises • Convert the binary number 10011 to decimal. • Convert the binary number 1110101 to decimal.
Example 1 Convert the binary number 10011 to decimal. Solution Write out the bits and their weights. Multiply the bit by its corresponding weight and record the result. At t Write out the bits and their weights. Multiply the bit by its corresponding weight and record the result. At the end, add the results to get the decimal number. Binary 1 0 0 1 1Weights 16 8 4 2 1 ------------------------------------- 16 + 0 + 0 + 2 + 1
Exercises • Convert the decimal number 35 to binary. • Convert the decimal number 327 to binary.
Octal Digit------------ 0 1 2 3 Bit Pattern------------ 000 001 010 011 100 101 110 111 4 5 6 7 Base 8 (Octal ) Valid digits: 0, 1, 2, 3, 4, 5, 6, 7
Bit Pattern------------ 0000 0001 0010 0011 0100 0101 0110 0111 Hex Digit------------ 0 1 2 3 4 5 6 7 Bit Pattern------------ 1000 1001 1010 1011 1100 1101 1110 1111 Hex Digit------------ 8 9 A B C D E F Base 16 - Hexadecimal Valid digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
Converting from base 2 to hexadecimal • To convert from base 2 to hexadecimal • Organize the stream of binary digits into groups of four. • Find the hexadecimal value for each group of 4 bits. 10010010111000011010 1001 0010 1110 0001 1010 9 2 E 1 A
Converting from hexadecimal to base 2 • To convert from hexadecimal (base 16) to base 2 Convert each digit to its 4-bit equivalent. 9 2 E 1 A 1001 0010 1110 0001 1010
Binary to hexadecimal and hexadecimal to binary transformation
Exercises • Show the hexadecimal equivalent of the bit pattern 1100 1110 0010. • Show the hexadecimal equivalent of the bit pattern 0011100010. • What is the bit pattern for 2675 base 16? • What is the bit pattern for B51E base 16?
Review number systems • Review base 10 • Review base 2 (binary) • Review base 16 (hexadecimal) • Convert from decimal to binary • Convert from binary to decimal • Convert between binary and Hexadecimal • See notes for links covering these topics