-
Notifications
You must be signed in to change notification settings - Fork 0
/
Code.asm
164 lines (138 loc) · 5.75 KB
/
Code.asm
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
164
#include <lpc213x.h>
void delay(unsigned int count) {
unsigned int i = 0, j = 0;
for (i = 0; i < count; i++) {
for (j = 0; j < 1000; j++);
}
}
int main() {
PINSEL0 = 0;
IODIR0 = 0X003FFFFF;
while (1) {
if ((IOPIN0 & (1 << 22)) == 0) {
IOSET0 |= (1 << 19);
IOCLR0 |= (1 << 7) | (1 << 8) | (1 << 9) | (1 << 10) | (1 << 11) | (1 << 12) | (1 << 13);
// segment A //9
IOSET0 |= (1 << 18);
IOCLR0 |= (1 << 16);
IOSET0 |= (1 << 0) | (1 << 1) | (1 << 2) | (1 << 3) | (1 << 5) | (1 << 6);
IOCLR0 |= (1 << 4);
delay(300);
// segment A //8
IOSET0 |= (1 << 0) | (1 << 1) | (1 << 2) | (1 << 3) | (1 << 4) | (1 << 5) | (1 << 6);
delay(300);
// segment A //7
IOSET0 |= (1 << 0) | (1 << 1) | (1 << 2);
IOCLR0 |= (1 << 3) | (1 << 4) | (1 << 5) | (1 << 6);
delay(300);
// segment A //6
IOSET0 |= (1 << 0) | (1 << 2) | (1 << 3) | (1 << 4) | (1 << 5) | (1 << 6);
IOCLR0 |= (1 << 1);
delay(300);
// segment A //5
IOSET0 |= (1 << 0) | (1 << 2) | (1 << 3) | (1 << 5) | (1 << 6);
IOCLR0 |= (1 << 1) | (1 << 4);
delay(200);
IOCLR0 |= (1 << 18);
delay(100);
// segment A //4
IOSET0 |= (1 << 18) | (1 << 1) | (1 << 2) | (1 << 5) | (1 << 6);
IOCLR0 |= (1 << 0) | (1 << 3) | (1 << 4);
delay(200);
IOCLR0 |= (1 << 18);
delay(100);
// segment A //3
IOSET0 |= (1 << 18) | (1 << 14) | (1 << 0) | (1 << 1) | (1 << 2) | (1 << 3) | (1 << 6);
IOCLR0 |= (1 << 4) | (1 << 5);
delay(200);
IOCLR0 |= (1 << 18) | (1 << 14);
delay(100);
// segment A //2
IOSET0 |= (1 << 18) | (1 << 14) | (1 << 0) | (1 << 1) | (1 << 3) | (1 << 4) | (1 << 6);
IOCLR0 |= (1 << 2) | (1 << 5);
delay(200);
IOCLR0 |= (1 << 18) | (1 << 14);
delay(100);
// segment A //1
IOSET0 |= (1 << 18) | (1 << 14) | (1 << 1) | (1 << 2);
IOCLR0 |= (1 << 0) | (1 << 3) | (1 << 4) | (1 << 5) | (1 << 6);
delay(200);
IOCLR0 |= (1 << 18) | (1 << 14);
delay(100);
// segment A //0
IOSET0 |= (1 << 18) | (1 << 14) | (1 << 0) | (1 << 1) | (1 << 2) | (1 << 3) | (1 << 4) | (1 << 5);
IOCLR0 |= (1 << 6);
delay(200);
IOCLR0 |= (1 << 18) | (1 << 14);
delay(100);
// YELLOW A
IOSET0 |= (1 << 17);
IOCLR0 |= (1 << 0) | (1 << 1) | (1 << 2) | (1 << 3) | (1 << 4) | (1 << 5) | (1 << 6);
delay(300);
IOCLR0 |= (1 << 17) | (1 << 19);
IOSET0 |= (1 << 16);
IOCLR0 |= (1 << 0) | (1 << 1) | (1 << 2) | (1 << 3) | (1 << 4) | (1 << 5) | (1 << 6);
// SEGMENT B //9
IOSET0 |= (1 << 21);
IOCLR0 |= (1 << 15);
IOSET0 |= (1 << 7) | (1 << 8) | (1 << 9) | (1 << 10) | (1 << 12) | (1 << 13);
IOCLR0 |= (1 << 11);
delay(300);
// segment B //8
IOSET0 |= (1 << 7) | (1 << 8) | (1 << 9) | (1 << 10) | (1 << 11) | (1 << 12) | (1 << 13);
delay(300);
// segment B //7
IOSET0 |= (1 << 7) | (1 << 8) | (1 << 9);
IOCLR0 |= (1 << 10) | (1 << 11) | (1 << 12) | (1 << 13);
delay(300);
// segment B //6
IOSET0 |= (1 << 7) | (1 << 9) | (1 << 10) | (1 << 11) | (1 << 12) | (1 << 13);
IOCLR0 |= (1 << 8);
delay(300);
// segment B //5
IOSET0 |= (1 << 7) | (1 << 9) | (1 << 10) | (1 << 12) | (1 << 13);
IOCLR0 |= (1 << 8) | (1 << 11);
delay(200);
IOCLR0 |= (1 << 21);
delay(100);
// segment B //4
IOSET0 |= (1 << 21) | (1 << 8) | (1 << 9) | (1 << 12) | (1 << 13);
IOCLR0 |= (1 << 7) | (1 << 10) | (1 << 11);
delay(200);
IOCLR0 |= (1 << 21);
delay(100);
// segment B //3
IOSET0 |= (1 << 21) | (1 << 15) | (1 << 7) | (1 << 8) | (1 << 9) | (1 << 10) | (1 << 13);
IOCLR0 |= (1 << 11) | (1 << 12);
delay(200);
IOCLR0 |= (1 << 21) | (1 << 15);
delay(100);
// segment B //2
IOSET0 |= (1 << 21) | (1 << 15) | (1 << 7) | (1 << 8) | (1 << 10) | (1 << 11) | (1 << 13);
IOCLR0 |= (1 << 9) | (1 << 12);
delay(200);
IOCLR0 |= (1 << 21) | (1 << 15);
delay(100);
// segment B //1
IOSET0 |= (1 << 21) | (1 << 15) | (1 << 8) | (1 << 9);
IOCLR0 |= (1 << 7) | (1 << 10) | (1 << 11) | (1 << 12) | (1 << 13);
delay(200);
IOCLR0 |= (1 << 21) | (1 << 15);
delay(100);
// segment B //0
IOSET0 |= (1 << 21) | (1 << 15) | (1 << 7) | (1 << 8) | (1 << 9) | (1 << 10) | (1 << 11) | (1 << 12);
IOCLR0 |= (1 << 13);
delay(200);
IOCLR0 |= (1 << 21) | (1 << 15);
delay(100);
// YELLOW B
IOSET0 |= (1 << 20);
IOCLR0 |= (1 << 7) | (1 << 8) | (1 << 9) | (1 << 10) | (1 << 11) | (1 << 12) | (1 << 13);
delay(500);
IOCLR0 |= (1 << 20) | (1 << 16);
}
else if ((IOPIN0 & (1 << 23)) == 0) {
IOCLR0 |= 0x003FFFFF; // Clear all bits from 0 to 21
}
}
}