Sistem – Sistem Bilangan, Operasi dan kode

-         - Tujuan Topik Bahasan

  1.       Mengulas kembali sistem bilangan desimal. 
  2.             Menghitung dalam bentuk bilangan biner.
  3.             Memindahkan dari bentuk bilangan desimal ke biner dan dalam biner ke dalam desimal.
  4.             Penggunaan operasi aritmatika pada bilangan biner.
  5.            Menentukan komplemen 1 dan 2 dari sebuah bilangan biner Dan lain – lainnya……..

-      -   Sistem Bilangan

·         Desimal                   0 ~ 9

·         Biner                       0 ~ 1  

·         Oktal                       0 ~ 7

·         Hexadesimal           0 ~ F

-          -   Bilangan Desimal

·         Dalam setiap bilangan desimal terdiri dari 10 digit, 0 sampai dengan 9

 

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNq80WGXRum4u9DpkRVLoue0EJ302NJHXr0yCyWjjuh679OtbH2IZ1VDFw25UoxFgR4Tr8Vi3mzHT2lOG2ZvOEYkRZbfaASF0tewibQCFOkfJwxPsr3SPbBcZ8h9vy2b3_p6L24WfdXRVamJTGlKhSwWaoM8VMFnxagKZZLRp78zMl1fxl5EKky6mSQQ/w389-h259/Picture1.jpg 


Contoh:

Ungkapkan bilangan desimal 2745.214 sebagai penjumlahan nilai setiap digit.

 

 

-       - Bilangan Biner

·         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:









Contoh :

 

Konversikan seluruh bilangan biner 1101101 ke desimal

 

Hasil:

Nilai :     26 25 24 23 22 21 20                               

Biner :    1  1  0   1  1   0   1

1101101 = 26 + 25 + 23 + 22 + 20

             = 64 + 32 + 8 + 4 + 1 = 109

 

-      - Konversi Desimal ke Biner

Metode Sum-of-Weight.

Pengulangan pembagian dengan Metode bilangan 2.

Konversi fraksi desimal ke biner.

-        - Metode Sum-of-Weight


 

 

                                                       
                                                       
Example:

Bilangan desimal 9 sebagai                                   Convert the following decimal         

The decimal number 9, for                                     numbers to binary:  

example, can be expressed as                                  a) 12 b) 25 c) 58 d) 82     

the sum of binary weight of:                              1100 11001   111010   1010010

 Binary Arithmetic
l  Binary arithmetic is essential in all digital computers and in many other types of digital systems.
l  Addition, Subtraction, Multiplication, and Division


Binary Addition
The four basic rules for adding binary digits (bits) are as follows:
0 + 0 = 0                      sum of 0 with a carry of 0
0 + 1 = 1                      sum of 1 with a carry 0f 0
1 + 0 = 1                      sum of 1 with a carry of 0
1+ 1 = 10                     sum of 0 with a carry 0f 1


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


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


Binary Division
Division in binary follows the same procedure as division in decimal.


1’s and 2’s Complements of Binary Numbers

l  The 1’s and 2’s Complements of Binary Numbers are very important because they permit the representation of negative numbers.
l  The method of 2’s compliment arithmetic is commonly used in computers to handle negative numbers


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)


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
2's Complement = (1's Complement) + 1


Alternative Method to find 2’s Complement
l  Start at the right with the LSB and write the bits as they are up and including the first 1
l  Take the 1’s complements of the remaining bits


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
  1. 1’s Complement
  1. 2’s Complement

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.
0 = Positive Number and 1 = Negative Number
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:
1’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)
2’s Complement Form
In the 2’s complement form, a negative number is the 2’s complement of the corresponding positive number
Example:
Express the decimal number -39 in sign-magnitude, 1’s complement and 2’s complement
                                               
00100111
Sign-Magnitude:    00100111      >>>     10100111
1's Complement:    00100111      >>>     11011000
2's Complement:    00100111      >>>     11011001


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.
Example: Determine the decimal value of this signed binary number expressed in sign magnitude: 1 0 0  1 0 1 0 1
26 25 24 23 22 21 20
0  0  1   0  1  0  1 >> 16 + 4 + 1 = 21
The sign bit is 1: Therefore, the decimal number is -21
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
Example: Determine the decimal values of this signed binary numbers expressed in 1’s complement
                   
