Lab 21

  • May 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Lab 21 as PDF for free.

More details

  • Words: 2,131
  • Pages: 12
aCSE-311B:

Peripheral & Interfacing Lab

Lab Report: 04 Title of the experiment:

Design & Implement a circuit to display hexadecimal digits using trainer board parallel port cable & seven segment display.

Submitted by

Nahida Sultana Roll No:36 Jyoti Islam Roll No:48 Kaniz Fatema Chowdhury Roll No:66 Group:B 11th Batch

Submitted to Ahsan Raja Chowdhury Lecturer Rumana Nazmul Lecturer Department of CSE University of Dhaka

Prepared by Jyoti Islam Roll: 48

Title of the experiment: Design & implement a circuit to display hexadecimal digits using trainer board, parallel port cable & seven segment display.

Objective:

The objective of the experiment is to design and implement a circuit which display hexadecimal digits in seven segment display as output. To give input, we use data switch of the trainer board, write a code to pass this input from trainer board to computer to seven segment display, so that the digit will be displayed in the seven segment display.

Introduction:

Most digital equipment has some means for displaying information in a form that can be understood readily by the user or operator. This information is often numerical data but can also be alphanumeric (numbers and letters). For displaying the information we need to implement an interface between the computer and the displaying device. We are going to do the same in this experiment. We have the purpose to design & implement a circuit to display hexadecimal digits using trainer board, parallel port cable & seven segment display. For this, we design a circuit using data switch of trainer board, computer, seven segment display and 25 pin parallel cable; write necessary code for driving the circuit and implement it. In the following sections of this report we’ll describe the related theory, design strategies, code, circuit and sample input/output of the experiment.

Theory: One of the simplest and most popular methods for displaying digits uses a seven segment display as shown in Fig.1.1. Seven-segment displays are commonly used in electronics as a method of displaying decimal numeric feedback on the internal operations of devices[1]. A seven segment display, as its name indicates, is composed of seven elements. Individually on or off, they can be combined to produce simplified representations of the alphanumeric information. The seven segments are identified with lower case letters from ‘a’ to ‘g’ and most of them include a decimal point identified with ‘h’. By controlling the

Fig. 1.1: Seven Segment Display current through the segments, some will be light and others will be dark so that the desired character pattern will be generated[2].For example, to display ‘3’, the segments a, b, c, d, and g are made bright while segment ‘f’, ‘e’ and decimal point ‘h’ is dark.

Fig.1.2. Segments of seven segment display To give input, we write a code; the data is passed from trainer board to computer using a circuit consists of logic gates. Then this input is passed to the seven segment display by a parallel port cable which is known as DB-25 male to male parallel port cable (Fig. 1.3). This parallel cable has 25 pins in both sides. Pin 2 to 9 are used as data pin, pin 18 to 25 are used as ground, pin 10 to 15 are used as status port and pin 1,14,16 and 17 are used as control port.

Fig. 1.3: DB-25 parallel port cable. The pin configuration of the cable is shown in fig.1.4. To give input to the circuit, we need to press a key of the keyboard. This value is passed to the seven segment display by parallel port. To use the parallel port we write a code where we call the function outportb( ) with 0x378 and the value received from the keyboard using proper adjustment.

Fig.1.4. Pin configuration of parallel port cable (DB 25 male).

The function outportb() has two parameters. One is the port number, another is the value passed to the port. Here, we use 0x378 as port number. The value changes according to the input. We use a delay loop to watch the output in seven segment display perfectly after each call of outportb( ).

To pass the input from trainer board data switches to processor, we need to use a circuit consists of logic gates. Here we use two input OR gates for the function. The diagram of a two input OR gate is shown in Fig. 1.5.

Fig.1.5. A 2-input OR Gate. IC-74LS32 shown in Fig.1.6 includes 2-input OR Gate. There are four OR Gates in this IC.

Fig.1.6. Pin configuration of IC-74LS32 Here no.1,2;4,5;10,9;and no.13,12 pins are for inputs of the gates where no.3;6;8;10and no.11 pins are for outputs respectively [1].

Design strategies: To design the circuit, first we draw the logic diagram of the circuit, calculate the values to be passed from trainer board to the seven segment display, write the code to drive the circuit and then implement it. The circuit works as an interface between the trainer board, computer and the displaying device. The following sections describe the design strategies of the experiment.

Logic diagram:

The logic diagram of the circuit is shown in fig.

2.1. Fig.2.1.Logic diagram of the circuit. The connector side view of the parallel port cable is shown in fig. 2.2.

Fig.2.2. Connector side view of the parallel port cable.

Data and Analysis:

To take input from trainer board data switch to computer we use a circuit consists of OR gates. The input of a gate is the value given from trainer board, another is 0 to keep the input unchanged. We take this output value to computer using inportb() function. This function has only one parameter which is the related port number. We pass decimal values using outportb() to the displaying device using parallel port cable. But before this, we need to adjust the value so that corresponding hex digit is displayed. The input is converted to a decimal value to represent a hex digit in the seven segment display. This conversion is related with the different segments of the display. For example, to display ‘2’ we need to light the segments ‘a’, ‘b’, ‘g’ ,’e’ and ‘d’. For this we pass 1 to these segments and 0 to segments ‘f’, ‘c’, and ‘h’. So, we choose the decimal value 91 to call the outportb( ) function, because its binary equivalent is 01011011 which is exact as the values of seven segment display for displaying 2. The value calculation is shown in Table 1.

Table 1: Input/Output of the circuit Data pins of the parallel cable

