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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
| void main()
{
int loop = 0; /* Initialising loop variable to zero */
PORTA = 0; /* Initialising PORTA and PORTB as OUTPUT PORTS*/
trisa = 0b00000;
PORTB = 0;
trisb = 0b00000000;
asm BCF PORTA,3
PORTB= 0b11111111; /* Blanking the LED2 */
asm BSF PORTA,3
asm BCF PORTA,3
asm BCF PORTA,4
PORTB= 0b11111111; /* Blanking the LED1 */
asm BSF PORTA,4
asm BCF PORTA,4;
while(1)
{
PORTB= 0b11111111; /*Making portB bits as high */
PORTA = 0b00000; /*Making portA bits as LOW */
asm BCF PORTA,3
PORTB=0b00000011; /*Sending the data '0' to LED2 and enabling the clock to display it */
asm BSF PORTA,3
Delay_ms(500);
asm BCF PORTA,3
PORTB=0b10011111; /*Sending the data '1' to LED2 and enabling the clock to display it */
asm BSF PORTA,3
Delay_ms(500);
asm BCF PORTA,3
Delay_ms(500);
PORTB=0b00100101; /*Sending the data '2' to LED2 and enabling the clock to display it */
asm BSF PORTA,3
Delay_ms(500);
asm BCF PORTA,3
Delay_ms(500);
PORTB=0b00001101; /*Sending the data '3' to LED2 and enabling the clock to display it */
asm BSF PORTA,3
Delay_ms(500);
asm BCF PORTA,3
Delay_ms(500);
PORTB= 0b10011001; /*Sending the data '4' to LED2 and enabling the clock to display it */
asm BSF PORTA,3
Delay_ms(500);
asm BCF PORTA,3
Delay_ms(500);
PORTB = 0b01001001; /*Sending the data '5' to LED2 and enabling the clock to display it */
asm BSF PORTA,3
Delay_ms(500);
asm BCF PORTA,3
Delay_ms(500);
PORTB = 0b11000001; /*Sending the data '6' to LED2 and enabling the clock to display it */
asm BSF PORTA,3
Delay_ms(500);
asm BCF PORTA,3
Delay_ms(500);
PORTB = 0b00011111; /*Sending the data '7' to LED2 and enabling the clock to display it */
asm BSF PORTA,3
Delay_ms(500);
asm BCF PORTA,3
Delay_ms(500);
PORTB = 0b00000001; /*Sending the data '8' to LED2 and enabling the clock to display it */
asm BSF PORTA,3
Delay_ms(500);
asm BCF PORTA,3
Delay_ms(500);
PORTB = 0b00011001; /*Sending the data '9' to LED2 and enabling the clock to display it */
asm BSF PORTA,3
Delay_ms(500);
asm BCF PORTA,3
Delay_ms(500);
loop = loop + 1 ; /*incrementing the loop variable */
if(loop == 1) /* checking the loop condition */
{
asm BCF PORTA,4
Delay_ms(500);
PORTB=0b10011111; /*Sending the data '1' to LED1 and enabling the clock to display it */
asm BSF PORTA,4
asm BCF PORTA,4;
}
if(loop == 2)
{
asm BCF PORTA,4
Delay_ms(500);
PORTB=0b00100101; /*Sending the data '2' to LED1 and enabling the clock to display it */
asm BSF PORTA,4
asm BCF PORTA,4;
}
if(loop == 3)
{
asm BCF PORTA,4
Delay_ms(500);
PORTB=0b00001101; /*Sending the data '3' to LED1 and enabling the clock to display it */
asm BSF PORTA,4
asm BCF PORTA,4;
}
if(loop == 4)
{
asm BCF PORTA,4
Delay_ms(500);
PORTB=0b10011001; /*Sending the data '4' to LED1 and enabling the clock to display it */
asm BSF PORTA,4
asm BCF PORTA,4;
}
if(loop == 5)
{
asm BCF PORTA,4
Delay_ms(500);
PORTB=0b01001001; /*Sending the data 5' to LED1 and enabling the clock to display it */
asm BSF PORTA,4
asm BCF PORTA,4;
}
if(loop == 6)
{
asm BCF PORTA,4
Delay_ms(500);
PORTB=0b11000001; /*Sending the data '6' to LED1 and enabling the clock to display it */
asm BSF PORTA,4
asm BCF PORTA,4;
}
if(loop == 7)
{
asm BCF PORTA,4
Delay_ms(500);
PORTB=0b00011111; /*Sending the data '7' to LED1 and enabling the clock to display it */
asm BSF PORTA,4
asm BCF PORTA,4;
}
if(loop == 8)
{
asm BCF PORTA,4
Delay_ms(500);
PORTB=0b00000001; /*Sending the data '8' to LED1 and enabling the clock to display it */
asm BSF PORTA,4
asm BCF PORTA,4;
}
if(loop == 9)
{
asm BCF PORTA,4
Delay_ms(500);
PORTB=0b00011001; /*Sending the data '9' to LED1 and enabling the clock to display it */
asm BSF PORTA,4
asm BCF PORTA,4;
}
}
} |