You are on page 1of 13

3/26/24

CPLGCT30
LO G IC C IR C U IT S A N D D ES IG N

INTRODUCTION
Logic & Circuits

Prepared by: Engr. Mark Macawile, MSc, PMP Prepared by: Engr. Mark Macawile, MSc, PMP

1 2

Numbers Used in Digital Electronics Numbers Used in Digital Electronics


1.1 The Decimal Number System 1.2 The Binary Number System
- This system uses the symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. - This system uses only two symbols: 0 and 1.
- Also referred as the Base 10 System or Radix 10 System, because - Also referred as the Base 2 System or Radix 2 System.
of its 10 different symbols. - Each binary digit is called a bit.
- It operates on a place-value principle, where each digit holds a
specific position denoting its value. For instance, in 238, the 8
signifies 8 units (ones place), the 3 represents 30 units (tens
place), and the 2 stands for 200 units (hundreds place).

Logic Circuits & Design Logic Circuits & Design

Prepared by: Engr. Mark Macawile, MSc, PMP Prepared by: Engr. Mark Macawile, MSc, PMP

3 4

1
3/26/24

Counting in Binary and Decimal Binary to Decimal Conversion


Example 1
● Figure 1-1 illustrates binary place values (4s, 8s, and
16s places), where each higher place value
corresponds to an increased power of 2.
● The Least Significant Bit (LSB) is in the 1s place.
● The 1s place equates to 20, the 2s place to 21, the 4s
place to 22, the 8s place to 23, and the 16s place to 24. 1. Assign decimal equivalents - For each '1' bit in the binary number, assign the corresponding
● Whenever a 1 appears in this column, it contributes 1 decimal value of its place value below it. In the example, for the binary number 10011:
to the binary count. Moving leftwards, the second 1 0 0 1 1
position denotes the 2s place. If a 1 appears here, as
( 24) = 16 ( 2 3) = 0 ( 2 2) = 0 ( 2 1) = 2 ( 2 0) = 1
in the case of decimal 2, it adds 2 to the count.
*Only assign decimal values for the 1s

Logic Circuits & Design Logic Circuits & Design

Prepared by: Engr. Mark Macawile, MSc, PMP Prepared by: Engr. Mark Macawile, MSc, PMP

5 6

Binary to Decimal Conversion Binary to Decimal Conversion


Example 1 Example 2

2.) Add the decimal equivalents from the bits with 1s:

1 0 0 1 1 1 0 1 1 1 0

( 24) = 16 ( 2 3) = 0 ( 2 2) = 0 ( 2 1) = 2 ( 2 0) = 1 ( 25) = 32 ( 2 4) = 0 ( 2 3) = 8 ( 2 2) = 4 ( 2 1) = 2 ( 2 0) = 0

16 + 0 + 0 + 2 + 1 = 19 32 + 0 + 8 + 4 + 2 + 0 = 46

Logic Circuits & Design Logic Circuits & Design

Prepared by: Engr. Mark Macawile, MSc, PMP Prepared by: Engr. Mark Macawile, MSc, PMP

7 8

2
3/26/24

Decimal to Binary Conversion


convert the following binary numbers to their decimal 1. Divide the decimal number by 2 - in the
equivalents: example, 43 is divided by 2, leaving 43 with a
remainder of 1.
2. Note the remainder - the remainder is
1. 0011002 = _____10 6. 11110001112 = _______10 either denoted by 0 or 1.
2. 0000112 = _____10 7. 10101010102 = _______10 *If the remainder is even = 0
*If the remainder is odd = 1
3. 0111002 = _____10 8. 11001100112 = _______10 3. The quotients are repeatedly divided by 2
4. 1111002 = _____10 9. 00101001012 = _______10 until the quotient becomes 0.
4. The first remainder is recorded at the
5. 1010102 = _____10 10. 01001001002 = _______10 right. It becomes the LSB (least significant
bit, in the 1s place) in the binary number.

Logic Circuits & Design Logic Circuits & Design

Prepared by: Engr. Mark Macawile, MSc, PMP Prepared by: Engr. Mark Macawile, MSc, PMP

