Sie sind auf Seite 1von 26

ME4447/6405

ME 4447/6405
Microprocessor Control of Manufacturing Systems and Introduction to Mechatronics

Instructor: Professor Charles Ume Lecture #6


GeorgeW. W.Woodruff WoodruffSchool Schoolof ofMechanical MechanicalEngineering, Engineering,Georgia GeorgiaTech Tech George

ME4447/6405

GeorgeW. W.Woodruff WoodruffSchool Schoolof ofMechanical MechanicalEngineering, Engineering,Georgia GeorgiaTech Tech George

ME4447/6405

Hexadecimal Base 16
1 11 21 2 12 22 3 13 23 4 14 24 5 15 25 6 16 26 7 17 27 8 18 28 9 A B C D E F 10 20 30

19 1A 1B 1C 1D 1E 1F 29 2A 2B 2C 2D 2E 2F

GeorgeW. W.Woodruff WoodruffSchool Schoolof ofMechanical MechanicalEngineering, Engineering,Georgia GeorgiaTech Tech George

ME4447/6405

Octal Base 8
1 11 21 2 12 22 3 13 23 4 14 24 5 15 25 6 16 26 7 17 27 10 20 30

GeorgeW. W.Woodruff WoodruffSchool Schoolof ofMechanical MechanicalEngineering, Engineering,Georgia GeorgiaTech Tech George

ME4447/6405

Conversion from base 10 base 16 base 2 and back base 10


Example 1: 67410

42 16 674
-64 -

2 16 42
- 32

0 16 2

34 32 2

10

Remainder 2

Remainder A

Remainder 2

Read Remainders backwards Therefore, 67410 = 2A216 = 0010 1010 0010

Read

GeorgeW. W.Woodruff WoodruffSchool Schoolof ofMechanical MechanicalEngineering, Engineering,Georgia GeorgiaTech Tech George

ME4447/6405

Example 1 Contd

2A216 to base 10: = 2 x 160 + A x 161 + 2 x 162 = 67410 0010 1010 00102 to base 10: =0 x 20 + 1 x 21 + 0 x 22 + 0 x 23 +0 x 24 + 1 x 25 + 0 x 26 + 1 x 27 +0 x 28 + 1 x 29 + 0 x 210 + 0 x 211 =67410George W. Woodruff School of Mechanical Engineering, Georgia Tech
George W. Woodruff School of Mechanical Engineering, Georgia Tech

ME4447/6405

Conversion from base 10 to 2


This method known as repeated division by 2. Example 2: Convert 3710 to base 2.

18 2 37 9 2 18

Remainder 1

Remainder 0

4 29

2 2 4 1 2 2
0 21

Remainder 0 Remainder 0

Remainder 1

Remainder 1

Read

Stop dividing when the answer is 0. The remainders are read in reverse order to form the answer. Therefore, 3710 = 00100101 = 2516 (Note: 2 front bits added for 8-bit processor) GeorgeW. W.Woodruff WoodruffSchool Schoolof ofMechanical MechanicalEngineering, Engineering,Georgia GeorgiaTech Tech George

ME4447/6405

Example 2 Contd

Note: 3710 = 7 x 100 + 3 x 101 = 7 + 30 = 37 Therefore, 1001012 = 1 x 20 + 0 x 21 + 1 x 22 + 0 x 23 + 0 x 2 4 + 1 x 2 5 + 0 x 26 + 0 x 2 7 = 1 + 0 + 4 + 0 + 0 +32 + 0 + 0 = 3710


GeorgeW. W.Woodruff WoodruffSchool Schoolof ofMechanical MechanicalEngineering, Engineering,Georgia GeorgiaTech Tech George

ME4447/6405

Example 3

Convert 110.1112 to the decimal system Solution: 110.1112 = (1 x 2-3) + (1 x 2-2) + (1 x 2-1) + (0 x 20) + (1 x 21) + (1 x 22) = 0.125 + 0.25 + 0.5 + 2 + 4 = 6.87510
GeorgeW. W.Woodruff WoodruffSchool Schoolof ofMechanical MechanicalEngineering, Engineering,Georgia GeorgiaTech Tech George

