Back to Home Page of CD3WD Project or Back to list of CD3WD Publications

CLOSE THIS BOOKDigital Teaching Aid (DED Philippinen, 86 p.)
Coding - Lesson 6
Lesson Plan
VIEW THE DOCUMENT(introduction...)
VIEW THE DOCUMENTIntroduction
VIEW THE DOCUMENTASCII code
VIEW THE DOCUMENTExcess-3 code
VIEW THE DOCUMENTGray code
VIEW THE DOCUMENTEncoder
VIEW THE DOCUMENTDecoder
VIEW THE DOCUMENTCode converter
VIEW THE DOCUMENTWorksheet No. 6

Digital Teaching Aid (DED Philippinen, 86 p.)

Coding - Lesson 6

Lesson Plan

Titel: Coding

Objectives:

- Get an idea about the purpose of codes
- Understand the principle of decoder, encoder, and code converter
- Able to design logic circuits for code conversion

Time

Method 1

Topic

Way

Remark



* Review Lesson 5





* Introduction





* ASCII code






- Coding scheme






- Parity bit





* BCD code





* Excess-3 code





* Gray code





* Encoder






- Decimal to BCD encoder





* Decoder






- BCD to decimal decoder





* Code converter






- BCD to Exces-3 code converter





* Review Exercise


Worksheet No. 6


S: Speech
D: Discussion
Q/A: Question/Answer
F: Exercise

B: Boardscript
P: Picture
Ex: Example
HO: Hands-On
WS: Worksheet
HT: Hand-Out


Introduction

Coding

Ex: Coding ® Alphanumeric information in and out of a computer.

ASCII code

ASCII Code (American Standard Code for Information Interchange)

ASCII code is a 7 bit code whose format is

X6 X5 X4 X3 X2 X1 X0

i.e. the letter A is coded as:

1 0 0 0 0 0 1

Coding scheme:

X6 X5 X4

X3

X2

X1

X0

010

011

100

101

110

111

0

0

0

0


0


P


P

0

0

0

1


1

A

Q

a

q

0

0

1

0


2

B

R

b

r

.

.

.

.


.

.

.

.

.

.

.

.

.


.

.

.

.

.

.

.

.

.


.

.

.

.

.

1

1

1

1


0




Ex; The letter B via ASCII in binary:

1 0 0 0 0 1 0

Parity bit

During sending/transmitting data, 1 bit errors may occur. To catch these errors, a parity bit is usually transmitted along with the original bits:

X7 X6 X5 X4 X3 X2 X1 X0
|
parity bit

A parity checker at the receiving end can test for even or odd parity. I.e the transmitting station will set the parity bit always in that way to put the whole number in even parity. If the parity checker at the receiving end determines odd parity it will report an error message.

Now we have 8 bits (1 byte), this is the ideal length because most digital equipment is set up to handle bytes of data.

BCD Code (Binary Coded Decimal)

Each decimal place (0...9) is represented by a binary code.

Ex:

753




0111

0101

0011


7

5

3

The BCD code is a 4 bit code which is very common along digital systems.

Excess-3 code

Also an important 4 bit code

Ex: Convert a decimal number in excess-3 code:

12 ® excess-3

First we add 3 to every decimal digit.

0100

0101

Then we convert the sum in BCD form.

0100 0101 in excess-3 stands for decimal 12.

Fig. 6-1: Convertion table, dec ® BCD® excess-3

Decimal

BCD

Excess - 3

0

0000

001 1

1

0001

0100

2

0010

0101

3

0011

0110

4

0100

0111

5

0101

1000

6

0110

1001

7

0111

1010

8

1000

1011

9

1001

1100

Gray code

Each Gray code number differs from the preceding number by a single bit.

Fig. 6-2: Convertion table, dec ® Gray ® BCD

Decimal

Gray

Binary

0

0000

0000

1

0001

0001

2

0011

0010

3

0010

0011

4

0110

0100

5

0111

0101

6

0101

0110

7

0100

0111

8

1100

1000

9

1101

1001

Encoder

An encoder converts an active input signal into a coded output signal.

Ex: Decimal to BCD encoder

(see Fig. 6-3 on the next page) If switch 9 is pressed:

A B C D = 1 0 0 1

The circuit in Fig. 6-3 is also available as TTL device 74147.


Fig. 6-3: Decimal to BCD encoder

Decoder

A decoder converts a coded input signal into an active output signal.

Ex; Develop a decoder circuit which converts BCD code into decimal.

Fig. 6-4: Truth table, BCD ® decimal

a

b

c

d


23

22

21

20

Dec

0

0

0

0

0

0

0

0

1

1

0

0

1

0

2

0

0

1

1

3

0

1

0

0

4

0

1

0

1

5

0

1

1

0

6

0

1

1

1

7

1

0

0

0

8

1

0

0

1

9

To optimize the circuit we use a Karnaugh map for simplification:


Fig. 6-5: Karnaugh map

For every number in the Karnaugh map we can write an equation:

Now we can draw the logic circuit:


Fig. 6-6: Decoder circuit, BCD ® decimal

Code converter

Code converter are logical networks which convert codes into another.


Fig. 6-7: TTL device, BCD ® excess-3 converter

Fig. 6-8: Convertion table, dec ® BCD® excess-3

Dec

BCD

Excess - 3


a

b

e

d

a1

b1

c1

d1

0

0

0

0

0

0

0

1

1

1

0

0

0

1

0

1

0

0

2

0

0

1

0

0

1

0

1

3

0

0

1

1

0

1

1

0

4

0

1

0

0

0

1

1

1

5

0

1

0

1

1

0

0

0

6

0

1

1

0

1

0

0

1

7

0

1

1

1

1

0

1

0

8

1

0

0

0

1

0

1

1

9

1

0

0

1

1

1

0

0

Worksheet No. 6

No. 1 Develop a decoder circuit for the conversion of the Gray code into the decimal system. Use a Karnaugh map to get a simplified circuit!

Gray code

decimal

d

c

b

a


0

0

0

0

0

0

0

0

1

1

0

0

1

1

2

0

0

1

0

3

0

1

1

0

4

0

1

1

1

5

0

1

0

1

6

0

1

0

0

7

1

1

0

0

8

1

1

0

1

9

X

X

X

X


.

.

.

.


.

.

.

.


No. 2 Develop a code converter for the conversion of the excess 3 code into the 8421 code (BCD).

Complete the truth table!

Use Karnaugh maps to get a simplified circuit!

Excess 3 code

8421 code

dec

d

c

b

a

d1

c1

b1

a1

0

0

0

1

1

0

0

0

0

1

0

1

0

0

0

0

0

1

2

0

1

0

1

0

0

1

0

3

0

1

1

0

0

0

1

1

4

0

1

1

1

0

1

0

0

5

1

0

0

0

0

1

0

1

6

1

0

0

1

0

1

1

0

7

1

0

1

0

0

1

1

1

8

1

0

1

1

1

0

0

0

9

1

1

0

0

1

0

0

1


1

1

0

1

1

0

1

0


1

1

1

0

1

0

1

1


1

1

1

1

1

1

0

0


0

0

0

0

1

1

0

1


0

0

0

1

1

1

1

0


0

0

1

0

1

1

1

1

The lower six rows are redundant.

TO PREVIOUS SECTION OF BOOK TO NEXT SECTION OF BOOK

CD3WD Project Donate