Presentation is loading. Please wait.

Presentation is loading. Please wait.

Number Systems and Codes

Similar presentations


Presentation on theme: "Number Systems and Codes"— Presentation transcript:

1

2 Number Systems and Codes
3 Number Systems and Codes

3 Objectives Explain the decimal number system.
Explain integer numbers, fractional numbers, and real numbers. Describe the binary number system. Convert decimal numbers to binary and vice versa. Perform binary math operations such as add, subtract, multiply, and divide. © Goodheart-Willcox Co., Inc.

4 Objectives Explain the hexadecimal number system.
Convert binary numbers to hexadecimal numbers and vice versa. Explain the octal number system. Convert binary numbers to octal numbers and vice versa. Explain the binary coded decimal number system and its use. © Goodheart-Willcox Co., Inc.

5 Objectives Convert decimal numbers to binary coded decimal.
Explain the Gray code number system and its use. Explain ASCII and EBCDIC alphanumeric codes. © Goodheart-Willcox Co., Inc.

6 Decimal Number System Decimal number system:
Has ten (10) digits running from zero (0) through nine (9). Decimal digits are 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. Each digit's value depends on the position of the digit within the number. © Goodheart-Willcox Co., Inc.

7 Decimal Number System (Cont.)
Base, also called the radix: Multipliers for the digits are numbers constructed of the number system (10 in the decimal system) raised to the appropriate power. 10a 10 = Base or radix a = Power © Goodheart-Willcox Co., Inc.

8 Decimal Number System (Cont.)
Values for the power of ten (10) numbers. © Goodheart-Willcox Co., Inc.

9 Decimal Number System (Cont.)
Example: 6310 = (6 × 103) + (3 × 102) + (1 × 101) + (0 × 100) = (6 × 1000) + (3 × 100) + (1 × 10) + (0 × 1) = = 6310 © Goodheart-Willcox Co., Inc.

10 Fractional Numbers Fractional numbers:
Have weights that are negative powers of ten (10). Example: 0.812 = (8 × 10-1) + (1 × 10-2) + (2 × 10-3) = (8 × 0.1) + (1 × 0.01) + (2 × 0.001) = = 0.812 © Goodheart-Willcox Co., Inc.

11 Real Numbers Real numbers: Value of digits:
Have weights that are both positive and negative powers of ten (10). Integer parts. Fractional parts. Value of digits: Digits. Digits' positions. © Goodheart-Willcox Co., Inc.

12 Real Numbers (Cont.) Example: 547.165
= (5 × 102) + (4 × 101) + (7 × 100) + (1 × 10–1) + (6 × 10–2) + (5 × 10–3) = (5 × 100) + (4 × 10) + (7 × 1) + (1 × 0.1) + (6 × 0.01) + (5 × 0.001) = = © Goodheart-Willcox Co., Inc.

13 Real Numbers (Cont.) Digits to the left of the decimal point represent the integer number. Digits to the right of the decimal point represent the fractional number. © Goodheart-Willcox Co., Inc.

14 Integer Numbers Integer numbers:
Have weights that are positive powers of ten (10). Can be positive or negative. Zero is an integer number. © Goodheart-Willcox Co., Inc.

15 Binary Number System Binary number system:
Has a base, also called a radix, of two (2). Only the digits 1 and 0 are present. All binary numbers are created from combinations of these two digits. © Goodheart-Willcox Co., Inc.

16 Binary Number System (Cont.)
Least significant bit (LSB): Binary digit to the far right-hand side of the number. Rightmost number has the smallest value. Most significant bit (MSB): Binary digit to the far left-hand side. © Goodheart-Willcox Co., Inc.

17 Binary-to-Decimal Conversion
Converting binary-to-decimal: Convert each bit to its equivalent decimal value. Add all of these decimal values. © Goodheart-Willcox Co., Inc.

18 Decimal-to-Binary Conversion
Convert integer part of a decimal number using: Repeated division. Successive division. Convert fractional part using: Repeated multiplication. Successive multiplication. © Goodheart-Willcox Co., Inc.

19 Decimal-to-Binary Conversion (Cont.)
Successive division method: Integer decimal number is divided by two, repeatedly. Remainders make up the new binary number. © Goodheart-Willcox Co., Inc.

20 Decimal-to-Binary Conversion (Cont.)
Successive multiplication method: Convert the fractional part of a decimal number to binary. MSB of the binary number: Decimal number is multiplied by two and the portion that is carried (if the product is greater than 0). Process is continued until the decimal part of the number becomes zero. © Goodheart-Willcox Co., Inc.

