Ex. No. :08 --Interfacing-Seven-segment-display-with-lpc2148

Name: JAVITH FARKHAN S

Roll no 212221240017

Aim:

To configure and display 4 character LED seven segment display and write a c code for displaying number 1 to 9 and A to F

Components required:

Proteus ISIS professional suite, Kiel μ vision 5 Development environment image Figure-01 Internal circuit for seven segment MPX4 display

Theory:

7 Segment Display has seven segments in it and each segment has one LED inside it to display the numbers by lighting up the corresponding segments. Like if you want the 7-segment to display the number "5" then you need to glow segment a,f,g,c, and d by making their corresponding pins high. There are two types of 7-segment displays: Common Cathode and Common Anode, here we are using Common Cathode seven segment display.

image

      Figure-02 Pin configuration for seven segment display  

Below table shows the HEX values and corresponding digit according to LPC2148 pins for common cathode configuration.

image

image Figure -3 Circuit diagram of interfacing for LPX4 - CA

Kiel - Program:

#include <LPC214x.h>
unsigned char dig[]={0x88,0xeb,0x4c,0x49,0x2b,0x19,0x18,0xcb,0x8,0x9,0xa,0x38,0x9c,0x68};
	void delay(unsigned int count)
	{
		int j=0,i=0;
		for(j=0;j<count;j++)
		{
			for(i=0;i<120;i++);
		}
	}
	int main(void)
	{
		unsigned char count=0;
		unsigned int i=0;
		IO0DIR|=(1<<11);//Set Digit control lines as Outputs
		IO0SET=(1<<11);
		IO0DIR|=0x007F8000;
		while(1)
		{
			count++;
			if(count==16)count=0;
			for(i=0;i<800;i++)//change to inc/dec speed of count
			{
				IO0CLR=0x007F8000;
				IO0SET=(dig[count]<<15);
				delay(200);
			}
		}
	}

Output screen shots :

Before Simulation:

image

After Simulation:

image image

Circuit Layout Diagram:

image

Result :

LED seven segment display is interfaced and displayed alpha numeric characters.