Presentation is loading. Please wait.

Presentation is loading. Please wait.

Basic Logic 2.1 Basic Digital Logic 2 Numbering Systems ©Paul Godin Created Aug 2007 Updated Aug 2013 gmail.com.

Similar presentations


Presentation on theme: "Basic Logic 2.1 Basic Digital Logic 2 Numbering Systems ©Paul Godin Created Aug 2007 Updated Aug 2013 gmail.com."— Presentation transcript:

1 Basic Logic 2.1 Basic Digital Logic 2 Numbering Systems ©Paul Godin Created Aug 2007 Updated Aug 2013 prgodin @ gmail.com

2 Basic Logic 2.2 Numbering Systems Binary numbers represent a value, and it is important to express these into values that we understand. Binary numbers need to be converted to decimal and hexadecimal values to make them easier to describe and understand.

3 Basic Logic 2.3 Converting Binary to Decimal Each position represents a “weight” 2 5 +2 4 +2 1 = 32+16+2 = 50 in decimal 110010 2 2020 2121 2 2323 2424 2525 Each position has a weight that is a factor of 2. Add all positions that have a binary “1” (ignore “0”)

4 Basic Logic 2.4 Short-Cuts ◊You may be able to calculate some values in your head if you remember the weight of each position: _ _ _ _ _ 201201 2 7 128 2 224224 238238 2 4 16 2 5 32 2 6 64 212212 2 8 256 2 9 512

5 Basic Logic 2.5 Short-Cuts Examples Value remembered 0010 = 2 1000 = 8 10000 = 16 Value determined through remembered value. 0011 is one more than 0010 0011 = 2 +1 = 3 1011 is three more than 1000 1011 = 8 +3 = 11 01111 is one less than 10000 01111 = 16 - 1 = 15 0011 1011 1111 Number

6 Basic Logic 2.6 Exercise 1 0101 = _________ 1001 = _________ 10101 = ________ 110 = ___________ 11011 = _________ 1011011 = ________ Convert the following Binary numbers to Decimal:

7 Basic Logic 2.7 Converting Decimal to Binary Powers of 2 Method Powers of 2: The decimal value is successively reduced by the largest power of 2 that will fit. 57 – 32 = 2532 is position #6 _ _ _ 25 – 16 = 916 is position #5 9 – 8 = 18 is position #4 1 – 1 = 01 is position #1 Example: Convert 57 to binary Blank positions become 0 1 1 1 1 0 0 Animated

8 Basic Logic 2.8 Converting Decimal to Binary Division by 2 Method Division by 2: The decimal value is successively divided by 2 and the remainder is recorded. 57 ÷ 2 = 28, remainder 1 _ _ _ 28 ÷ 2 = 14, remainder 0 Example: Convert 57 to binary 1 1 1 1 0 0 Animated 14 ÷ 2 = 7, remainder 0 7 ÷ 2 = 3, remainder 1 3 ÷ 2 = 1, remainder 1 1 ÷ 2 = 0, remainder 1

9 Basic Logic 2.9 Exercise 2 12 = _________ 17 = _________ 124 = ________ 8 = ___________ 33 = _________ 155 = ________ Convert the following Decimal numbers to Binary:

10 Basic Logic 2.10 Converting Hexadecimal to Decimal Each position represents a “weight” 11x16 3 + 0 + 3x16 1 + 2x16 0 = B032 16 16 0 16 1 16 2 16 3 Each position has a weight that is a factor of 16. Multiply the value (converted to decimal) by its weight. 11 x 4096 + 3x16 + 2x1 = 45,056 + 48 + 2 = 45,106

11 Basic Logic 2.11 Converting Decimal to Hexadecimal Division by 16 Method Division by 16: The decimal value is successively divided by 16 and the remainder is recorded. 45,106 ÷ 16 = 2819, remainder 2 _ _ 2819 ÷ 16 = 176, remainder 3 Example: Convert 45,106 10 to Hexadecimal B 2 0 3 Animated 176 ÷ 16 = 11, remainder 0 11 ÷ 16 = 0, remainder 11

12 Basic Logic 2.12 Exercise 3 12 10 = _________ 16 17 10 = _________ 16 124 10 = ________ 16 18 16 = ___________ 10 3B 16 = _________ 10 ABC 16 = ________ 10 Convert the following numbers:

13 Basic Logic 2.13 Converting Hexadecimal to Binary The Hexadecimal numbering system is used because of the ease converting between it and a 4-bit binary value. Each digit is converted to Decimal then converted to Binary. Example: Convert B032h to Binary B032 16 _ _ 11 10 0 10 3 10 2 10 0 1 1 0 _ _ 0 1 0 0 0 0 0 0 1 01 1 2

14 Basic Logic 2.14 Converting Binary to Hexadecimal To convert from Binary to Hexadecimal, convert each grouping of 4 bits to Decimal, then to a Hexadecimal digit. Example: Convert 1011 0000 0011 0010 to Hexadecimal B032 16 11 10 0 10 3 10 2 10 0 1 1 0 0 1 0 0 0 0 0 0 1 01 1 2

15 Basic Logic 2.15 Counting in Binary 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111

16 Basic Logic 2.16 Binary Counting When counting up, 1 is added to the current state to determine the next state. In Binary, when adding “1” to a “1”, the result is “10” (zero and carry the one). Example:

17 Basic Logic 2.17 Adding in Binary ◊Example: 1101 +0101 1101 +0101 0 1 1101 +0101 10 1 1101 +0101 010 1 1 1101 +0101 10010 1 1

18 Basic Logic 2.18 Adding in Binary 101 +011 1 + 1 = 10 0 1 Carry 1 1 + 1 = 10 0 1 Carry 1 1 + 1 = 10 0 1 1 Carry 1 Animated

19 Basic Logic 2.19 Binary Codes ◊Binary numbers are used to represent values such as alphanumeric characters. ◊One encoding system is ASCII, a standard that defines the representation of an alphanumeric character using binary. ◊Example: The letter A in Binary is 100 0001 Note ASCII code is 7 bit but there are several 8 bit codes available.

20 Basic Logic 2.20 Exercise Determine what the following says (7-bit ASCII) : 0100100100100000010101110110100101101110 00100001 Google for it.

21 Basic Logic 2.21 Grey Code When counting in Binary there are instances where two or more bits change at the same time. Examples: 001 to 010, 011 to 100. In mechanical systems, such as those using an encoding wheel, it is desirable to have just one bit change at a time to allow for more uniform transitions with rotation. In Digital Electronic communications, these multi-bit changes may interfere with one another. Encoder Disk (Wikipedia - PD)

22 Basic Logic 2.22 Grey Code 000 001 011 010 110 111 101 100 00 01 11 10 0000 0001 0011 0010 0110 0111 0101 0100 1100 1101 1111 1110 1010 1011 1001 1000 2-bit Grey Code 4-bit Grey Code 3-bit Grey Code We will be using Grey Code later this semester.

23 Basic Logic 2.23 END ©Paul R. Godin prgodin ° @ gmail.com


Download ppt "Basic Logic 2.1 Basic Digital Logic 2 Numbering Systems ©Paul Godin Created Aug 2007 Updated Aug 2013 gmail.com."

Similar presentations


Ads by Google