Presentasi sedang didownload. Silahkan tunggu

Presentasi sedang didownload. Silahkan tunggu

Program Studi T. Elektro FT - UHAMKA Slide - 21 Sistem – Sistem Bilangan, Operasi dan kode ENDY SA Program Studi Teknik Elektro Fakultas Teknik Universitas.

Presentasi serupa


Presentasi berjudul: "Program Studi T. Elektro FT - UHAMKA Slide - 21 Sistem – Sistem Bilangan, Operasi dan kode ENDY SA Program Studi Teknik Elektro Fakultas Teknik Universitas."— Transcript presentasi:

1 Program Studi T. Elektro FT - UHAMKA Slide - 21 Sistem – Sistem Bilangan, Operasi dan kode ENDY SA Program Studi Teknik Elektro Fakultas Teknik Universitas Muhammadiyah Prof. Dr. HAMKA

2 Program Studi T. Elektro FT - UHAMKA Slide - 22 Tujuan Topik Bahasan Mengulas kembali sistem bilangan desimal. Mengulas kembali sistem bilangan desimal. Menghitung dalam bentuk bilangan biner. Menghitung dalam bentuk bilangan biner. Memindahkan dari bentuk bilangan desimal ke biner dan dalam biner ke dalam desimal. Memindahkan dari bentuk bilangan desimal ke biner dan dalam biner ke dalam desimal. Penggunaan operasi aritmatika pada bilangan biner. Penggunaan operasi aritmatika pada bilangan biner. Menentukan komplemen 1 dan 2 dari sebuah bilangan biner. Menentukan komplemen 1 dan 2 dari sebuah bilangan biner. Dan lain – lainnya…….. Dan lain – lainnya……..

3 Program Studi T. Elektro FT - UHAMKA Slide - 23 Pendahuluan Sistem Biner dan Kode – kode digital merupakan dasar untuk komputer dan elektronika digital secara umum. Sistem Biner dan Kode – kode digital merupakan dasar untuk komputer dan elektronika digital secara umum. Sistem bilangan biner seperti desimal, hexadesimal dan oktal juga dibahas pada bagian ini. Sistem bilangan biner seperti desimal, hexadesimal dan oktal juga dibahas pada bagian ini. Operasi aritmatika dengan bilangan biner akan dibahas untuk memberikan dasar pengertian bagaimana komputer dan jenis – jenis perangkat digital lain bekerja. Operasi aritmatika dengan bilangan biner akan dibahas untuk memberikan dasar pengertian bagaimana komputer dan jenis – jenis perangkat digital lain bekerja.

4 Program Studi T. Elektro FT - UHAMKA Slide - 24 Sistem Bilangan  0 ~ 9  0 ~ 1  0 ~ 7  0 ~ F Desimal Desimal Biner Biner Oktal Oktal Hexadesimal Hexadesimal

5 Program Studi T. Elektro FT - UHAMKA Slide - 25 Bilangan Desimal Dalam setiap bilangan desimal terdiri dari 10 digit, 0 sampai dengan 9 Dalam setiap bilangan desimal terdiri dari 10 digit, 0 sampai dengan 9 Contoh: Ungkapkan bilangan desimal 2745.214 sebagai penjumlahan nilai setiap digit.

6 Program Studi T. Elektro FT - UHAMKA Slide - 26 Bilangan Biner Sistem Bilangan biner merupakan cara lain untuk melambangkan kuantitas, dimana 1 (HIGH) dan 0 (LOW). Sistem Bilangan biner merupakan cara lain untuk melambangkan kuantitas, dimana 1 (HIGH) dan 0 (LOW). Sistem bilangan biner mempunyai nilai basis 2 dengan nilai setiap posisi dibagi dengan faktor 2: Sistem bilangan biner mempunyai nilai basis 2 dengan nilai setiap posisi dibagi dengan faktor 2:

7 Program Studi T. Elektro FT - UHAMKA Slide - 27 Contoh : Konversikan seluruh bilangan biner 1101101 ke desimal Hasil: Nilai : 2 6 2 5 2 4 2 3 2 2 2 1 2 0 Biner : 1 1 0 1 1 0 1 1101101 = 2 6 + 2 5 + 2 3 + 2 2 + 2 0 = 64 + 32 + 8 + 4 + 1 = 109 Coba ini!! 1111001