9 10

Numbers Used in Digital Electronics


convert the following decimal numbers to their binary
equivalents: 1.3 The Hexadecimal Number System
1. 6410 = ______2
- This system uses the symbols: 0-9, A, B, C, D, E, and F.
2. 10010= ______2
- Also referred as the Base 16 System or Radix 16 System.
3. 11110= ______2 - The advantage of the hexadecimal system is its usefulness
4. 14510= ______2 in converting directly from a 4-bit binary number.
5. 25510= ______2

Logic Circuits & Design Logic Circuits & Design

Prepared by: Engr. Mark Macawile, MSc, PMP


Prepared by: Engr. Mark Macawile, MSc, PMP

11 12

3
3/26/24

Hexadecimal to Decimal Conversion


1.3 The Hexadecimal Number System
Example 1
- The letter A stands for a count of 10,
for 11, C for 12, for 13, E for 14, and F
for 15.

- The hexadecimal equivalent is 10.


This shows that the hexadecimal
number system uses the place-value 1. Assign positional values - each digit's positional value increases by a power of 16 from right to left.
idea. The 1 (in 10J) stands for 16
2 (162) B (161) 6 (160)
units, while thc 0 stands for zero
units. 256 16 1

Logic Circuits & Design Logic Circuits & Design

Prepared by: Engr. Mark Macawile, MSc, PMP Prepared by: Engr. Mark Macawile, MSc, PMP

13 14

Hexadecimal to Decimal Conversion


Hexadecimal to Decimal Conversion
2.) Convert each digit to its hexadecimal equivalent using
the table and multiply it with the positional value: Example 2 - Convert A3F.C
2 (162) B (161) 6 (160)
A (162) 3 (161) F (160) C (1/161)
256 x 2 = 512 16 x 11 = 176 6x1=6
256 x 2 16 x 11 1 x 15 6 x 0.0625
= 512 = 176 = 15 = 0.75
3.) Add all the products:
512 + 176 + 15 + 0.75 = 2626.7510
2 (162) B (161) 6 (160)
512 + 176 + 6 = 69410

Logic Circuits & Design Logic Circuits & Design

Prepared by: Engr. Mark Macawile, MSc, PMP Prepared by: Engr. Mark Macawile, MSc, PMP

15 16

4
3/26/24

Decimal to Hexadecimal Conversion


convert the following hexadecimal numbers to their
decimal equivalents:
1. C16 = ______10
2. 9F16= ______10
3. D5216= ______10 1. Divide the decimal number by 16.
2. Note the remainder and continue dividing until the quotient becomes 0.
3. Convert the remainders to its hexadecimal equivalent.
4. 67E16= ______10
- The remainder of 13 (D in hexadecimal) becomes the LSD of the hexadecimal number. The
5. ABCD16= ______10 quotient (2) is transferred to the dividend position and divided by 16. This results in a quotient of
0 with a remainder of 2. The 2 becomes the next digit in the hexadecimal number.

Logic Circuits & Design Logic Circuits & Design

Prepared by: Engr. Mark Macawile, MSc, PMP Prepared by: Engr. Mark Macawile, MSc, PMP

17 18

Hexadecimal to Binary Conversion

convert the following decimal numbers to their


hexadecimal equivalents:
1. 810 = ______16
1. Convert each hexadecimal digit to its 4-bit binary representation:
2. 1010= ______16
3 B (11) 9
3. 1410= ______16
(24)(22)(21)(20) (24)(22)(21)(20) (24)(22)(21)(20)
0+0+2+1 8+0+2+1 8 + 0+ 0 + 1
4. 1610= ______16 =3 = 11 =9

5. 8010= ______16 0011 1011 1001

Logic Circuits & Design Logic Circuits & Design

Prepared by: Engr. Mark Macawile, MSc, PMP Prepared by: Engr. Mark Macawile, MSc, PMP

19 20

5
3/26/24

Hexadecimal to Binary Conversion


convert the following hexadecimal numbers to their
binary equivalents:
1. B16 = ______2
2.) Concatenate the binary conversions:

