Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computer Systems 1 Fundamentals of Computing

Similar presentations


Presentation on theme: "Computer Systems 1 Fundamentals of Computing"— Presentation transcript:

1 Computer Systems 1 Fundamentals of Computing
Data Representation Decimal, Binary, Hexadecimal

2 Data Representation Decimal (Base 10) Binary (Base 2)
Hexadecimal (Base 16) Computer Systems 1 ( )

3 Decimal Base 10 Numbers we use in everyday life
10 values then increment to next digit position on left 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Each position represents a value of 10, to the positions power Units (100), Tens (101), Hundreds (102), etc... ‘Ten fingers & ten toes’ Decimal numbers E.g.- 5 64281 -3564 Computer Systems 1 ( )

4 Binary Base 2 Commonly used in computers to represent data
Used for all calculations and logic test results 2 values, then increment next digit position on left 0 or 1 Each position represents a value of 2 to the positions power 20 (1), 21(2), 22 (4), 23 (8), 24 (16), etc… On or off (Digital) Binary numbers E.g.- 01 Computer Systems 1 ( )

5 Binary Bits ‘n’ Bytes A bit is a single binary digit (1 or 0)
A kilobit (KB) is 1024 bits A byte is eight bits Four bits are sometimes called a nibble A kilobyte (Kb) is 1024 bytes A megabyte (Mb) is 1024 kilobytes A gigabyte (Gb) is 1024 megabytes A terabyte (Tb) is 1024 gigabytes Computer Systems 1 ( )

6 Padding, Cladding and Loft Insulation (?!?)
Often when writing binary values we will use a notation method called ‘padding’ This involves padding a value with zeros on the left up to the nearest byte size Extra zeros become insignificant Makes reading and working with values easier The first 1 encountered on the left is most significant bit (MSB) The last 1 on the furthest right is least significant bit (LSB) Example Binary number 1011 Padded to a byte = Binary 010 Padded to a byte = This could have originally been just ‘10’ too! Computer Systems 1 ( )

7 Converting Decimal & Binary
To convert decimal to binary: If the decimal number is ODD, write a ‘1’ on the far right hand side OR if the decimal number is EVEN, write a ‘0’ on the far right hand side Divide the decimal number by TWO If there is a remainder then ignore it If the number you have is ODD, write a ‘1’ to the left of the previous digit OR if the number is EVEN, write a ‘0’ to the left of the previous digit Repeat until your decimal number is 0 Computer Systems 1 ( )

8 Converting Decimal & Binary
Decimal ’15’ = ODD = 15/2 = 7.5 = 7 = ODD = 11 7/2 = 3.5 = 3 = ODD = 3/2 = 1.5 = 1 = ODD = 1111 Binary ‘1111’ = Decimal ’15’ !!!! We can ‘pad’ our binary number with 0’s Eg: Decimal ’32’ = EVEN = 32/2 = 16 = EVEN = 16/2 = 8 = EVEN = 8/2 = 4 = EVEN = 4/2 = 2 = EVEN = 2/2 = 1 = ODD = Binary ‘100000’ = Decimal ’32’ !!!! Eg: Computer Systems 1 ( )

9 Converting Binary & Decimal
To convert binary to decimal: Write out the binary number Add the positional values to each digit Where there is a ‘1’ below the positional value highlight that positional value Once all 1’s in the binary number have highlighted their positional values Add all highlighted values together Positional values: These values can of course increase Doubled with each positional move left Computer Systems 1 ( )

10 Converting Binary & Decimal
E.g.- Binary number: Add positional values: Highlight the positional values Add the highlighted values together: = 27 So Binary = Decimal 27 !! Computer Systems 1 ( )

11 Hexadecimal Base 16 Another common format for data representation
Easy to map against binary Used to easily represent large numbers Common usage is memory locations 16 values then increment next digit on left position 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F Each position represents a value of 16 to the positions power 160 (1), 161 (16), 162 (256), 163 (4096), 164 (65536), etc… Hexadecimal numbers E.g- 5 10 FF FB 19 Computer Systems 1 ( )

12 Hexadecimal Values DECIMAL HEXADECIMAL
A B C D E F DECIMAL HEXADECIMAL Computer Systems 1 ( )

13 Converting Decimal & Hexadecimal
To convert decimal to hexadecimal: Write out the decimal number Write out the hexadecimal positional values Find the largest hex positional value that your decimal number will divide into Divide your decimal number by that hex positional value Take the answer( ignore the remainder) and add it to the left hand side of your hex answer multiply this number by it’s positional value and then subtract it from your decimal number Take what’s left of your decimal number and repeat the process until you have nothing left We can also pad out Hex values with zeros if we want too! Computer Systems 1 ( )

14 Converting Decimal & Hexadecimal
E.g.- Decimal 280 Write Hex positional values Divide 280 by 256 (=1) Multiply 1 by 256 (=256) Subtract 256 from 280 ( =24) Divide 24 by 16(=1) Multiply 1 by 16 (=16) Subtract 16 from 24 (24-16=8) Divide 8 by 1 (=8) Write in the 8 Hex number = 118 Computer Systems 1 ( )

15 Converting Hexadecimal & Decimal
To convert hexadecimal to decimal: Write out the hexadecimal number Add the positional values to each digit Where there is a value greater than ‘0’ below the positional value highlight that positional value Once all positional values have been highlighted, multiply the number below, by it’s positional value Add all results of highlighted values together Positional values: These values can of course increase to the power of 16 Computer Systems 1 ( )

16 Converting Hexadecimal & Decimal
E.g.- Hex number 4C Add positional values C Highlight positional values Multiply positional values by the number below 4*16 = 64 C*1 = 12*1 = 12 Add these together 64+12=76 Computer Systems 1 ( )

17 Notation of Numerical Values
Very often we will have to write many different base value numbers Performing calculations or comparisons For easy reading, the following conventions are used: Decimal Will either appear with no special notation or with a subscript ‘10’ after the number e.g or 36510 Binary Using subscript ‘2’ after the number e.g Hexadecimal Using a subscript ‘16’ after the number, of a prefix ‘0x’ e.g.- 4D16 or 0x4D Computer Systems 1 ( )

18 CS1: Week 3 What you know now: Hexadecimal Decimal principles Binary
Method Notation Bits, bytes, etc. Conversion Hexadecimal Computer Systems 1 ( )


Download ppt "Computer Systems 1 Fundamentals of Computing"

Similar presentations


Ads by Google