8 Program Studi T. Elektro FT - UHAMKA Slide - 28 Bilangan Desimal Bilangan Biner 00000 10001 20010 30011 40100 50101 60110 70111 81000 91001 101010 111011 121100 131101 141110 151111 2 2 2 1 2 0 0 0 0 0 0 1 0 2 0 0 2 1 4 0 0 4 0 1 4 2 0 4 2 1 2 3 2 2 2 1 2 0 8 0 0 0 8 0 0 1 8 0 2 0 8 0 2 1 8 4 0 0 8 4 0 1 8 4 2 0 8 4 2 1

9 Program Studi T. Elektro FT - UHAMKA Slide - 29 Aplikasi Digital Ilustrasi sebuah penggunaan hitungan biner sederhana.

10 Program Studi T. Elektro FT - UHAMKA Slide - 210 Konversi Desimal ke Biner Metode Sum-of-Weight. Metode Sum-of-Weight. Pengulangan pembagian dengan Metode bilangan 2. Pengulangan pembagian dengan Metode bilangan 2. Konversi fraksi desimal ke biner. Konversi fraksi desimal ke biner.

11 Program Studi T. Elektro FT - UHAMKA Slide - 211 Metode Sum-of-Weight Bilangan desimal 9 sebagai The decimal number 9, for example, can be expressed as the sum of binary weight of: 1 0 0 1 Example: Convert the following decimal numbers to binary: a) 12 b) 25 c) 58 d) 82 1100 11001 111010 1010010

12 Program Studi T. Elektro FT - UHAMKA Slide - 212 Repeated Division by 2 Method A systematic method of converting whole numbers from decimal to binary is the repeated division-by-2 process. LSBMSB Stop when the whole-number quotient is 0 Remainder Convert the decimal number 12 to binary Convert decimal number 39 to binary?

13 Program Studi T. Elektro FT - UHAMKA Slide - 213 Converting Decimal Fractions to Binary 0.625 = 0.5 + 0.125 = 2 -1 + 2 -3 = 0.101 0.625 x 2 = 1.25 0.25 x 2 = 0.50 0.50 x 2 = 1.00 Stop when the fractional part is all zeros 101101 Carry. 1 0 1 MSBLSB

14 Program Studi T. Elektro FT - UHAMKA Slide - 214 Binary Arithmetic Binary arithmetic is essential in all digital computers and in many other types of digital systems. Binary arithmetic is essential in all digital computers and in many other types of digital systems. Addition, Subtraction, Multiplication, and Division Addition, Subtraction, Multiplication, and Division

15 Program Studi T. Elektro FT - UHAMKA Slide - 215 Binary Addition The four basic rules for adding binary digits (bits) are as follows: 0 + 0 = 0sum of 0 with a carry of 0 0 + 1 = 1sum of 1 with a carry 0f 0 1 + 0 = 1sum of 1 with a carry of 0 1+ 1 = 10sum of 0 with a carry 0f 1 11 011 + 001 100 Carry Try This: 11 + 11 = ??

16 Program Studi T. Elektro FT - UHAMKA Slide - 216 Binary Subtraction The four basic rules for subtracting bits are as follows: 0 – 0 = 0 1 – 1 = 0 1 – 0 = 1 10 – 1 = 1 0 – 1 with a borrow of 1 1 1 – 0 1 = ?? 1 1 - 0 1 1 0 Try This: 1 0 1 – 0 1 1 = ???

17 Program Studi T. Elektro FT - UHAMKA Slide - 217 Binary Multiplication The four basic rules for multiplying bits are as follows: 0 X 0 = 0 0 X 1 = 0 1 X 0 = 0 1 X 1 = 1 1 1 X 1 1 = ?? 1 1 X 1 1 1 1 +1 1 1 0 0 1 Try This: 1 1 1 X 1 0 1 = ??

18 Program Studi T. Elektro FT - UHAMKA Slide - 218 Binary Division Division in binary follows the same procedure as division in decimal. 1 1 0 ÷ 11 = ?? 1 0 11 1 1 0 1 1 0 0 0 Try This: 1 1 0 ÷ 10 = ??