3 B (11) 9 2. E16= ______2


(24)(22)(21)(20) (24)(22)(21)(20) (24)(22)(21)(20) 3. A6416= ______2
0+0+2+1 8+0+2+1 8+0+0+1
=3 = 11 =9
4. 1F.C16= ______2
0011 1011 1001

0011 1011 10012 5. 239.416= ______2

Logic Circuits & Design


Logic Circuits & Design
Prepared by: Engr. Mark Macawile, MSc, PMP
Prepared by: Engr. Mark Macawile, MSc, PMP

21 22

Binary Codes
2.1 Introduction
- Digital systems process only codes consisting of 0s and 1s (binary
codes). That is due to the bistable nature of digital electronic circuits.
- Special binary codes have evolved over the years to perform specific
functions in digital equipment. It operates on a
- In a digital system, electronic translators (called encoders and
decoders) are used for converting from code to code. The following
sections will detail the process of conversion from one code to
another.

Logic & Circuits Logic Circuits & Design

Prepared by: Engr. Mark Macawile, MSc, PMP Prepared by: Engr. Mark Macawile, MSc, PMP

23 24

6
3/26/24

Binary Codes 2.2 Weighted Binary Codes


2.2 Weighted Binary Codes
Decimal to BCD Conversion
- Converting straight binary numbers can
require a lot of time and effort to make a - Figure (a) shows the BCD number
conversion without a calculator. 10010110 is first divided into groups of 4
- The binary-coded decimal (BCD) code makes bits starting at the binary point.
conversion to decimals much easier. - Each group of 4 bits is then converted to
- The 8421 BCD Code, has the most significant its equivalent decimal digit, which is
bit with weight of 8, and the least significant recorded below. The BCD number
bit with the weight of only 1. 10010110 then equals decimal 96.

Based on the BCD Table

Logic Circuits & Design Logic Circuits & Design

Prepared by: Engr. Mark Macawile, MSc, PMP Prepared by: Engr. Mark Macawile, MSc, PMP

25 26

2.2 Weighted Binary Codes


2.2 Weighted Binary Codes
Decimal to BCD Conversion
Fraction Decimal to BCD Conversion
Example - Figure (c) illustrates a fractional decimal
number being converted to its BCD equivalent.
3 5 9
Each decimal digit is converted to its BCD
0011 0101 1001 equivalent.
- The decimal point is dropped down and
becomes the binary point. Figure (c) shows that
6 4 2
decimal 32.84 equals the BCD number
0110 0100 0010 00110010.10000100.

Logic Circuits & Design Logic Circuits & Design

Prepared by: Engr. Mark Macawile, MSc, PMP Prepared by: Engr. Mark Macawile, MSc, PMP

27 28

7
3/26/24

2.2 Weighted Binary Codes


Fraction Decimal to BCD Conversion
convert the following 8421 BCD numbers to their decimal
Example
equivalents:
1. ) 91.30
9 1 .3 0 ● 00010111 = ____
1001 0001 .0011 0000 ● 10000110 = ____
2. ) 58.72 ● 010101000011 = ____
5 8 .7 2 ● 00110010.10010100 = ______
0101 1000 .0111 0010

Logic Circuits & Design Logic Circuits & Design

Prepared by: Engr. Mark Macawile, MSc, PMP Prepared by: Engr. Mark Macawile, MSc, PMP

29 30

2.2 Weighted Binary Codes 2.2 Weighted Binary Codes


BCD to Straight Binary Conversion BCD to Straight Binary Conversion
Step 1.) Divide BCD number 0001 0000 0011.0101 into 4-bit groups starting Step 2.) shows the integer part of the decimal number being translated into
from the binary point. Each 4-bit group is translated into its decimal binary. The 10310 is converted into 1100111 by the repeated divide-by-2
equivalent. procedure.

Logic Circuits & Design Logic Circuits & Design

Prepared by: Engr. Mark Macawile, MSc, PMP Prepared by: Engr. Mark Macawile, MSc, PMP

31 32

8
3/26/24

