Download presentation
Presentation is loading. Please wait.
Published byBennett Ellingsworth Modified over 9 years ago
1
EE1A2 Microprocessor Systems & Digital Logic Part I Digital Electronic System Design Dr. T. Collins
2
Content Binary Arithmetic Addition and subtraction. Arithmetic circuits. Arithmetic Logic Units Micro-Controllers Micro-controller architecture. Essential building blocks of a computer. Programming…
3
Binary Arithmetic Number Systems Decimal Binary Hexadecimal Addition Long addition Full adder circuits Parallel adders Carry-look-ahead circuitry Subtraction Two’s complement Subtraction using a parallel adder
4
Arithmetic Logic Units Adder-Subtraction Circuit Combining addition and subtraction in a single controllable circuit Arithmetic Logic Units General-purpose arithmetic and logic ‘calculation’ units Registers How memory circuits can simplify the connections to an ALU
5
The Anatomy of a Micro-Controller Tri-State Ports and Busses How a ‘bus’ can interconnect many different registers without huge wiring difficulties. Connecting an ALU to a Bus The Building Blocks of a Computer ALU Registers I/O Ports Program Memory Programs
6
Number Systems – Decimal Base 10 Ten digits, 0-9 Columns represent (from right to left) units, tens, hundreds etc. 123 1 10 2 + 2 10 1 + 3 10 0 or 1 hundred, 2 tens and 3 units
7
Bases When counting upwards in base-10, we increase the units digit until we get to 10 when we reset the units to zero and increase the tens digit. So, in base-n, we increase the units until we get to n when we reset the units to zero and increase the n-s digit. Consider hours-minutes-seconds as an example of a base-60 number system: Eg. 12:58:43 + 00:03:20 = 13:02:03 NB. The base of a number is often indicated by a subscript. E.g. (123) 10 indicates the base-10 number 123.
8
Binary Base 2 Two digits, 0 & 1 Columns represent (from right to left) units, twos, fours, eights etc. 1111011 1 2 6 + 1 2 5 + 1 2 4 + 1 2 3 + 0 2 2 + 1 2 1 + 1 2 0 = 1 64 + 1 32 + 1 16 + 1 8 + 0 4 + 1 2 + 1 1 = 123
9
Binary Numbers Terminology Each digit in a binary number is known as a “bit”. A group of eight bits makes a binary number known as a “byte”. A group of more than eight bits is known as a “word”. Typical word lengths – 12, 16, 32, 64.
10
Decimal to Binary Conversion 123 2=61remainder 1 61 2=30remainder 1 30 2= 15 remainder 0 15 2= 7remainder 1 7 2= 3remainder 1 3 2= 1remainder 1 1 2= 0remainder 1 Least significant bit (rightmost) Most significant bit (leftmost) Answer : (123) 10 = (1111011) 2 Example – Converting (123) 10 into binary
11
Two’s Complement One byte (eight bits) can be used to represent the decimal number range 0 to 255 (unsigned) -128 to 127 (signed) Negative binary numbers are formed by subtracting from a number one greater than the maximum possible (i.e. 2 n or 256 for a byte) For example, (123) 10 = (01111011) 2 (-123) 10 = (10000101) 2 = (133) 10 = (256-123) 10
12
Frequently Asked Question So how can you tell the difference between: (-123) 10 = (10000101) 2 and (133) 10 = (10000101) 2 You can’t unless you know whether you’re using signed or unsigned arithmetic:
13
Hexadecimal Base 16 Sixteen digits, 0-9 and A-F (ten to fifteen) Columns represent (from right to left) units, 16s, 256s, 4096s etc. 7B 7 16 1 + 11 16 0 = 123
14
Decimal to Hex Conversion 123 16=7remainder 11 (or B) 7 16=0remainder 7 Answer : (123) 10 = (7B) 16 Converting (123) 10 into hex
15
Binary to Hex / Hex to Binary Even very long numbers can be converted easily, treating each hex digit independently. 0111 1011 7 B 1011 1001 0110 1111 1010 B 9 6 F A E.g. Each group of four binary bits maps on to a single hex digit.
16
Binary Arithmetic - Addition Binary long addition works just like decimal long addition. 100111 001110 0 1 0 1 1 0 1 1 1 0 0 1 + Carried digits Result
17
Full Adder Each column of the sum has three inputs Digits from the two numbers to add (A and B) Carry bit from previous column It also has two outputs Result bit Carry bit to next column These are the logical operations performed by a full adder circuit. Full Adder B A C IN C OUT SUM
18
Parallel Adder To add two n-bit numbers together, n full-adders should be cascaded. Each full-adder represents a column in the long addition.
19
Summary In digital electronics, numbers are represented using base-2 (binary). Base-16 (hex) is often used by human programmers as binary to hex conversion is very easy. Binary numbers may be unsigned or signed (two’s complement). Binary addition works in a similar way to decimal long addition. Almost all of this should be just revision… … if not, make full use of the tutorial.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.