19 Program Studi T. Elektro FT - UHAMKA Slide - 219 1’s and 2’s Complements of Binary Numbers The 1’s and 2’s Complements of Binary Numbers are very important because they permit the representation of negative numbers. The 1’s and 2’s Complements of Binary Numbers are very important because they permit the representation of negative numbers. The method of 2’s compliment arithmetic is commonly used in computers to handle negative numbers The method of 2’s compliment arithmetic is commonly used in computers to handle negative numbers

20 Program Studi T. Elektro FT - UHAMKA Slide - 220 Finding the 1’s Complement The 1’s complement of a binary number is found by changing all 1s to 0s and all 0s to 1s. Example: 1 0 1 1 0 0 1 0 (Binary Number) 0 1 0 0 1 1 0 1 (1’s Complement) NOT Gate

21 Program Studi T. Elektro FT - UHAMKA Slide - 221 Finding the 2’s Complement The 2’s complement of a binary number is found by adding 1 to the LSB of the 1’s complement Find the 2’s complement of 10110010 10110010(Binary number) +01001101(1’s complement) 1(Add 1) 01001110

22 Program Studi T. Elektro FT - UHAMKA Slide - 222 Alternative Method to find 2’s Complement Start at the right with the LSB and write the bits as they are up and including the first 1 Start at the right with the LSB and write the bits as they are up and including the first 1 Take the 1’s complements of the remaining bits Take the 1’s complements of the remaining bits 10111000(Binary Number) 01001000(2’s Complement) 1’s Complements of original bits These bits stay the same Try This: 10010001 01101111

23 Program Studi T. Elektro FT - UHAMKA Slide - 223 Signed Numbers Digital systems, such as the computer, must be able to handle both positive and negative numbers. A signed binary number consists of both sign and magnitude information. The sign indicates whether a number is positive or negative and the magnitude is the value of the number. There three forms in which signed integer (whole) numbers can be represented in binary: 1.Sign-Magnitude 2.1’s Complement 3.2’s Complement

24 Program Studi T. Elektro FT - UHAMKA Slide - 224 The Sign Bit The left-most bit in a signed binary number is the sign bit, which tells you whether the number is positive or negative. Sign-Magnitude Form When a signed binary number is represented in sign- magnitude, the left-most bit is the sign bit and the remaining bits are the magnitude bits. The magnitude bits are in true (uncomplemented) binary for both positive and negative numbers. Decimal number, +25 is expressed as an 8-bit signed binary number using sign- magnitude form as: 00011001 Magnitude Bit Sign Bit

25 Program Studi T. Elektro FT - UHAMKA Slide - 225 1’s Complement Form 2’s Complement Form Positive numbers in 1’s complement form are represented the same way as the positive sign-magnitude numbers. Negative numbers, however, are the 1’s complements of the corresponding positive numbers. Example: The decimal number -25 is expressed as the 1’s complement of +25 (00011001) as (11100110) In the 2’s complement form, a negative number is the 2’s complement of the corresponding positive number

26 Program Studi T. Elektro FT - UHAMKA Slide - 226 Express the decimal number -39 in sign-magnitude, 1’s complement and 2’s complement 00100111 >>> 10100111 00100111 >>> 11011000 00100111 >>> 11011001 00100111

27 Program Studi T. Elektro FT - UHAMKA Slide - 227 The Decimal Value of Signed Numbers Sign-Magnitude: Decimal Value of positive and negative numbers in the sign-magnitude form are determined by summing the weights in all the magnitude bit positions where there are 1s and ignoring those positions where there are zeros. Determine the decimal value of this signed binary number expressed in sign magnitude: 1 0 0 1 0 1 0 1 2 6 2 5 2 4 2 3 2 2 2 1 2 0 0 0 1 0 1 0 1 >> 16 + 4 + 1 = 21 The sign bit is 1: Therefore, the decimal number is -21

28 Program Studi T. Elektro FT - UHAMKA Slide - 228 The Decimal Value of Signed Numbers 1’s Complement:Decimal values of negative numbers are determined by assigning a negative value to the weight of the sign bit, summing all the weight where there are 1s and adding 1 to the result Determine the decimal values of this signed binary numbers expressed in 1’s complement 0001011111101000 -2 7 2 6 2 5 2 4 2 3 2 2 2 1 2 0 0 0 0 1 0 1 1 1 16 + 4 + 2 + 1 = +23 1 1 1 0 1 0 0 0 -128 + 64 + 32 + 8 = -24 + 1 = -23

