Digital concept an Number system Chapter 1 Binary Codes Shall I compare thee to a summer' s day?
Digital concept and Number system Chapter 1 Binary Codes Shall I compare thee to a summer’s day?
Natural Binary Coded Decimal (BCD) Decimal BCD group of four binary digits represent oooo a single decimal digit 0001 0123456789 0010 0011 0100 0101 0110 0111 1000 1001
group of four binary digits represent 0 a single decimal digit 1 2 3 4 5 6 7 8 9 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 Decimal BCD Natural Binary Coded Decimal (BCD)
Weighted Binary Coded Decimal Decimal 8421 2421 EX-3 0000 0000 0011 Assign fixed 00010001 0100 weight for 0123456789 0010 0010 0101 0011 0011 0110 each bit 0100 0100 0111 position 0101 1011 1000 0110 1100 1001 0111 1101 1010 1000 1110 1011 1001 1111 1100
0 1 2 3 4 5 6 7 8 9 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 Decimal 8421 2421 Ex-3 0000 0001 0010 0011 0100 1011 1100 1101 1110 1111 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 Assign fixed weight for each bit position Weighted Binary Coded Decimal
BCD Self-complementing codes Logic complements A logic complement of a binary digit is its opposiTe value. The logic complement of 0 is 1 and the logic complement of 1 is O Ex logic complement of (o011)2 is 1100
• Logic complements – A logic complement of a binary digit is its opposite value. – The logic complement of 0 is 1 and the logic complement of 1 is 0. Ex. logic complement of (0011)2 is 1100. BCD Self-complementing codes
*b is the radix of the numeral x Two arithmetic complements Radix complement of x is written x X=(6b)-X diminish radix complement of x is written x-1 X.1=(b-1)-X 10s complement (radix complement) of 610 10-6=4 9s complement(Diminish radix complement )of 6 10-1-6=310
*b is the radix of the numeral x • Two arithmetic complements – Radix complement of x is written x’ – X’ = (b) – X – diminish radix complement of x is written x-1’ – X-1 ’ = (b - 1) – X • 10s complement (radix complement) of 610 • 10-6=410 • 9s complement ( Diminish radix complement ) of 610 •10-1-6=310
BCD Self-complementing codes Self-complementing code is a code whose arithmetic and logic complement are the same BCD self-complement are designed so the arithmetic diminished complement can be found by taking the logical complement _a bit- by-bit inversion of BCD code 10.0-1
1 0, 0 1 BCD Self-complementing codes • BCD self-complement are designed so the arithmetic diminished complement can be found by taking the logical complement ,a bitby-bit inversion of BCD code • Self-complementing code is a code whose arithmetic and logic complement are the same
BCD Self-complementing codes Decimal 2421 Ex-3. Diminish radix complement 00000011 X=6 00010100 10 0123456789 00100101 1=10-1-6=310 00110110 01000111 10111000 °6ex-3=1001 11001001 11011010 Logic complement of 6ex-3 is 0110 11101011 3ex3=0110 11111100
0 1 2 3 4 5 6 7 8 9 Decimal 2421 Ex-3 0000 0001 0010 0011 0100 1011 1100 1101 1110 1111 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 BCD Self-complementing codes • Diminish radix complement •X=610 •X-1 ’ = 10-1-6=310 • 6ex-3 = 1001 • Logic complement of 6ex-3 is 0110. • 3ex-3 = 0110
Unit Distance Code Decimal binary ra 0 0000 0000 Only one bit change 0001 0001 occurs between successive 0010 0011 value in this code 0011 0010 0100 0110 Gray code 0101 0111 0110 0101 0111 0100 B=Bn1Bn2.B1+B1…B1Bo 12345678901 1000 1100 1001 1101 G=G,G 661G 1010 n 1111 1011 1110 .Bn-1=Gn-1: G=B +10B 12 1100 1010 13 1101 1011 Gn1=Bn1:B=Gi⊕B+1 14 111 1001 15 1111 1000
• Only one bit change occurs between successive value in this code • Gray code 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111 Decimal binary Gray 0000 0001 0011 0010 0110 0111 0101 0100 1100 1101 1111 1110 1010 1011 1001 1000 B =Bn-1Bn-2…Bi+1Bi…B1B0 G =Gn-1Gn-2…Gi+1Gi…G1G0 •Bn-1=Gn-1 ; Gi=Bi+1⊕Bi •Gn-1= Bn-1 ; Bi=Gi⊕Bi+1 Unit Distance Code
Alphanumeric code Alphabet /Punctuation 7-bit/8-bit AScII code American standard code for information nterchange(ASCI〕
Alphanumeric code • Alphabet /Punctuation • 7-bit/8-bit ASCII code – American standard code for information interchange (ASCII)
Signed Number Binary Codes Use the most significant bit position to indicate A 0 sign bit indicate a positive number and a 1sign bit indicate a negative number The remainder lesser significant bits to represent magnitude Signed magnitude code &Complement code
• Use the most significant bit position to indicate sign • A “0” sign bit indicate a positive number ,and a “1” sign bit indicate a negative number • The remainder lesser significant bits to represent magnitude. • Signed magnitude code &Complement code Signed Number Binary Codes