0% found this document useful (0 votes)
76 views

EE313 Lab 2

The document describes an experiment to drive a 7-segment display using a PIC18F8722 microcontroller. The experiment has two tasks: 1) Write a program to display the numbers 0 to 9 in sequence on the 7-segment display with a 1 second delay between each number. 2) Modify the program to increment the displayed number by 1 when a key is pressed. The code is written in C, compiled to generate a hex file, and loaded onto the microcontroller. The experiment was successful in programming the microcontroller to control the 7-segment display.

Uploaded by

Carlos Babu
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
76 views

EE313 Lab 2

The document describes an experiment to drive a 7-segment display using a PIC18F8722 microcontroller. The experiment has two tasks: 1) Write a program to display the numbers 0 to 9 in sequence on the 7-segment display with a 1 second delay between each number. 2) Modify the program to increment the displayed number by 1 when a key is pressed. The code is written in C, compiled to generate a hex file, and loaded onto the microcontroller. The experiment was successful in programming the microcontroller to control the 7-segment display.

Uploaded by

Carlos Babu
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

DRIVING 7 SIGMENT DISPLAY THROUGH

EE313 Microprocessor Application Experiment # 2


EE313 MICROPROCESSOR APPLICATIONS

GROUP NAME
Roaia Roota – S11080735
Carlos Babu – S11147301

AIM:

 Design lookup table (array) of equivalent code in hex to display number from 0 to 9.
(Take reference LED segment type Common Cathode)
 Write a C program and compile generate hex file for PIC18F8722
 Display number 0 to 9 in a loop with delay of say 1 sec
 Add more code to use KEY input. If a key is pressed the number will be incremented.

INTRODUCTION
Microprocessor know as an electronic device that can perform an arithmetic and logical
operation such as adding, subtracting, transferring numbers, and comparing 2 numbers or more.
Microprocessor can be found in small device such as smart watch up to big electronic devices
included supercomputers [1]. The experiment going to focused on one of the applications of
microprocessor using a microcontroller (PIC18F8722). Firstly, it going to program the
microprocessor (PIC8F8722), using a PIC C language to do the courting from 0 to nine, and
then display it on the 7-segment display. Secondly, it will be used key input to count from 0 to
nine using the same program with small changed to it. This experiment can be integrated with
many applications that a very useful in our daily basis such as digital clock, timer and many
more.

EQUIPMENT
 PIC18F8722
 DC Power Supply
 7- Segment LED common cathode or anode type

LAB 2 REPORT: Driving 7-segment display through PIC micro-controller


EE313 MICROPROCESSOR APPLICATIONS

MEHODOLOGY
Before starting the experiment, all required component need to connected according to the
PIC18F22 manual setup. To setup microcontroller these steps are followed:

 Connect the ICD to the microcontroller using the Modular cable. ICD has to connect to
the PC by a USB cable for ICD.
 Microcontroller has to powered by a 9v dc power supply
 Check the LED light on the ICD is brightly illuminate (indicate that is connected)
 If not, the ICD not connected probably and cannot detected by the PC.
 It recommended to check all the connection are secure if so, the ICD need to replace
(ICD 40, ICD60)
 If it all satisfy, run ICD program from the PC and run test the Dialog box of ICD will
appear

Fig 1: ICD dialog box

LAB 2 REPORT: Driving 7-segment display through PIC micro-controller


EE313 MICROPROCESSOR APPLICATIONS

 To setup a 7-segment display, the ground (port G) from the microcontroller has to
connect to common ground of 7 segment display.
 The 7-segment display LED connect to Microcontroller port as followed
o F0 to a, F1 to b, F2 to c, F3 to d, F4 to e, F5 to f, F6 to g, and F7 to h.

Fig 1.2 7 segment display pin label

Experiment flow chart

LAB 2 REPORT: Driving 7-segment display through PIC micro-controller


EE313 MICROPROCESSOR APPLICATIONS

RESULTS
Task 1: Display Number 0 to 9 with a delay of 1 Second

Figure 2.0 Shows the sniped code of display number 0 to 9 with the delay of 1 second.

Figure 2.1 Displays the output obtain from the code in figure 1.0.

LAB 2 REPORT: Driving 7-segment display through PIC micro-controller


EE313 MICROPROCESSOR APPLICATIONS

Task 2: Key control input.

Figure 2.2 Illustrate the modified code from figure 1.0. It defines the input KEY in order to
increment by 1.

A. B.
Figure 1.3. Displays the output of the code from figure 1.2.

LAB 2 REPORT: Driving 7-segment display through PIC micro-controller


EE313 MICROPROCESSOR APPLICATIONS

DISCUSSION
The experiment contains two task as shown in the result section. The main objective was to

write a code in PIC C compiler to generate hex file for PIC18F8722 to display digits 0 to 9 in

seven segment LED. Task 1 requires to write a program that design lookup table array that

display digits (0 to 9) with delay of 1 second. As shown in Figure 1.0 was the sniped simple

program in PIC C compiler. The first 4 lines code represent the header file and comes the main

program where the array of hex code for common cathode type are declared before the ‘while

loop’. The while loop keeps the display continued with the delay of 1 second for the condition

“for (t = 0; t<10; t++)” is true. This is how the digits (0 to 9) continued to displayed, non-stop

in seven segment LED works.

In Figure 1.2 shows the result obtain from the task 2. This task requires to modified the code

in task 1 and displays 7 segment LED with control by KEY input to increment 1. Figure 1.3

shows output as the key was entered from the KEYBORD which the digit increases from 6 to

7.

CONCLUSION
The experiment went as expected, it managed to build a circuit for a 7-segment display, and
used a microcontroller as its main driver for the display. For the code generated and compile
in the c language the experiment was successfully.

LAB 2 REPORT: Driving 7-segment display through PIC micro-controller


EE313 MICROPROCESSOR APPLICATIONS

References

[1 D. Wardynski, 10 October 2019. [Online]. Available: https://www.brainspire.com/blog/what-is-


] a-microprocessor-and-how-does-it-work.

[2 University of the Sount Pacific, "EE313 Microprocessor Application," [Online]. Available:


] https://elearn.usp.ac.fj/pluginfile.php/69188/course/section/6620/EE313_Lab2.pdf?time=1581
631787378. [Accessed 24 March 2021].

LAB 2 REPORT: Driving 7-segment display through PIC micro-controller

You might also like