29 Program Studi T. Elektro FT - UHAMKA Slide - 229 The Decimal Value of Signed Numbers 2’s Complement: The weight of the sign bit in a negative number is given a negative value Determine the decimal values of this signed binary numbers expressed in 1’s complement 0101011010101010 -2 7 2 6 2 5 2 4 2 3 2 2 2 1 2 0 0 1 0 1 0 1 1 0 64 + 16 + 4 + 2 = +86 1 0 1 0 -128 + 32 + 8 + 2 = -86

30 Program Studi T. Elektro FT - UHAMKA Slide - 230 Arithmetic Operations with Signed Number In this section we will learn how signed numbers are added, subtracted, multiplied and divided. This section will cover only on the 2’s complement arithmetic, because, it widely used in computers and microprocessor-based system.

31 Program Studi T. Elektro FT - UHAMKA Slide - 231 Addition 0 0 0 0 0 1 1 1 +0 0 0 0 0 1 0 0 0 0 0 0 1 0 1 1 0 0 0 0 1 1 1 1 +1 1 1 1 1 0 1 0 0 0 0 0 1 0 0 1 1 1 Discard Carry 7 + 4 15 + (-6) The Sum is Positive and is therefore in true binary The Final Carry is Discarded. The Sum is Positive and is therefore in true binary

32 Program Studi T. Elektro FT - UHAMKA Slide - 232 Addition 0 0 0 1 0 0 0 0 +1 1 1 0 1 0 0 0 1 1 1 1 1 0 0 0 16 + (-24) The Sum is Negative and is therefore in 2’s complement form 1 1 1 1 1 0 1 1 + 1 1 1 1 0 1 1 1 1 1 1 1 0 0 1 0 -5 + (-9) 1 1 Discard Carry The Final Carry is Discarded. The Sum is Negative and is therefore in 2’s complement form

33 Program Studi T. Elektro FT - UHAMKA Slide - 233 Subtraction To subtract two signed numbers, take the 2’s Complement of the subtrahend and ADD. Discard any final carry bit 0 0 0 0 1 0 0 0 - 0 0 0 0 0 0 1 1 8 – 3 = 8 + (-3) = 5 0 0 0 0 1 0 0 0 1 1 1 1 1 1 0 1 0 0 0 0 0 1 0 1 +2’s Complement 1 Discard Cary Difference

34 Program Studi T. Elektro FT - UHAMKA Slide - 234 Multiplication The numbers in a multiplication are the multiplicand, the multiplier and the product. Direct Addition and Partial Products are two basic methods for performing multiplication using addition. 8 X 3 = 24 8 + 8 + 8 = 24 (Decimal) 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 1 0 0 0 + + Standard Procedure

35 Program Studi T. Elektro FT - UHAMKA Slide - 235 Division The division operation in computers is accomplished using subtraction. Since subtraction is done with an adder, division can also be accomplished with an adder. The result of a division is called the quotient. Step 1: Determine the SIGN BIT for both DIVIDEND and DIVISOR Step 2: Subtract the DIVISOR from the DIVIDEND using 2’s Complement addition to get the first partial remainder and ADD 1 to quotient. If ZERO or NEGATIVE the division is complete. Step 3: Subtract the divisor from the partial remainder and ADD 1 to the quotient. If the result is POSITIVE repeat Step 2 or If ZERO or NEGATIVE the division is complete.

36 Program Studi T. Elektro FT - UHAMKA Slide - 236 Hexadecimal Numbers Most digital systems deal with groups of bits in even powers of 2 such as 8, 16, 32, and 64 bits. Most digital systems deal with groups of bits in even powers of 2 such as 8, 16, 32, and 64 bits. Hexadecimal uses groups of 4 bits. Hexadecimal uses groups of 4 bits. Base 16 Base 16 16 possible symbols 16 possible symbols 0-9 and A-F 0-9 and A-F Allows for convenient handling of long binary strings. Allows for convenient handling of long binary strings.

