Download presentation
Presentation is loading. Please wait.
Published byPeregrine Wilkinson Modified over 8 years ago
1
Number systems Jaana Holvikivi Metropolia
2
Result AND000 100 010 111 OR000 101 011 111 NOT1 0 0 1 Logical operations Boolean algebra Operations &&AND ||OR !NOT / NEGATION/ FALSE 0FALSE 1TRUE 1.10.2012Jaana Holvikivi2
3
Binary, Octal and Hexadecimal notation 2 4 =16 BinaryOctalDecimalHexadecimal 0001 0010 0011 0100 0101 0110 0111 1000 1 2 3 4 5 6 7 10 1234567812345678 1234567812345678 1001 1010 1011 1100 1101 1110 1111 11 12 13 14 15 16 17 9 10 11 12 13 14 15 9ABCDEF9ABCDEF 10000201610 1.10.2012Jaana Holvikivi3
4
Decimal and binary systems Decimal system 10 0 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 1 10, 11, 12, 13,... 357=3* 10 2 +5* 10 1 +7* 10 0 Binary system 2 0 0, 1, 2 1 10, 11, 2 2 100, 101, 110, 111, 2 3 1000, 1001,... 1011= 1* 2 3 + 0* 2 2 +1* 2 1 +1* 2 0 1.10.2012Jaana Holvikivi4
5
Binary and Hexadecimal notation Each 4 bits are equal to hexadecimal number: 1011110111 First grouping: 10 1111 0111 Conversion by group: 10 => 2 and 1111 => F and 0111 => 7 The result is 2F7 Examples: 0101 1010 =? 1010 0100 0110 0000 1110 1011 0001 0011 =? Convert to binary: ABCD; 610A 1.10.2012Jaana Holvikivi5
6
RGB color codes RGB(255, 255, 255) #FFFFFF RGB(0,0,0)#000000 #0000FF #008000 1.10.2012Jaana Holvikivi6
7
Practice Boolean operations AND, & with 8 bit numbers, b means binary 1. a = 255 & 15 = 1111 1111b & 0000 1111b 2. a = 255 & 1 = 1111 1111b & 0000 0001b 3. a = 2 & 1 = 0000 0010b & 0000 0001b 4. a = 3 & 1 = 0000 0011b & 0000 0001b 5. a = 3 & 2 = 0000 0011b & 0000 0010b OR, operator | 1. a = 0 | 1 = 0000 0000b | 0000 0001b 2. a = 2 | 1 = 0000 0010b | 0000 0001b 3. a = 4 | 8 = 0000 0100b | 0000 1000b 4. a = 4 | 12 = 0000 0100b | 0000 1100b Negation, operator ~ 1. a = 0 = 0000 0000; operation a = ~a; 2. a = 1 = 0000 0001; operation a =~a; 3. a = 12= 0000 1100; operation a = ~a; 4. a = 15= 0000 1111; operation a = ~a; 1.10.2012Jaana Holvikivi7
8
Boolean operations: solutions AND, & with 8 bit numbers, b means binary 1. a = 255 & 15 = 1111 1111b & 0000 1111b = 0000 1111b = 15 2. a = 255 & 1 = 1111 1111b & 0000 0001b = 0000 0001b = 1 3. a = 2 & 1 = 0000 0010b & 0000 0001b = 0000 0000b = 0 4. a = 3 & 1 = 0000 0011b & 0000 0001b = 0000 0001b = 1 5. a = 3 & 2 = 0000 0011b & 0000 0010b = 0000 0010b = 2 OR, operator | 1. a = 0 | 1 = 0000 0000b | 0000 0001b = 0000 0001b = 1 2. a = 2 | 1 = 0000 0010b | 0000 0001b = 0000 0011b = 3 3. a = 4 | 8 = 0000 0100b | 0000 1000b = 0000 1100b = 12 4. a = 4 | 12 = 0000 0100b | 0000 1100b = 0000 1100b = 12 1.10.2012Jaana Holvikivi8
9
More practice 1.10.2012Jaana Holvikivi9 Perform AND and OR operations to the following strings of bits: 00001111 00001111 AND 10101010 OR 10101010 11111111 11111111 AND00101101 OR00101101 Convert hexadecimal numbers to binary and decimal 5A FF 22
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.