Octal to binary and octal to hexa decimal conversions
1. DIGITAL LOGIC DESIGN ASSIGNMENT#1
Afrasiyab Haider BS-IT 4th 16-ARID-02
1
1. How to perform addition in octal number system? Give 3 examples
The addition in octal number system can be performed by following the table below:
+ 0 1 2 3 4 5 6 7
0 0 1 2 3 4 5 6 7
1 1 2 3 4 5 6 7 10
2 2 3 4 5 6 7 10 11
3 3 4 5 6 7 10 11 12
4 4 5 6 7 10 11 12 13
5 5 6 7 10 11 12 13 14
6 6 7 10 11 12 13 14 15
7 7 10 11 12 13 14 15 16
Octal number system is based on only 8 numbers 0-7 so the other upcoming numbers will be written as follows:
8(8) (10(8)), 9(8) (11(8)), 10(8) (12(8)), 11(8) (13(8)), 12(8) (14(8)), 13(8) (15(8)), 14(8) (16(8))
Carry Ans
Examples:
436(8) 3720(8) 5630(8)
+ 512(8) + 6514(8) + 7450(8)
______ ______ _______
1150(8) 12434(8) 15300(8)
1 1 11
2. DIGITAL LOGIC DESIGN ASSIGNMENT#1
Afrasiyab Haider BS-IT 4th 16-ARID-02
2
2. How to perform subtraction in octal number system? Give 3 examples
The subtraction in octal number system is same as in other number systems. The only variation is the
quantity of borrow. In the decimal system, you had to borrow a group of 10(10). In the binary system, you borrowed a
group of 10(2). In the octal system you will borrow a group of 10(8).
Examples: Borrow
5730(8) 1023(8) 7776(8)
- 3520(8) - 424(8) - 7(8)
______ ________ _______
2210(8) 377(8) 7767(8)
3. Conversionfrom Decimalto Octal: Give 3 examples.
a) 1276(10)
8 1276
8 159 - 4
8 19 - 7
2 - 3
Ans= 2374(8)
11 1
3. DIGITAL LOGIC DESIGN ASSIGNMENT#1
Afrasiyab Haider BS-IT 4th 16-ARID-02
3
b) 4359(10)
8 4359
8 544 – 7
8 68 - 0
8 8 - 4
1 - 0
Ans= 10407(8)
c) 6985(10)
8 6985
8 873 - 1
8 109 - 1
8 13 - 5
1 - 5
Ans= 15511 (8)
4. Explain binary codeddecimals and also give their counting table?
BCD or Binary Coded Decimal is that number system or code which has the binary
numbers or digits to represent a decimal number. A decimal number contains 10 digits (0-9). Now the
equivalent binary numbers can be found out of these 10 decimal numbers. In case of BCD the binary number
formed by four binary digits, will be the equivalent code for the given decimal digits. In BCD we can use the
binary number from 0000-1001 only, which are the decimal equivalent from 0-9 respectively. Suppose if a
number have single decimal digit then it’s equivalent Binary Coded Decimal will be the respective four binary
digits of that decimal number and if the number contains two decimal digits then it’s equivalent BCDwill be the
respective eight binary of the given decimal number. Four for the first decimal digit and next four for the second
decimal digit.
Hundreds tens units
0000 0000 0000
4. DIGITAL LOGIC DESIGN ASSIGNMENT#1
Afrasiyab Haider BS-IT 4th 16-ARID-02
4
Table given below shows the binary and BCD codes for the decimal numbers 0 to 15.
From the table below, we can conclude that after 9 the decimal equivalent binary number is of four bit but in
case of BCD it is an eight bit number. This is the main difference between Binary number and binary coded
decimal. For 0 to 9 decimal numbers both binary and BCD is equal but when decimal number is more than one
bit BCD differs from binary.
Decimal number Binary number Binary Coded Decimals
0 0000 0000
1 0001 0001
2 0010 0010
3 0011 0011
4 0100 0100
5 0101 0101
6 0110 0110
7 0111 0111
8 1000 1000
9 1001 1001
10 1010 0001 0000
11 1011 0001 0001
12 1100 0001 0010
13 1101 0001 0011
14 1110 0001 0100
15 1111 0001 0101
5. DIGITAL LOGIC DESIGN ASSIGNMENT#1
Afrasiyab Haider BS-IT 4th 16-ARID-02
5
5. Explain ASCII codes, Give their table?
ASCII was developed from telegraph code. Its first commercial use was as a seven-bit tele
printer code promoted by Bell data services. Work on the ASCII standard began on October 6, 1960, with the
first meeting of the American Standards Association's (ASA) (now the American National Standards Institute or
ANSI) X3.2 subcommittees.
Originally based on the English alphabet, ASCII encodes 128 specified characters into seven-bit integers.
Ninety-five of the encoded characters are printable: these include the digits 0 to 9, lowercase letters a to z,
uppercase letters A to Z, and punctuation symbols. In addition, the original ASCII specification included 33
non-printing control codes which originated with Teletype machines; most of these are now obsolete.
Decimal Alphabet
65 A
66 B
67 C
68 D
69 E
70 F
71 G
72 H
73 I
74 J
75 K
76 L
77 M
78 N
79 O
80 P
81 Q
82 R
Decimal Alphabet
83 S
84 T
85 U
86 V
87 W
88 X
89 Y
90 Z
91-96 Special characters
97 a
98 b
99 c
100 d
101 e
102 f
103 g
104 h
105 i
Decimal Alphabet
106 j
107 k
108 l
109 m
110 n
111 o
112 p
113 q
114 r
115 s
116 t
117 u
118 v
119 w
120 x
121 y
122 z
123-127 Special characters
6. DIGITAL LOGIC DESIGN ASSIGNMENT#1
Afrasiyab Haider BS-IT 4th 16-ARID-02
6
6. Explain Excess-3 code and Give its table.
Excess-3 or 3-excess binary code (often abbreviated as XS-3, 3XS or X3) or Stibitz code (after George
Stibitz, who built a relay-based adding machine in 1937) is a self-complementary binary-coded decimal (BCD)
code and numeral system. It is a biased representation. Excess-3 code was used on some older computers as
well as in cash registers and hand-held portable electronic calculators of the 1970s, among other uses.
Biased codes are a way to represent values with a balanced number of positive and negative numbers
using a pre-specified number N as a biasing value. Biased codes (and Gray codes) are non-weighted codes. In
excess-3 code, numbers are represented as decimal digits, and each digit is represented by four bits as the
digit value plus 3 (the "excess" amount):
The smallest binary number represents the smallest value (0 − excess).
The greatest binary number represents the largest value (2N+1 − excess − 1).
Excess-3 / Stibitz code
Decimal
Excess-
3
Stibitz BCD 8-4-2-1 Binary
3-of-6 CCITT
extension
4-of-
8 Hamming extension
−3 0000
pseudo-
tetrade
N/A N/A N/A N/A
−2 0001
pseudo-
tetrade
N/A N/A N/A N/A
−1 0010 pseudo-
tetrade
N/A N/A N/A N/A
0 0011 0011 0000 0000 …10 …0011
1 0100 0100 0001 0001 …11 …1011
2 0101 0101 0010 0010 …10 …0101
8. DIGITAL LOGIC DESIGN ASSIGNMENT#1
Afrasiyab Haider BS-IT 4th 16-ARID-02
8
7. Explain UNI code:
Unicode is a computing industry standard for the consistent encoding, representation, and
handling of text expressed in most of the world's writing systems. The latest version contains a repertoire of
136,755 characters covering 139 modern and historic scripts, as well as multiple symbol sets. The Unicode
Standard is maintained in conjunction with ISO/IEC 10646, and both are code-for-code identical.
The Unicode Standard consists of a set of code charts for visual reference, an encoding method and set of
standard character encodings, a set of reference data files, and a number of related items, such as character
properties, rules for normalization, decomposition, collation, rendering, and bidirectional display order (for
the correct display of text containing both right-to-left scripts, such as Arabic and Hebrew, and left-to-right
scripts). As of June 2017, the most recent version is Unicode 10.0. The standard is maintained by the Unicode
Consortium.
Unicode can be implemented by different character encodings. The Unicode standard defines UTF-
8, UTF-16, and UTF-32, and several other encodings are in use. The most commonly used encodings are UTF-
8, UTF-16 and UCS-2, a precursor of UTF-16.
UTF-8, dominantly used by websites (over 90%), uses one byte for the first 128 code points, and up to 4 bytes
for other characters. The first 128 Unicode code points are the ASCII characters; so an ASCII text is a UTF-8
text.
9. DIGITAL LOGIC DESIGN ASSIGNMENT#1
Afrasiyab Haider BS-IT 4th 16-ARID-02
9
8. Explain GRAY code
The reflected binary code (RBC), also known just as reflected binary (RB) or Gray
code after Frank Gray, is an ordering of the binary numeral system such that two successive values differ in
only one bit (binary digit). The reflected binary code was originally designed to prevent spurious output
from electromechanical switches. Today, Gray codes are widely used to facilitate error correction in digital
communications such as digital terrestrial television and some cable TV systems.
Bell Labs researcher Frank Gray introduced the term reflected binary code in his 1947 patent
application, remarking that the code had "as yet no recognized name". He derived the name from the fact that
it "may be built up from the conventional binary code by a sort of reflection process".
The code was later named after Gray by others who used it. Two different 1953 patent applications use "Gray
code" as an alternative name for the "reflected binary code"; one of those also lists "minimum error code" and
"cyclic permutation code" among the names. A 1954 patent application refers to "the Bell Telephone Gray
code".
Decimal Binary Gray
0 0000 0000
1 0001 0001
2 0010 0011
3 0011 0010
4 0100 0110
5 0101 0111
6 0110 0101
7 0111 0100
8 1000 1100
9 1001 1101
10 1010 1111
11 1011 1110
12 1100 1010
13 1101 1011
14 1110 1001
15 111 1000