ME4447/6405

Example 4

Convert 2A2.516 to the decimal system Solution: 2A2.5 = (5 x 16-1) + (2 x 160) + (A x 161) + (2 x 162) = 0.3125 + 2 +160 +512 = 674.3125
GeorgeW. W.Woodruff WoodruffSchool Schoolof ofMechanical MechanicalEngineering, Engineering,Georgia GeorgiaTech Tech George

ME4447/6405

Example 5

Convert 0.7510 to Binary Solution: 0.75 x 2 = 1.50 1 0.50 x 2 = 1.00 1 Therefore, 0.7510 = 0.112
GeorgeW. W.Woodruff WoodruffSchool Schoolof ofMechanical MechanicalEngineering, Engineering,Georgia GeorgiaTech Tech George

Read

ME4447/6405

Example 6

Convert 0.301710 to Binary Solution: 0.3017 x 2 = 0.6034 0.6034 x 2 = 1.2068 0.2068 x 2 = 0.4136 0.4136 x 2 = 0.8272

0 1 0 0

Read

Therefore, 0.301710 = 0.0100


GeorgeW. W.Woodruff WoodruffSchool Schoolof ofMechanical MechanicalEngineering, Engineering,Georgia GeorgiaTech Tech George

ME4447/6405

The circuitry required for computers to add binary numbers is relatively simple. However, since circuitry to subtract binary numbers is very difficult to design and build, another subtraction method would be desirable. The method is subtraction by addition of the 1s or 2s complements of the number. Subtraction by the addition of 1s complement requires much more hardware to implement. Most computers on the market perform subtraction by the addition of 2s complement. Therefore we will concentrate only on subtraction by 2s complement. Binary number 1s complement 2s complement = = = 1011 1001 0100 0110 0100 0111

When subtraction is performed the answer can be positive or negative, depending upon the relative values of the minuend and subtrahend. We must, therefore, in some way account for the sign of the answer.

GeorgeW. W.Woodruff WoodruffSchool Schoolof ofMechanical MechanicalEngineering, Engineering,Georgia GeorgiaTech Tech George

ME4447/6405

The most significant bit (MSB) is used as the sign bit. If the MSB is a 1, the number represented by the remaining 7 bits is assumed to be negative and is represented by its 2s complement. If the MSB is a 0, the number represented in the remaining seven bits is positive and is equal to the binary equivalent of these seven bits. Example 1: 1710 610=(1116 616) 0000 0110 = 616 1111 1001 = 1s complement of 616 1111 1010 = 2s complement of 616 0001 0001 = 1116 1111 1010 = 616 in 2s complement ------------1 0000 1011 1 0000 1011 = + 0B16 = + 1110 GeorgeW. W.Woodruff WoodruffSchool Schoolof ofMechanical MechanicalEngineering, Engineering,Georgia GeorgiaTech Tech George

ME4447/6405

Example 2:

610 1710 = (616 1116) 0001 0001 = 1116 1110 1110 = 1s complement of 1116 1110 1111 = 2s complement of 1116 0000 0110 = 616 1110 1111 = 1116 in 2s complement -----------1111 0101 1111 0101 = - (0000 1010 + 1) = - 0000 1011 = - 0B16 or - 1110

Note: C and N bits will be set. C is set to 1 because the absolute value of subtraction (17) Is larger than the absolute value of the minuend (6)

GeorgeW. W.Woodruff WoodruffSchool Schoolof ofMechanical MechanicalEngineering, Engineering,Georgia GeorgiaTech Tech George

ME4447/6405

