Skip to content

Commit 596fd0c

Browse files
authored
Add files via upload
1 parent 853115f commit 596fd0c

File tree

3 files changed

+57
-0
lines changed

3 files changed

+57
-0
lines changed

7 segment/7segment.asm

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// this is an assembly language code for 7 segment interface with ic 8051
2+
3+
ORG 0000H
4+
MOV A,#00H
5+
AGAIN: MOV R5,#10 // counter
6+
MOV DPTR,#500H // DPTR data pointer(uses 16 bit register)
7+
HERE: MOVC A,@A+DPTR // MOVC = MOVE CONTENT FROM CODE MEMORY TO accumulator
8+
// @ means value at address 500H
9+
10+
MOV P3,A
11+
LCALL DELAY
12+
INC DPTR
13+
MOV A,#00H
14+
DJNZ R5,HERE
15+
SJMP AGAIN
16+
17+
18+
DELAY: MOV R0,#07
19+
HERE3:MOV R1,#255
20+
HERE2:MOV R2,#255
21+
HERE1:DJNZ R2,HERE1
22+
DJNZ R1,HERE2
23+
DJNZ R0,HERE3
24+
RET
25+
26+
ORG 500H // FOLLOWING VALUES STORED AT THIS LOCATION
27+
DB 3FH,06H,5BH,4FH,66H,6DH,7DH,07H,7FH,67H //COMMON CATHODE (DISPLAY VALUES FROM 0 TO 9)
28+
; DB assembly directive
29+
END
30+

7 segment/ckt_&_output.png

118 KB
Loading

7 segment/seven_segment.c

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// This is c code for 7 segment interface with IC -8051
2+
3+
#include<reg52.h>
4+
void ms_delay(unsigned int time);
5+
void main()
6+
{
7+
char DB[]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x67}; // common cathode
8+
unsigned char i;
9+
while(1)
10+
{ // code to display 0 to 9 numbers
11+
for(i=0;i<10;i++)
12+
{
13+
P3 =DB[i]; // connected 7 segment to port P3
14+
ms_delay(1000);
15+
}
16+
}
17+
}
18+
19+
void ms_delay(unsigned int time)
20+
{
21+
unsigned int i,j;
22+
// time X 1ms
23+
for(i=0;i<time;i++)
24+
{
25+
for(j=0;j<113;j++); //1ms
26+
}
27+
}

0 commit comments

Comments
 (0)