37 Program Studi T. Elektro FT - UHAMKA Slide - 237 Hexadecimal Numbers Convert from hex to decimal by multiplying each hex digit by its positional weight. Convert from hex to decimal by multiplying each hex digit by its positional weight. Example: Example:

38 Program Studi T. Elektro FT - UHAMKA Slide - 238 Hexadecimal Numbers Convert from decimal to hex by using the repeated division method used for decimal to binary and decimal to octal conversion. Convert from decimal to hex by using the repeated division method used for decimal to binary and decimal to octal conversion. Divide the decimal number by 16 Divide the decimal number by 16 The first remainder is the LSB and the last is the MSB. The first remainder is the LSB and the last is the MSB. Note, when done on a calculator a decimal remainder can be multiplied by 16 to get the result. If the remainder is greater than 9, the letters A through F are used. Note, when done on a calculator a decimal remainder can be multiplied by 16 to get the result. If the remainder is greater than 9, the letters A through F are used.

39 Program Studi T. Elektro FT - UHAMKA Slide - 239 Example of hex to binary conversion: Example of hex to binary conversion: Hexadecimal Numbers

40 Program Studi T. Elektro FT - UHAMKA Slide - 240 Hexadecimal Numbers

41 Program Studi T. Elektro FT - UHAMKA Slide - 241 Hexadecimal Numbers Hexadecimal is useful for representing long strings of bits. Hexadecimal is useful for representing long strings of bits. Understanding the conversion process and memorizing the 4 bit patterns for each hexadecimal digit will prove valuable later. Understanding the conversion process and memorizing the 4 bit patterns for each hexadecimal digit will prove valuable later.

42 Program Studi T. Elektro FT - UHAMKA Slide - 242 BCD Binary Coded Decimal (BCD) is another way to present decimal numbers in binary form. Binary Coded Decimal (BCD) is another way to present decimal numbers in binary form. BCD is widely used and combines features of both decimal and binary systems. BCD is widely used and combines features of both decimal and binary systems. Each digit is converted to a binary equivalent. Each digit is converted to a binary equivalent.

43 Program Studi T. Elektro FT - UHAMKA Slide - 243 BCD To convert the number 874 10 to BCD: To convert the number 874 10 to BCD: 874 1000 0111 0100 = 100001110100 BCD 1000 0111 0100 = 100001110100 BCD Each decimal digit is represented using 4 bits. Each decimal digit is represented using 4 bits. Each 4-bit group can never be greater than 9. Each 4-bit group can never be greater than 9. Reverse the process to convert BCD to decimal. Reverse the process to convert BCD to decimal.

44 Program Studi T. Elektro FT - UHAMKA Slide - 244 BCD BCD is not a number system. BCD is not a number system. BCD is a decimal number with each digit encoded to its binary equivalent. BCD is a decimal number with each digit encoded to its binary equivalent. A BCD number is not the same as a straight binary number. A BCD number is not the same as a straight binary number. The primary advantage of BCD is the relative ease of converting to and from decimal. The primary advantage of BCD is the relative ease of converting to and from decimal.

45 Program Studi T. Elektro FT - UHAMKA Slide - 245 Alphanumeric Codes Represents characters and functions found on a computer keyboard. Represents characters and functions found on a computer keyboard. ASCII – American Standard Code for Information Interchange. ASCII – American Standard Code for Information Interchange. Seven bit code: 2 7 = 128 possible code groups Seven bit code: 2 7 = 128 possible code groups Table 2-4 lists the standard ASCII codes Table 2-4 lists the standard ASCII codes Examples of use are: to transfer information between computers, between computers and printers, and for internal storage. Examples of use are: to transfer information between computers, between computers and printers, and for internal storage.

46 Program Studi T. Elektro FT - UHAMKA Slide - 246 Thank You “ Buku yang selalu dibaca tidak akan mengumpul habuk dan debu. Berjinaklah dengan buku kerana ia adalah teman yang paling berguna menimba ilmu “


Download ppt "Program Studi T. Elektro FT - UHAMKA Slide - 21 Sistem – Sistem Bilangan, Operasi dan kode ENDY SA Program Studi Teknik Elektro Fakultas Teknik Universitas."

Presentasi serupa


Iklan oleh Google