Seven Segment Display Circuit


4 digit Seven segment display are connected by the method of Multiplexing method. By this method we can reduce the no.of interfacing pins. For example if we interface without multiplexing method we need 32 pins to control the 4 display. In multiplexing method 12 pins are enough.

 Multiplexed seven segment display circuit

Simple understanding of multiplexing concept shown in given :

 4 Segment Display

Function Details in bootseg.h file

Function Name: SetSeg

Return Value: void

Parameters: data: data of the segment, segno: Segment number dott : Dot enable

Description: This routine sets DATA_PORT given data and enable the comm line of the segment for 15mS.



void SetSeg(char data, unsigned short segno, char dott)
{
	switch(data)
	{
		case '0': 	SEG_DATA_PORT = SEG_DIGIT0;
					break;
		case '1': 	SEG_DATA_PORT = SEG_DIGIT1;
					break;
		case '2': 	SEG_DATA_PORT = SEG_DIGIT2;
					break;
		case '3': 	SEG_DATA_PORT = SEG_DIGIT3;
					break;
		case '4': 	SEG_DATA_PORT = SEG_DIGIT4;
					break;
		case '5': 	SEG_DATA_PORT = SEG_DIGIT5;
					break;
		case '6': 	SEG_DATA_PORT = SEG_DIGIT6;
					break;
		case '7': 	SEG_DATA_PORT = SEG_DIGIT7;
					break;
		case '8': 	SEG_DATA_PORT = SEG_DIGIT8;
					break;
		case '9': 	SEG_DATA_PORT = SEG_DIGIT9;
					break;
		default : 	SEG_DATA_PORT = SEG_DIGITE;
					break;
	}
	if(dott != 0) SEG_DATA_PORT |= 0b10000000;
	switch(segno)
	{
		case 1: 	SEG_COMM1 = 1;
					break;
		case 2: 	SEG_COMM2 = 1;
					break;
		case 3: 	SEG_COMM3 = 1;
					break;
		case 4: 	SEG_COMM4 = 1;
					break;
	}
	Delay1KTCYx(75); // Delay of 15ms
	SEG_COMM1 = 0;
	SEG_COMM2 = 0;
	SEG_COMM3 = 0;
	SEG_COMM4 = 0;
}

Function Name: SetSegAll

Return Value: void

Parameters: seg1:data for segment 1, seg2:data for segment 2 seg3:data for segment 3, seg4:data for segment 4

Description: This routine to display four segments one by one. it takes ~60 15mS.


void SetSegAll(char seg1, char seg2, char seg3, char seg4)
{
	SetSeg(seg1, 1, 0);
	SetSeg(seg2, 2, 0);
	SetSeg(seg3, 3, 0);
	SetSeg(seg4, 4, 0);
}

Function Name: SetSegAll

Return Value: void

Description: This routine to make the DATA and COMM Ports as output.


void SegInit(void)
{
	TRIS_SEG_DATA_PORT = 0;
	SEG_DATA_PORT = 0;

	TRIS_SEG_COMM1 = 0;
	SEG_COMM1 = 0;

	TRIS_SEG_COMM2 = 0;
	SEG_COMM2 = 0;

	TRIS_SEG_COMM3 = 0;
	SEG_COMM3 = 0;

	TRIS_SEG_COMM4 = 0;
	SEG_COMM4 = 0;
}


User Comments

No Posts found !

Login to Post a Comment.