Input

Output

(seven 9 8 7 6 5 4 3 2 segment Segments corresponding to display)

the data pins

Values from (Decimal trainer board values)

A B 0 0 0 0 0 0 0 0 0 1 0 1 0 1 0 1

C D 0 0 0 1 1 0 1 1 0 0 0 1 1 0 1 1

63 6 91 79 102 109 125 7

H

g

f

e

d

c

b

0 0 0 0 0 0 0 0

0 0 1 1 1 1 1 0

1 0 0 0 1 1 1 0

1 0 1 0 0 0 1 0

1 0 1 1 0 1 1 0

1 1 0 1 1 1 1 1

1 1 1 1 1 0 0 1

a

1 0 1 1 0 0 1 1

0 1 2 3 4 5 6 7

1 1 1 1 1 1 1 1

0 0 0 0 1 1 1 1

0 0 0 1 1 0 1 1 0 0 0 1 1 0 1 1

127 103 119 127 57 63 121 113

0 0 0 0 0 0 0 0

1 1 1 1 1 0 1 1

1 1 1 1 0 1 1 1

1 0 1 1 0 1 1 1

1 1 0 1 0 1 1 0

1 1 1 1 1 1 0 0

1 1 1 1 1 1 0 0

1 1 1 1 0 1 1 1

Code: The code used for designing the circuit is as follows: #include<stdio.h> #include #include #include<dos.h> int main( ) { clrscr(); int i; int a[16]={63,6,91,79,102,109,125,7,127,103,119,127,57,63,121,113}; while(!kbhit()) { i=inportb(0x378); if(i>15) i=0; i=i>>3; outportb(0x378,a[i]); delay(1000); } getch(); return 0; }

8 9 A B C D E F

Description of the experiment: In

this section, we’ll describe the necessary equipments for the experiment, the working procedure of it and the sample input/output.

List of equipments: In this experiment, we use several equipments. They are as follows: 1. Computer. 2. Trainer Board. 3. 25 pin Modem Cable (male to male). 4. Seven segment display (IC-74LS432). 5. 2-input OR Gate ICs (IC-74LS32).

6. Wires.

Working procedure:

Now we’ll describe the working procedure

of the experiment. 1. At first, we connect the 25 pin modem cable (male to male) with the parallel port of the computer and the trainer board. 2. Then, we give power supply to the pc and trainer board and set up the seven segment display IC on the breadboard of the trainer board. 3. We test the IC and modem cable to verify if they are working properly or not. For this, we check pin no. 2 to 9 of the parallel port on the trainer board using a LED. 4. We connect one end of a wire to pin no. 2 and the other end to the positive end of the LED and then output 1 to parallel port which has port no. 378h.

5. If the LED is on then pin 2 is ok and we move on to pin 3 and so on. Then we connect pin no. 18 as ground. 6. Then, we ground pin no.3 and 8 of the seven segment display. We check the seven segment display to find out which pin is connected with which segment. For this, each time we connect a pin with data input pin of the trainer board. 7. We give 1 to the pin and see the output in the seven segment display. Thus we can identify the corresponding segment because only that segment is turned on and others are turned off. 8. We find that, the segments ‘a’, ‘b,’ ‘c’, ‘d’, ‘e’, ‘f’, ‘g’ and ‘h’ are connected with pin no. 2, 1, 7, 9, 10, 4, 5 and 6 respectively. 9. Then we connect the input pins of OR gates with data switches of trainer

board and give a constant zero to each of the gates. The output of the gate is connected to the pin 10,11,12,13 and 15 no. pins of parallel port cable respectively. 10.After that, we connect the particular pins (calculated from Table-1) of the trainer board with the seven segment display so that data can pass from computer to it by the modem cable. For example, we connect pin 9 of seven segment display which represent ‘d’ segment, with pin no. 5 of parallel port. 11. After completing the circuit connections, we run the code in the

computer, the circuit takes input from data switch of trainer board and in the seven segment display shows the digit as output. 12.Then, we check the circuit for different inputs and check the output. Since all the output was correct, it can be said that the design and implementation of the circuit is perfect.

Sample input/output: Now we’ll show some sample input and their corresponding output here.

Input (binary value)

1000

1010

1111

Output (seven segment display)

Precautions:

It was really very important for us to have a close look at the following precautions for the successful implementation of our designed circuit. 1. Faulty trainer board and breadboard should not be used. 2. All the pins of the parallel cable specially those of data port must function properly. 3. All the segments of the segment display should work properly. 4. The wires should be with sharp head. Loose wire connection should be avoided. The connection should be given properly so that short circuit can’t occur in the circuit. 5. Overall, a careful visual inspection is needed when implementing the circuit for avoiding all unexpected circumstances.

Discussion: Designing and implementing this circuit was really very exciting for us. When designing the interface, we learn different important things of interfacing devices with computer and sending data from a computer to other device. We use parallel port cable for both to take input from a device and display output in another device. Since, our designed circuit works properly, so it can be said that we have completed our experiment successfully.

References:

During designing and implementing this circuit, we have taken help from some books and websites. They are listed below:

Related books: 1. Ronald J. Tocci, Neal S. Widmer; Digital Systems, Prentice Hall International, Inc. Dave Garza; Eighth edition,2002

Related websites: 2. www. wikipedia.org

Related Documents

Lab 21
May 2020 16
Proceso 21 Lab Ei
May 2020 12
Linux Lab 21 Firewall
December 2019 21
Lab
May 2020 22