21 Binary Addition Decimal number system: Binary number system:
Carry generated when the sum of two digits is equal to 10. Binary number system: Carry generated when the sum of two binary bits is equal to two. © Goodheart-Willcox Co., Inc.

22 Binary Addition (Cont.)
Ways that binary bits are added and how the carry bit is generated: 0 + 0 = 0 0 + 1 = 1 1 + 1 = 0 with carry of 1 = 1 with carry of 1 © Goodheart-Willcox Co., Inc.

23 Binary Subtraction In the decimal number system:
When the value of a digit is being subtracted (the subtrahend) is greater than the value of the digit that it is being subtracted from (the minuend), a borrow from the next higher column (the column to the left) is required. © Goodheart-Willcox Co., Inc.

24 Binary Subtraction (Cont.)
Subtraction of binary numbers: Ways binary bits are subtracted and when a borrow bit is required: 0 – 0 = 0 no borrow 1 – 1 = 0 no borrow 1 – 0 = 1 no borrow (1) 0 – 1 = 1 with a borrow of 1 © Goodheart-Willcox Co., Inc.

25 Binary Multiplication
In multiplication, the multiplicand is multiplied by each of the multiplier digits. Results of each higher multiplier digit are shifted one place to the left. When each of the multiplicand’s digits have been multiplied by the multiplier digits, all of the numbers are added. © Goodheart-Willcox Co., Inc.

26 Binary Multiplication (Cont.)
How binary bits are multiplied: 0 × 0 = 0 0 × 1 = 0 1 × 0 = 0 1 × 1 = 1 © Goodheart-Willcox Co., Inc.

27 Binary Division Division:
How many times a number called the divisor can be subtracted from another number called the dividend. Similar to decimal division. © Goodheart-Willcox Co., Inc.

28 Binary Division (Cont.)
Subtraction routine: Continues until the remainder is less than the dividend. Quotient: Number of times the divisor can be subtracted from the dividend. © Goodheart-Willcox Co., Inc.

29 Hexadecimal Number System
Used in medium to larger programmable logic controllers (PLCs). Often just called hex. Used to display the PLC memory map and to carry out the math instructions. Created by grouping four binary bits. Hexadecimal numbers use base of 16 and require fifteen digits. © Goodheart-Willcox Co., Inc.

30 Hexadecimal Number System (Cont.)
Uses the numbers zero (0) through nine (9) for the first ten digits. Ten (10) through fifteen (15) are represented by letters A through F. Digits representing 10, 11, 12, 13, 14, and 15 are displayed as A, B, C, D, E, and F respectively. Capital letter H or the small letter h is placed at the end of a hexadecimal number. © Goodheart-Willcox Co., Inc.

31 Hexadecimal Number System (Cont.)
Hexadecimal Binary Decimal A B C D E F © Goodheart-Willcox Co., Inc.

32 Hexadecimal Number System (Cont.)
To form hex numbers from binary numbers, group binary number bits in groups of four. Swap out each group of four binary bits with its hex equivalent. Example: becomes which is transformed to F 1 7 or F13h. © Goodheart-Willcox Co., Inc.

33 Hexadecimal Number System (Cont.)
Reverse the process to convert to binary. Take each hex digit and swap it with the binary 4-bit equivalent. Example: The number 37Ah becomes or © Goodheart-Willcox Co., Inc.

34 Octal Number System Octal number system: Has a base of eight.
Therefore, only the digits zero (0) through seven (7) are present. Used to display the memory maps and carry out the math instructions in some MicroLogix controllers. © Goodheart-Willcox Co., Inc.

35 Octal Number System (Cont.)
Octal Binary Decimal © Goodheart-Willcox Co., Inc.

36 Octal Number System (Cont.)
Form an octal number from a binary number by grouping binary number bits in groups of three. Swap out each group of three binary bits with its octal equivalent octal digit. Example: The number becomes which is transformed to or 317O. © Goodheart-Willcox Co., Inc.

37 Octal Number System (Cont.)
Reverse the process to convert to binary. Take each octal digit and swap it with the binary 3-bit equivalent. Example: The number 246 becomes or The capital letter O is placed at the end of an octal number. © Goodheart-Willcox Co., Inc.

38 Binary Coded Decimal (BCD) System
Each 4 bits of binary numbers are grouped to form a decimal number. Four bit groups representing 10, 11, 12, 13, 14, and 15 are not valid numbers in the BCD number system. Only digits zero (0) through nine (9) are valid. © Goodheart-Willcox Co., Inc.

39 Binary Coded Decimal (BCD) System (Cont.)
Binary Coded Decimal (BCD) Decimal © Goodheart-Willcox Co., Inc.

