©zaher elsir Sudan Academy for Banking & Financial Sciences Decimal Number System Base (Radix)10 Digits0, 1, 2, 3, 4, 5, 6, 7, 8, 9 e.g The magnitude represented by a digit is decided by the position of the digit within the number. For example the digit 7 in the left-most position of 7475 counts for 7000 and the digit 7 in the second position from the right counts for
©zaher elsir Sudan Academy for Banking & Financial Sciences Binary Number System Base (Radix)2 Digits0, 1 e.g The digit 1 in the third position from the right represents the value 4 and the digit 1 in the fourth position from the right represents the value = =2 2 2=2 1 1=2 0
©zaher elsir Sudan Academy for Banking & Financial Sciences Octal Number System Base (Radix)8 Digits0, 1, 2, 3, 4, 5, 6, 7 e.g The digit 2 in the second position from the right represents the value 16 and the digit 1 in the fourth position from the right represents the value = = = =8 0
©zaher elsir Sudan Academy for Banking & Financial Sciences Hexadecimal Number System Base (Radix)16 Digits0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F e.g. 2F4D 16 The digit F in the third position from the right represents the value 3840 and the digit D in the first position from the right represents the value =16 3 F 256= =16 1 D 1=16 0
©zaher elsir Sudan Academy for Banking & Financial Sciences Binary Arithmetic Addition Complements Subtraction
©zaher elsir Sudan Academy for Banking & Financial Sciences Binary Addition Carry Bit (a) (b) (c)(d)
©zaher elsir Sudan Academy for Banking & Financial Sciences Binary Addition Example –1–1 –1–1 –1–1–1–1–1–1 –0–0–1–1–0–0–0–0–1–1–1–1 –Example 1: Add –binary to –Col 1) Add = 1 – Write 1 –Col 2) Add = 1 – Write 1 –Col 3) Add = 2 (10 in binary) – Write 0, carry 1 –Col 4) Add = 2 – Write 0, carry 1 –Col 6) Add = 2 – Write 0, carry 1 –Col 5) Add = 3 (11 in binary) – Write 1, carry 1 –Col 7) Bring down the carried 1 – Write 1
©zaher elsir Sudan Academy for Banking & Financial Sciences Binary Addition Verification Verification = = –1–1–0–0–1–1–0–0–0–0–1–1–1–1 –You can always check your –answer by converting the figures to decimal, doing the addition, and comparing the answers.
©zaher elsir Sudan Academy for Banking & Financial Sciences Binary Addition Examples (a)(b)(c) (d) (e)
©zaher elsir Sudan Academy for Banking & Financial Sciences Binary Substraction Borrow Bit (a) (b) (c)(d)
©zaher elsir Sudan Academy for Banking & Financial Sciences Binary Subtraction Example –Example 1: Subtract –binary from –2–2 –0–0–0–0–2–2 –1–1 –2–2 –1–1–1–1–0–0–1–1 Col 1) Subtract 1 – 0 = 1 Col 5) Try to subtract 0 – 1 can’t. Must borrow from next column. Col 4) Subtract 1 – 1 = 0 Col 3) Try to subtract 0 – 1 can’t. Must borrow 2 from next column. But next column is 0, so must go to column after next to borrow. Add the borrowed 2 to the 0 on the right. Now you can borrow from this column (leaving 1 remaining). Col 2) Subtract 1 – 0 = 1 Add the borrowed 2 to the original 0. Then subtract 2 – 1 = 1 –1–1 Add the borrowed 2 to the remaining 0. Then subtract 2 – 1 = 1 Col 6) Remaining leading 0 can be ignored.
©zaher elsir Sudan Academy for Banking & Financial Sciences Binary Subtraction Verification Verification = = –2–2 –0–0–0–0–2–2 –1–1 –2–2 –1–1–1–1–0–0–1–1–1–1 –Subtract binary –11100 from :
©zaher elsir Sudan Academy for Banking & Financial Sciences Binary Subtraction Example –Example 2: Subtract –binary from –2–2–0–0–0–0–2–2 –1–1–1–1–0–0–1–1–0–0 Verification = = 21 10
©zaher elsir Sudan Academy for Banking & Financial Sciences Example Binary Complement (1s Complement) Operation
©zaher elsir Sudan Academy for Banking & Financial Sciences Two’s Complement The Two’s complement of a binary number is obtained by first complementing the number and then adding 1 to the result One’s Complement Two’s Complement
©zaher elsir Sudan Academy for Banking & Financial Sciences Binary Subtraction Binary subtraction is implemented by adding the Two’s complement of the number to be subtracted. Example If there is a carry then it is ignored. Thus, the answer is Two’s complement of 1001
©zaher elsir Sudan Academy for Banking & Financial Sciences Binary Codes BCD – Binary Coded Decimal ASCII – American Standard Code for Information Interchange A binary code is a group of n bits that assume up to 2 n distinct combinations of 1’s and 0’s with each combination representing one element of the set that is being coded.
©zaher elsir Sudan Academy for Banking & Financial Sciences BCD – Binary Coded Decimal Decimal BCD Number When the decimal numbers are represented in BCD, each decimal digit is represented by the equivalent BCD code. Example :BCD Representation of Decimal
©zaher elsir Sudan Academy for Banking & Financial Sciences ASCII Number ASCIILetter ASCII A B C D E F G H I
©zaher elsir Sudan Academy for Banking & Financial Sciences ASCII Continued. J K L M N O P Q R Letter ASCIILetter ASCII S T U V W X Y Z
©zaher elsir Sudan Academy for Banking & Financial Sciences Logic Gates Binary information is represented in digital computers by physical quantities called signals. Two different electrical voltage levels such as 3 volts and 0.5 volts may be used to represent binary 1 and 0. Binary logic deals with binary variables and with operations that assume a logical meaning.
©zaher elsir Sudan Academy for Banking & Financial Sciences Logic Gates Contd… A particular logic operation can be described in an algebraic or tabular form. The manipulation of binary information is done by the circuits called logic gates which are blocks of hardware that produce signals of binary 1 or 0 when input logic requirements are satisfied.
©zaher elsir Sudan Academy for Banking & Financial Sciences Logic Gates Contd… Each gate has a distinct graphics symbol and it’s operation can be described by means of an algebraic expression or in a form of a table called the truth table. Each gate has one or more binary inputs and one binary output.
–© zaher elsir –Sudan Academy for Banking & Financial Sciences Logic Gates AND OR NOT (Inverter) NAND (Not AND) NOR (Not OR) XOR (Exclusive-OR) Exclusive-NOR
–© zaher elsir –Sudan Academy for Banking & Financial Sciences Logic Gates Cont. AND Logic GateTruth Table A B x A B x A, B Binary Input Variables x Binary Output Variable x = A. B
–© zaher elsir –Sudan Academy for Banking & Financial Sciences Logic Gates Cont. ORLogic Gate Truth Table A B x A B x x = A + B This is read as x equals A or B.
–© zaher elsir –Sudan Academy for Banking & Financial Sciences Logic Gates Cont. NOTLogic GateTruth Table A x x A x = A
–© zaher elsir –Sudan Academy for Banking & Financial Sciences Logic Gates Cont. NANDLogic GateTruth Table A B x A B x x = A. B
–© zaher elsir –Sudan Academy for Banking & Financial Sciences Logic Gates Cont. NORLogic GateTruth Table A B x A B x x = A + B
–© zaher elsir –Sudan Academy for Banking & Financial Sciences Logic Gates Cont. XORLogic GateTruth Table A B x A B x x = A + B
–© zaher elsir –Sudan Academy for Banking & Financial Sciences Logic Gates Cont. Exclusive-NOR Logic GateTruth Table A B x A B x x = A + B