hii frds..
need your help.working on 89s52 project.there are already SIX 7-seg dislplay. i want to add one more 7-segment display controlled by an interrupt.when i m doing it is affecting switching of other six display..how can i do multiplexing with two differnt pattern such that one numerical pattern for six 7-seg. and the other symbolic pattern for seventh seg. display controlling with interrupt.
how shld i add code?
the working code of six 7 seg. display is below.
Code C - [expand ] 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
void seven_seg_disp ( void ) interrupt 1 //timer 0 isr
{
EA = 0 ;
TR0 = 0 ;
if ( i == 1 )
{
P0_1 = 1 ; P0_2 = 1 ; P0_3 = 1 ;
P0_4 = 1 ; P0_5 = 1 ; //P0 = 0xFE; //1add //1111 1110
P2 = lcddata[ Li[ 0 ] ] ; //0
P0_0 = 0 ;
i++;
}
else if ( i == 2 )
{
P0_0 = 1 ; P0_2 = 1 ; P0_3 = 1 ;
P0_4 = 1 ; P0_5 = 1 ; //P0 = 0xFD; //2add //1111 1101
P2 = lcddata[ Li[ 1 ] ] ; //1
P0_1 = 0 ;
i++;
}
else if ( i == 3 )
{
P0_0 = 1 ; P0_1 = 1 ; P0_3 = 1 ;
P0_4 = 1 ; P0_5 = 1 ; //P0 = 0xFB; //3add //1111 1011
P2 = lcddata[ Li[ 2 ] ] ; //2
P0_2 = 0 ;
i++;
}
else if ( i == 4 )
{
P0_0 = 1 ; P0_1 = 1 ; P0_2 = 1 ;
P0_4 = 1 ; P0_5 = 1 ; //P0 = 0xF7; //4add //1111 0111
P2 = lcddata[ Li[ 3 ] ] ; //3
P0_3 = 0 ;
i++;
}
else if ( i == 5 )
{
P0_0 = 1 ; P0_1 = 1 ; P0_2 = 1 ; P0_3 = 1 ;
P0_5 = 1 ; //P0 = 0xEF; //5add //1110 1111
P2 = lcddata[ Li[ 4 ] ] ; //4
P0_4 = 0 ;
i++;
}
else if ( i == 6 )
{
P0_0 = 1 ; P0_1 = 1 ; P0_2 = 1 ; P0_3 = 1 ;
P0_4 = 1 ; //P0 = 0xDF; //6add // 1101 1111
P2 = lcddata[ Li[ 5 ] ] ; //5
P0_5 = 0 ;
i = 1 ;
}
}
TH0 = 0xFC ;
TL0 = 0xEC ; // TL0 = 0xBE;
TR0 = 1 ;
EA = 1 ;
}
void appetizers ( void )
{
P1 = 0x00 ; //to disable stapper motor
P0 = 0xFF ;
TMOD = 0x11 ; //timer 0 and timer 1 both used
EA = 1 ;
ET0 = 1 ;
EX0 = 1 ; //enables external int0
IT0 = 1 ; //ex interrupt0 in falling edge mode
TH0 = 0xFC ;
TL0 = 0xEC ; //TL0 = 0xBE;
TR0 = 1 ; //timer0 is used for refreshing 7seg array.
}
Last edited: Mar 14, 2014