MP Lab Report # 2
MP Lab Report # 2
Objective: To get recognized with the Interface Seven Segment Display with PIC18F452
LAB ASSESSMENT:
Data presentation
Experimental results
Conclusion
Date: Signature:
Lab 2
Interface Seven Segment Display
With PIC18F452
Objectives:
Implementing up/down counter from 0-9
Implementing up/down counter from 00-99
Hardware:
PIC18F452 microcontroller
Seven segment displays (SSDs) Common Anode
Resistances
Introduction:
For the seven segment display you can use the LT-541 or LSD5061-11 chip. Each of the
segments of the display is connected to a pin on the PIC18f452 (the schematic shows how to do
this). In order to light up a segment on the pin must be set to 0V. To turn a segment off the
corresponding pin must be set to 5V. This is simply done by setting the pins on the PIC18f452 to
'1' or '0'. SSD is available in two types Common anode and Common cathode, but common
anode display is most suitable for interfacing with PIC18f452 since PIC18f452 can sink current
better than sourcing it. In common anode the common terminal is tied to +5V through a
resistance and 0V should be provided to the segment you need to glow or turn on.
Procedure:
Open MikroC and make a new project then click on “7” on main toolbar as shown below.
Here on this window you can click on red led to turn them off or on. Now you can get the
decimmle values which you must have to send to I/O port to write your required numeric on
SSD. Here some examples are given
By noting the decimle or hex value for common anode shown above you can easily write your
required code.
Lab Task#1:
Write a code to make a counter from 0 to 9 for a common anode SSD. Show your output in
proteus and on hardware.
CODE:
void main() {
int i;
{ Latb=ssd1[i]; //To get the specific data from array (as ssd1[0]=192, ssd1[1]=249…)and send it to port B
}}}
Schematic:
Hardware
Task 2:
Write a code to make a counter from 9 to 0 for a common anode SSD. Show your output in
proteus and on hardware.
Code:
void main() {
int i;
{ Latb=ssd1[i]; //To get the specific data from array (as ssd1[0]=192, ssd1[1]=249…)and send it to port B
}}}
Schematic:
Hardware:
Conclusion:
In this lab we learned the code of seven segment display and applied it on the hardware through
burning the code by smart-pro 500u. We demonstrated the display of numbers on the seven
segment display both in ascending and descending order.