Since bit 7 serves as the sign bit. A 0 in bit 7 indicates a positive number. Thus the maximum positive number an 8-bit processor can represent in 2s complement is 0111 11112 or 7F16 or 12710. Likewise a 1 in bit 7 indicates a negative number. The minimum negative number that an 8-bit processor can represent in 2s complement is 8016 (1000 0000). In binary it is 2s complement of 1000 0000 = - 1000 0000 = - 8016 = -12810 Its 2s complement is (0111 1111 + 1) = - (1000 0000) = - 8016 = - 12810 It is possible to (add) or subtract two numbers and get invalid answer, especially when the answer is out of the range of 128 +127 This situation is referred to as 2s complement overflow. If a subtraction (or addition) is performed and 2s complement overflow occurs the V bit will be set to a 1 otherwise it will be cleared. GeorgeW. W.Woodruff WoodruffSchool Schoolof ofMechanical MechanicalEngineering, Engineering,Georgia GeorgiaTech Tech George

ME4447/6405

Example 3:

- 8510 - 9010= -17510 8510 = 5516 = 0101 01012 1010 1010 = 1s comp. of 5516 1010 1011 = 2s comp. of 5516 9010 = 5A16 = 0101 10102 1010 0101 = 1s comp. of 5A16 1010 0110 = 2s comp. of 5A16 1010 1011 = (2s comp. of 5516) 1010 0110 = (2s comp. of 5A16) ------------1 0101 0001 = +5116 = +8110

V bit will be set. C bit will be set.

GeorgeW. W.Woodruff WoodruffSchool Schoolof ofMechanical MechanicalEngineering, Engineering,Georgia GeorgiaTech Tech George

ME4447/6405

Example 4: 4D16 + 6616 01001101 01100110 -------------10110011 V bit is set. positive positive negative

GeorgeW. W.Woodruff WoodruffSchool Schoolof ofMechanical MechanicalEngineering, Engineering,Georgia GeorgiaTech Tech George

ME4447/6405

GeorgeW. W.Woodruff WoodruffSchool Schoolof ofMechanical MechanicalEngineering, Engineering,Georgia GeorgiaTech Tech George

ME4447/6405

Logic Gates

Why do we study Logic Gates?


Used to Determine Status or Occurrence of Events

GeorgeW. W.Woodruff WoodruffSchool Schoolof ofMechanical MechanicalEngineering, Engineering,Georgia GeorgiaTech Tech George

ME4447/6405

AND Function Symbol

Input A 0 0 1 1

Input B 0 1 0 1

Output C 0 0 0 1

Equation

C=AB
GeorgeW. W.Woodruff WoodruffSchool Schoolof ofMechanical MechanicalEngineering, Engineering,Georgia GeorgiaTech Tech George

ME4447/6405

OR Function Symbol

Input A 0 0 1 1

Input B 0 1 0 1

Output C 0 1 1 1

Equation

C=A+B
GeorgeW. W.Woodruff WoodruffSchool Schoolof ofMechanical MechanicalEngineering, Engineering,Georgia GeorgiaTech Tech George

ME4447/6405

Exclusive OR Function (XOR) Symbol

Input A 0 0 1 1

Input B 0 1 0 1

Output C 0 1 1 0

Equation

C=A+B
GeorgeW. W.Woodruff WoodruffSchool Schoolof ofMechanical MechanicalEngineering, Engineering,Georgia GeorgiaTech Tech George

ME4447/6405

Not Function (Inverter) Symbol

Input A 0 1

Output C 1 0

Equation

C=A
GeorgeW. W.Woodruff WoodruffSchool Schoolof ofMechanical MechanicalEngineering, Engineering,Georgia GeorgiaTech Tech George

ME4447/6405

NOR Function Input A 0 0 1 1 Input B 0 1 0 1 Output C 1 0 0 0

NAND Function Input A 0 0 1 1 Input B 0 1 0 1 Output C 1 1 1 0

GeorgeW. W.Woodruff WoodruffSchool Schoolof ofMechanical MechanicalEngineering, Engineering,Georgia GeorgiaTech Tech George

ME4447/6405

QUESTIONS???

GeorgeW. W.Woodruff WoodruffSchool Schoolof ofMechanical MechanicalEngineering, Engineering,Georgia GeorgiaTech Tech George

Das könnte Ihnen auch gefallen