2.2 Weighted Binary Codes BCD to Straight Binary Conversion


BCD to Straight Binary Conversion Example: Translate the binary number 10001010.101 into its BCD (8421) equivalent.

Step 3.) illustrates the fractional part of the decimal number being translated into 1. The binary number is first converted to

binary. The 0.510 is converted into 0.1, by the repeated multiply-by-2 procedure. The its decimal equivalent. The binary
number 10001010.101 then equals
integer and fractional parts of the binary number are joined. The BCD number
138.62510.
000100000011.0101 then equals the binary number 1100111.1. 2. Each decimal digit is then translated
into its BCD equivalent. Figure 2-4
shows decimal 138.625 being
converted into the BCD number
000100111000.011000100101.
3. The entire conversion then translates
binary 10001010.101, into the BCD
number 000100111000.011000100101.

Logic Circuits & Design Logic Circuits & Design

Prepared by: Engr. Mark Macawile, MSc, PMP Prepared by: Engr. Mark Macawile, MSc, PMP

33 34

Binary Codes 2.3 Non-Weighted Binary Codes


2.3 Non-Weighted Binary Codes XS3 Code
- Some binary codes are non-weighted. Each bit
Convert the decimal number 62 to an equivalent XS3 number.
therefore has no special weighting. Two such Step 1.) add 3 to each decimal digit.
non weighted codes are the excess-3 and Gray Step 2.) convert to binary.
codes.
- The excess-3 (XS3) code is related to the 8421
BCD code because of its binary-coded-decimal
nature.
- Each 4-bit group in the XS3 code equals a
specific decimal digit. Note that the XS3
number is always 3 more than the 8421 BCD
number.

Logic Circuits & Design Logic Circuits & Design

Prepared by: Engr. Mark Macawile, MSc, PMP Prepared by: Engr. Mark Macawile, MSc, PMP

35 36

9
3/26/24

2.3 Non-Weighted Binary Codes 2.3 Non-Weighted Binary Codes


Example: Decimal to XS3 XS3 Code
6 1 3
Convert the 8421 BCD number 01000000 to its XS3 equivalent.
Step 1.) add 3 (binary 0011) to each 4-bit group.
Add 3

6+3=9 1+3 =4 3+3 =6

Convert to Binary

1001 0100 0110

Logic Circuits & Design Logic Circuits & Design

Prepared by: Engr. Mark Macawile, MSc, PMP Prepared by: Engr. Mark Macawile, MSc, PMP

37 38

2.3 Non-Weighted Binary Codes 2.3 Non-Weighted Binary Codes


XS3 Code
Example: BCD to XS3 Consider the conversion from XS3 code to decimal.
Step 1.) subtract 3 (binary 0011) from each 4-bit group.
0100 0001 0011
Step 2.) translate BCD number to its decimal equivalent.
Add 3 (0011)

0100 0001 0011


+0011 +0011 +0011
0111 0100 0110

Logic Circuits & Design Logic Circuits & Design

Prepared by: Engr. Mark Macawile, MSc, PMP Prepared by: Engr. Mark Macawile, MSc, PMP

39 40

10
3/26/24

2.3 Non-Weighted Binary Codes


Example: XS3 to Decimal convert the following 8421 BCD numbers to their XS3
0111 0100 0110 equivalents:
Subtract 3 (0011)
● 0001 = ____
0111 0100 0110
-0011 -0011 -0011 ● 0111 = ____
0100 0001 0011 ● 01100000 = ____
Binary to Decimal ● 00101001 = ______
4 1 3 ● 10000100 = ______

Logic Circuits & Design Logic Circuits & Design


Prepared by: Engr. Mark Macawile, MSc, PMP
Prepared by: Engr. Mark Macawile, MSc, PMP

41 42

2.3 Non-Weighted Binary Codes 2.3 Non-Weighted Binary Codes