01010110                                        10101010
-27 26 25 24 23 22 21 20                                                       -27 26 25 24 23 22 21 20
0   1   0  1  0  1  1   0                                     1   0   1  0  1  0  1   0
64 + 16 + 4 + 2 = +86                                -128 + 32 + 8 + 2 = -86


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 .

Addition

Both Number Positive:     0 0 0 0 0 1 1 1           7 + 4

                      + 0 0 0 0 0 1 0 0

                         0 0 0 0 1 0 1 1

                                 The Sum is Positive and is therefore in true binary

 

Positive Number with                     Discard           0 0 0 0 1 1 1 1             15 + (-6)

Magnitude Larger                       Carry              +1 1 1 1 1  0 1 0

Negative Number:                                       1         0 0 0 0 1 0 0 1

                                              The Final Carry is Discarded.

                                              The Sum is Positive and is therefore in true binary

 

Negative Number with                         0 0 0 1 0 0 0 0              16 + (-24)

Magnitude Larger than                    +1 1 1  0 1 0 0 0

Positive Number:                                 1 1 1 1 1 0 0 0

                                                      The Sum is Negative and is therefore in

                                                      2’s complement form

Both Number Negative:    Discard           1 1 1 1 1 0 1 1           -5 + (-9)

                                             Carry           + 1 1 1 1 0 1 1 1

                                                             1      1 1 1 1 0 0 1 0

 

             The Final Carry is Discarded. The Sum is Negative and is therefore in 2’s complement form

Subtraction

To subtract two signed  numbers, take the 2’s Complement of the subtrahend and ADD. Discard any final carry bit

Example:    0 0 0 0 1 0 0 0  -  0 0 0 0 0 0 1 1

                    8 – 3 = 8 + (-3) = 5

Solution:           0 0 0 0 1 0 0 0

                        + 1 1 1 1 1 1 0 1      >   2’s Complement

Discard Cary    1   0 0 0 0 0 1 0 1   >    Difference

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.

Direct Addition:   8 X 3 = 24                 0 0 0 0 1 0 0 0

                               8 + 8 + 8 = 24       0 0 0 0 1 0 0 0

                               (Decimal)                0 0 0 1 0 0 0 0

                                                           +  0 0 0 0 1 0 0 0

                                                               0 0 0 1 1 0 0 0

Partial Product:  Standard Procedure

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.

Hexadecimal Numbers

l  Most digital systems deal with groups of bits in even powers of 2 such as 8, 16, 32, and 64 bits.

l  Hexadecimal uses groups of 4 bits.

l  Base 16

l  16 possible symbols

l  0-9 and A-F

l  Allows for convenient handling of long binary strings.

l  Convert from hex to decimal by multiplying each hex digit by its positional weight.

     Example: 

l  Convert from decimal to hex by using the repeated division method used for decimal to binary and decimal to octal conversion.

l  Divide the decimal number by 16

l  The first remainder is the LSB and the last is the MSB.

l  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.

 

l  Example of hex to binary conversion:


 

 


 

l  Hexadecimal is useful for representing long strings of bits.

l  Understanding the conversion process and memorizing the 4 bit patterns for each hexadecimal digit will prove valuable later.

BCD

l  Binary Coded Decimal (BCD) is another way to present decimal numbers in binary form.

l  BCD is widely used and combines features of both decimal and binary systems.

l  Each digit is converted to a binary equivalent.

l  To convert the number 87410 to BCD:

l                          8          7          4

l                 1000   0111  0100   =  100001110100BCD

l  Each decimal digit is represented using 4 bits.

l  Each 4-bit group can never be greater than 9.

l  Reverse the process to convert BCD to decimal.

l  BCD is not a number system.

l  BCD is a decimal number with each digit encoded to its binary equivalent.

l  A BCD number is not the same as a straight binary number.

l  The primary advantage of BCD is the relative ease of converting to and from decimal.

Alphanumeric Codes

l  Represents characters and functions found on a computer keyboard.

l  ASCII – American Standard Code for Information Interchange.

l  Seven bit code: 27 = 128 possible code groups

l  Table 2-4 lists the standard ASCII codes

l  Examples of use are:  to transfer information between computers, between computers and printers, and for internal storage.

https://onlinelearning.uhamka.ac.id/


 

Komentar

Postingan populer dari blog ini