40 Binary Coded Decimal (BCD) System (Cont.)
To convert a number from any number system to BCD, first convert the number to decimal. Then, represent each decimal digit with a 4-bit binary number code. © Goodheart-Willcox Co., Inc.

41 Gray Code Servo control: Optical encoders:
Closed-loop industrial control system that is used to control the speed and position of an electric motor shaft. Optical encoders: Generate codes that represent the angular positions of the motor shafts. Usually in a format called Gray code. © Goodheart-Willcox Co., Inc.

42 Gray Code (Cont.) Gray code system: Similar to binary.
Converted to binary prior to arithmetic operation. Used for detecting the position of a motor shaft. Only one digit changes state (turns on or off) as a number increments or decrements. © Goodheart-Willcox Co., Inc.

43 Gray Code (Cont.) Gray code system (continued):
Speed of the operation of a control system increases. Only one digit changes with every rotation of the optical encoder disc attached to the motor shaft. Difficulty in doing arithmetic operations. © Goodheart-Willcox Co., Inc.

44 Gray code Binary Decimal
Gray Code (Cont.) Gray code Binary Decimal © Goodheart-Willcox Co., Inc.

45 Alphanumeric Code Alphanumeric codes represent: Letters Numbers
Special symbols © Goodheart-Willcox Co., Inc.

46 American Standard Code for Information Interchange (ASCII)
7-bit code Used to represent alphabets, numbers, characters, and control codes in computer systems. One hundred and twenty eight (27 = 128) different characters can be represented. Data is often sent in bytes (groups of eight bits). Eighth bit in one byte of transmitted data used for a parity bit. © Goodheart-Willcox Co., Inc.

47 Extended Binary Coded Decimal Interchange Code (EBCDIC)
8-bit code. Alphanumeric code commonly encountered in computer mainframe equipment. Two hundred and fifty six (28 = 256) different characters can be represented. Uppercase and lowercase. Numbers (1 thru 9). Punctuation, control codes, and other characters. Commonly called Extended ASCII. © Goodheart-Willcox Co., Inc.

48 Alphanumeric Codes © Goodheart-Willcox Co., Inc.

49 Control Codes © Goodheart-Willcox Co., Inc.

50 Glossary American Standard Code for Information Interchange (ASCII): Code that uses seven bits to represent alphabets, numbers, characters, and control words. Base: The number that determines the weight of digits in a given number system. Also called a radix. © Goodheart-Willcox Co., Inc.

51 Glossary Binary coded decimal (BCD) system: Number system that uses binary numbers to represent decimal digits. Binary number system: Number system that has a base of two. Borrow bit: Bit in a subtraction operation that is required when the subtrahend (bottom number) digit is larger than the minuend (top number) digit. © Goodheart-Willcox Co., Inc.

52 Glossary Carry bit: Bit in an addition operation that is generated when the sum of two digits is larger than the base. Decimal number system: Number system that has a base of ten (10). Dividend: Number in a division operation from which the divisor can be subtracted repeatedly. © Goodheart-Willcox Co., Inc.

53 Glossary Divisor: Number in a division operation that can be subtracted from the dividend repeatedly. Extended Binary Coded Decimal Interchange Code (EBCDIC): Often called Extended ASCII, a code that uses eight bits to represent alphabets, numbers, characters, and control words. Fractional numbers: Numbers that have weights with negative powers. © Goodheart-Willcox Co., Inc.

54 Glossary Gray code system: Number system similar to binary, but bits are changed only one at a time. Hexadecimal number system (hex): Number system that has a base of 16. Integer numbers: Numbers that have weights with positive powers. © Goodheart-Willcox Co., Inc.

55 Glossary Least significant bit (LSB): Bit in a binary number on the far right-hand side. Minuend: The top number in a subtraction operation. Most significant bit (MSB): Bit in a binary number on the far left-hand side. © Goodheart-Willcox Co., Inc.

56 Glossary Multiplicand: The top number in a multiplication operation.
Multiplier: The bottom number in a multiplication operation. Octal number system: Number system that has a base of 8. © Goodheart-Willcox Co., Inc.

57 Glossary Quotient: In a division operation, it is the number of times the divisor can be subtracted from the dividend. Real numbers: Numbers that have both integer and fractional parts. Subtrahend: The bottom number in a subtraction operation. © Goodheart-Willcox Co., Inc.

58 Glossary Successive division method: Method of converting decimal numbers to binary by dividing the decimal number by two repeatedly. © Goodheart-Willcox Co., Inc.


Download ppt "Number Systems and Codes"

Similar presentations


Ads by Google