Gray Code Gray Code
- The Gray code is another non- - Note that each increase in count (increment)
is accompanied by only 1 bit changing state.
weighted binary code. The Gray
Look at the change from the decimal 7 line
code is not a BCD-type code. to the decimal 8 line. In binary all four bits
Figure 2-8 compares the Gray change state (from 0111 to 1000).
code with equivalent binary and - In this same line the Gray code has only the
decimal numbers. left bit changing state (0100 to 1100). This
change of a single bit in the code group per
increment characteristic is important in
some applications in digital electronics.

Logic Circuits & Design Logic Circuits & Design

Prepared by: Engr. Mark Macawile, MSc, PMP Prepared by: Engr. Mark Macawile, MSc, PMP

43 44

11
3/26/24

2.3 Non-Weighted Binary Codes 2.3 Non-Weighted Binary Codes


Gray Code Rules for Converting Binary Numbers to Gray Code
- Figure (a) shows the binary number 0010
being translated into its Gray code 1. The left bit is the same in the Gray code as

equivalent. Start at the MSB of the binary in the binary number.


number. Transfer this to the left position 2. Add the MSB to the bit on its immediate
right and record the sum (neglect any carry)
in the Gray code as shown by the
below in the Gray code line.
downward arrow.
3. Continue adding bits to the bits on their
- Now add the 8s bit to the next bit over (4s
right and recording sums until the LSB is
bit). The sum is 0 (0 + 0 = 0), which is reached.
transferred down and written as the 4. The Gray code number will always have the
second bit from the left in the Gray code. same number of bits as the binary number.

Logic Circuits & Design Logic Circuits & Design

Prepared by: Engr. Mark Macawile, MSc, PMP Prepared by: Engr. Mark Macawile, MSc, PMP

45 46

2.3 Non-Weighted Binary Codes 2.3 Non-Weighted Binary Codes


Gray Code Gray Code
Example: Convert the Gray code number 1001 to its equivalent binary number.
Example: Convert the 6-bit Gray code number 011011 to its 6-bit binary equivalent.
- First the left bit (1) is transferred down to the binary line to form the 8s bit. The 8s bit of the binary
- Start at the left and follow the arrows in Fig. (b).
number is transferred (see arrow) up above the next Gray code bit, and the two are added.
- Follow the procedure, remembering that a (1 + 1 = 10). The carry of 1 is neglected, and the 0 is
- The sum is 1 (1 + 0 = 1), which is written in the 4s bit place in the binary number. The 4s bit (1) is
recorded on the binary line.
then added to the next Gray code bit. - Figure (b) shows that the Gray code number 011011 is equal to the. binary number 010010.
- The sum is 1 (1 + 0 = 1). This 1 is written in the 2s place of the binary number. The binary 2s bit (1) is
added to the right Gray code bit. The sum is 0 (1 + 1 = 10) because the carry is neglected.

Logic Circuits & Design Logic Circuits & Design

Prepared by: Engr. Mark Macawile, MSc, PMP Prepared by: Engr. Mark Macawile, MSc, PMP

47 48

12
3/26/24

Binary Codes Binary Codes


2.4 Alphanumeric Codes 2.4 Alphanumeric Codes
- Binary 0s and 1s have been used to represent - Codes that can represent both letters and
various numbers to this point. Bits can also be numbers are called alphanumeric codes.
coded to represent letters of the alphabet, Another alphanumeric code that is widely
numbers, and punctuation marks. used is the Extended Binary-Coded Decimal
- One such 7-bit code is the American Standard Interchange Code (EBCDIC).
Code for Information Interchange (ASCII) - The EBCDIC code is an 8-bit code and therefore
- It is extensively used in small computer can have more variations and characters than
systems to translate from the keyboard the ASCII code can have. The EBCDIC code is
characters to computer language. used in many larger computer systems.

Logic Circuits & Design Logic Circuits & Design

Prepared by: Engr. Mark Macawile, MSc, PMP Prepared by: Engr. Mark Macawile, MSc, PMP

49 50

• Provide actual application of Gray Code

Feedback & Control Systems Logic Circuit & Design

Prepared by: Engr. Mark Macawile, MSc, PMP Prepared by: Engr. Mark Macawile, MSc, PMP

51 52

13

You might also like