hello dear members,
this is led chaser code, i want to know that how can i lock any running pattern through external interrupt,
actually i want to freeze pattern when switch is pressed and when switch is not pressed then it should execute as their sequence..
please some body help me for the code.
Code ASM - [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
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
| ;************************************************************
ORG 000H ; starting address
SJMP LABEL
L1 EQU P1.2 ;LED CONECTED TO THIS PORT
L2 EQU P1.3 ;LED CONECTED TO THIS PORT
L3 EQU P1.4 ;LED CONECTED TO THIS PORT
L4 EQU P1.5 ;LED CONECTED TO THIS PORT
L5 EQU P1.6 ;LED CONECTED TO THIS PORT
L6 EQU P1.7 ;LED CONECTED TO THIS PORT
LABEL:
MOV P1,#0FFH
MOV P3,#0FFH
MOV SP,#30H
MOV R3, #05 ;REPEtion of pattern
D1: CALL pattern1
DJNZ R3,D1
MOV R3, #05 ;REPEtion of pattern
D2: CALL pattern2
DJNZ R3,D2
MOV R3, #05 ;REPEtion of pattern
D3: CALL pattern3
DJNZ R3,D3
JMP LABEL
pattern1: CALL ALLON
CALL DELAY
SETB L1
CALL DELAY
SETB L2
CALL DELAY
SETB L3
CALL DELAY
SETB L4
CALL DELAY
SETB L5
CALL DELAY
SETB L6
CALL DELAY
CALL DELAY
SETB L6
CALL DELAY
SETB L5
CALL DELAY
SETB L4
CALL DELAY
SETB L3
CALL DELAY
SETB L2
CALL DELAY
SETB L1
CALL DELAY
RET
pattern2: CALL ALLON
SETB L6
SETB L1
CALL DELAY
CALL ALLON
SETB L5
SETB L2
CALL DELAY
CALL ALLON
SETB L4
SETB L3
CALL DELAY
RET
pattern3: CALL ALLON
CALL DELAY
SETB L6
CALL DELAY
SETB L5
CALL DELAY
SETB L4
CALL DELAY
SETB L3
CALL DELAY
SETB L2
CALL DELAY
SETB L1
CALL DELAY
RET
CLEAR: SETB L1
SETB L2
SETB L3
SETB L4
SETB L5
SETB L6
RET
ALLON: CLR L1
CLR L2
CLR L3
CLR L4
CLR L5
CLR L6
RET
DELAY:
XRL A,#0FFH ;IN CASE OF 2051 CIRCUIT
JNB P3.2,FULL
JB P3.1,$
JNB P3.2,FULL
JNB P3.1,$
JNB P3.2,FULL
RET
;************************************************* ***********************************************
;
FULL: MOV P1,#11000000B
JNB P3.2,$
MOV P1,#11111111B
RET
END |