Mình có đoạn chương trình, sử dụng bàn phím Hex để điều khiển đèn Led.
ORG 0000H
SJMP MAIN
MAIN:
MOV P1,#11101111B
JNB P1.3,SW1
JNB P1.2,SW2
JNB P1.1,SW3
JNB P1.0,SW4
MOV P1,#11011111B
JNB P1.3,SW5
JNB P1.2,SW6
JNB P1.1,SW7
JNB P1.0,SW8
MOV P1,#10111111B
JNB P1.3,SW9
JNB P1.3,SW10
LJMP MAIN
SW1:
MOV P2,#01111111B
CALL DELAY1
MOV P2,#10111111B
CALL DELAY1
MOV P2,#11011111B
CALL DELAY1
MOV P2,#11101111B
CALL DELAY1
MOV P2,#11111110B
CALL DELAY1
MOV P3,#11101111B
CALL DELAY1
MOV P3,#11111110B
CALL DELAY1
MOV P3,#11111101B
CALL DELAY1
MOV P3,#11111011B
CALL DELAY1
MOV P3,#11110111B
CALL DELAY1
MOV P3,#01111111B
CALL DELAY1
MOV P2,#11110111B
CALL DELAY1
MOV P2,#11111011B
CALL DELAY1
MOV P2,#11111101B
CALL DELAY1
MOV P3,#11011111B
CALL DELAY1
MOV P3,#10111111B
CALL DELAY1
SJMP MAIN
SW2:
MOV P3,#10111111B
CALL DELAY1
MOV P3,#11011111B
CALL DELAY1
MOV P2,#11111101B
CALL DELAY1
MOV P2,#11111011B
CALL DELAY1
MOV P2,#11110111B
CALL DELAY1
MOV P3,#01111111B
CALL DELAY1
MOV P3,#11110111B
CALL DELAY1
MOV P3,#11111011B
CALL DELAY1
MOV P3,#11111101B
CALL DELAY1
MOV P3,#11111110B
CALL DELAY1
MOV P3,#11101111B
CALL DELAY1
MOV P2,#11111110B
CALL DELAY1
MOV P2,#11101111B
CALL DELAY1
MOV P2,#11011111B
CALL DELAY1
MOV P2,#10111111B
CALL DELAY1
MOV P2,#01111111B
CALL DELAY1
SJMP MAIN
SW3:
MOV P2,#10111111B
CALL DELAY2
MOV P2,#00111111B
CALL DELAY2
MOV P2,#00110111B
CALL DELAY2
MOV P3,#01111111B
CALL DELAY2
MOV P3,#01110111B
CALL DELAY2
MOV P3,#01110011B
CALL DELAY2
MOV P3,#00110011B
CALL DELAY2
MOV P2,#00110011B
CALL DELAY2
MOV P3,#00110001B
CALL DELAY2
MOV P3,#00110000B
CALL DELAY2
MOV P3,#00100000B
CALL DELAY2
MOV P2,#00110010B
CALL DELAY2
MOV P2,#00100010B
CALL DELAY2
MOV P2,#00000010B
CALL DELAY2
MOV P2,#00000000B
CALL DELAY2
MOV P3,#00000000B
CALL DELAY2
CALL DELAY2
CALL DELAY2
CALL DELAY2
CALL DELAY2
SJMP MAIN
SW4:
MOV P2,#10010000B
MOV P3,#00001001B
CALL DELAY2
CALL DELAY2
CALL DELAY2
CALL DELAY2
CALL DELAY2
SJMP MAIN
SW5:
MOV P2,#10010110B
MOV P3,#01101001B
CALL DELAY2
CALL DELAY2
CALL DELAY2
CALL DELAY2
CALL DELAY2
SJMP MAIN
SW6:
MOV P2,#00000110B
MOV P3,#01100000B
CALL DELAY2
CALL DELAY2
CALL DELAY2
CALL DELAY2
CALL DELAY2
SJMP MAIN
SW7:
MOV P2,#11111001B
MOV P3,#10011111B
CALL DELAY2
CALL DELAY2
CALL DELAY2
CALL DELAY2
CALL DELAY2
SJMP MAIN
SW8:
MOV P2,#00000000B
MOV P3,#00000000B
CALL DELAY2
CALL DELAY2
CALL DELAY2
CALL DELAY2
CALL DELAY2
SJMP MAIN
SW9:
MOV P2,#01101001B
MOV P3,#10010110B
CALL DELAY2
CALL DELAY2
CALL DELAY2
CALL DELAY2
CALL DELAY2
SJMP MAIN
SW10:
MOV P2,#01111111B
CALL DELAY1
MOV P2,#10111111B
CALL DELAY1
MOV P2,#11011111B
CALL DELAY1
MOV P2,#11101111B
CALL DELAY1
MOV P2,#11111110B
CALL DELAY1
MOV P2,#11111101B
CALL DELAY1
MOV P2,#11111011B
CALL DELAY1
MOV P2,#11110111B
CALL DELAY1
MOV P3,#01111111B
CALL DELAY1
MOV P3,#10111111B
CALL DELAY1
MOV P3,#11011111B
CALL DELAY1
MOV P3,#11101111B
CALL DELAY1
MOV P3,#11111110B
CALL DELAY1
MOV P3,#11111101B
CALL DELAY1
MOV P3,#11111011B
CALL DELAY1
MOV P3,#11110111B
CALL DELAY1
SJMP MAIN
DELAY1:
MOV R0,#100
MOV R1,#100
MOV R2,#50
LAP1:
DJNZ R0,LAP1
MOV R0,#100
DJNZ R1,LAP1
MOV R1,#100
DJNZ R2,LAP1
RET
DELAY2:
MOV R0,#100
MOV R1,#100
MOV R2,#50
LAP2:
DJNZ R0,LAP2
MOV R0,#100
DJNZ R1,LAP2
MOV R1,#100
DJNZ R2,LAP2
RET
END
Nhưng khổ cái nó lại thông báo lỗi như thế...
XETTIEP PAGE 1
0000 1 ORG 0000H
0000 8000 2 SJMP MAIN
0002 3 MAIN:
0002 7500EF 4 MOV P1,#11101111B
****------------------------------------^
****ERROR #2: Undefined symbol
0005 300024 5 JNB P1.3,SW1
****------------------------------------^--^
****ERROR #2: Undefined symbol
****ERROR #17: Illegal bit designator
0008 300000 6 JNB P1.2,SW2
****---------------------------------^
****ERROR #18: Target address exceeds relative address range
000B 300000 7 JNB P1.1,SW3
****---------------------------------^
****ERROR #18: Target address exceeds relative address range
000E 300000 8 JNB P1.0,SW4
****---------------------------------^
****ERROR #18: Target address exceeds relative address range
0011 7500DF 9 MOV P1,#11011111B
****----------------------------^
****ERROR #2: Undefined symbol
0014 300000 10 JNB P1.3,SW5
****---------------------------------^
****ERROR #18: Target address exceeds relative address range
0017 300000 11 JNB P1.2,SW6
****---------------------------------^
****ERROR #18: Target address exceeds relative address range
001A 300000 12 JNB P1.1,SW7
****---------------------------------^
****ERROR #18: Target address exceeds relative address range
001D 300000 13 JNB P1.0,SW8
****---------------------------------^
****ERROR #18: Target address exceeds relative address range
0020 7500BF 14 MOV P1,#10111111B
****----------------------------^
****ERROR #2: Undefined symbol
0023 300000 15 JNB P1.3,SW9
****---------------------------------^
****ERROR #18: Target address exceeds relative address range
0026 300000 16 JNB P1.3,SW10
****----------------------------^--^-^
****ERROR #2: Undefined symbol
****ERROR #17: Illegal bit designator
****ERROR #18: Target address exceeds relative address range
0029 020002 17 LJMP MAIN
002C 18 SW1:
002C 75007F 19 MOV P2,#01111111B
****----------------------------^
****ERROR #2: Undefined symbol
002F 12024A 20 CALL DELAY1
0032 7500BF 21 MOV P2,#10111111B
****----------------------------^
****ERROR #2: Undefined symbol
0035 12024A 22 CALL DELAY1
0038 7500DF 23 MOV P2,#11011111B
****----------------------------^
****ERROR #2: Undefined symbol
XETTIEP PAGE 2
003B 12024A 24 CALL DELAY1
003E 7500EF 25 MOV P2,#11101111B
****----------------------------^
****ERROR #2: Undefined symbol
0041 12024A 26 CALL DELAY1
0044 7500FE 27 MOV P2,#11111110B
****----------------------------^
****ERROR #2: Undefined symbol
0047 12024A 28 CALL DELAY1
004A 7500EF 29 MOV P3,#11101111B
****----------------------------^
****ERROR #2: Undefined symbol
004D 12024A 30 CALL DELAY1
0050 7500FE 31 MOV P3,#11111110B
****----------------------------^
****ERROR #2: Undefined symbol
0053 12024A 32 CALL DELAY1
0056 7500FD 33 MOV P3,#11111101B
****----------------------------^
****ERROR #2: Undefined symbol
0059 12024A 34 CALL DELAY1
005C 7500FB 35 MOV P3,#11111011B
****----------------------------^
****ERROR #2: Undefined symbol
005F 12024A 36 CALL DELAY1
0062 7500F7 37 MOV P3,#11110111B
****----------------------------^
****ERROR #2: Undefined symbol
0065 12024A 38 CALL DELAY1
0068 75007F 39 MOV P3,#01111111B
****----------------------------^
****ERROR #2: Undefined symbol
006B 12024A 40 CALL DELAY1
006E 7500F7 41 MOV P2,#11110111B
****----------------------------^
****ERROR #2: Undefined symbol
0071 12024A 42 CALL DELAY1
0074 7500FB 43 MOV P2,#11111011B
****----------------------------^
****ERROR #2: Undefined symbol
0077 12024A 44 CALL DELAY1
007A 7500FD 45 MOV P2,#11111101B
****----------------------------^
****ERROR #2: Undefined symbol
007D 12024A 46 CALL DELAY1
0080 7500DF 47 MOV P3,#11011111B
****----------------------------^
****ERROR #2: Undefined symbol
0083 12024A 48 CALL DELAY1
0086 7500BF 49 MOV P3,#10111111B
****----------------------------^
****ERROR #2: Undefined symbol
0089 12024A 50 CALL DELAY1
008C 8000 51 SJMP MAIN
****-----------------------------^
****ERROR #18: Target address exceeds relative address range
008E 52 SW2:
008E 7500BF 53 MOV P3,#10111111B
****----------------------------^
XETTIEP PAGE 3
****ERROR #2: Undefined symbol
0091 12024A 54 CALL DELAY1
0094 7500DF 55 MOV P3,#11011111B
0097 12024A 56 CALL DELAY1
009A 7500FD 57 MOV P2,#11111101B
009D 12024A 58 CALL DELAY1
00A0 7500FB 59 MOV P2,#11111011B
00A3 12024A 60 CALL DELAY1
00A6 7500F7 61 MOV P2,#11110111B
00A9 12024A 62 CALL DELAY1
00AC 75007F 63 MOV P3,#01111111B
00AF 12024A 64 CALL DELAY1
00B2 7500F7 65 MOV P3,#11110111B
00B5 12024A 66 CALL DELAY1
00B8 7500FB 67 MOV P3,#11111011B
00BB 12024A 68 CALL DELAY1
00BE 7500FD 69 MOV P3,#11111101B
00C1 12024A 70 CALL DELAY1
00C4 7500FE 71 MOV P3,#11111110B
00C7 12024A 72 CALL DELAY1
00CA 7500EF 73 MOV P3,#11101111B
00CD 12024A 74 CALL DELAY1
00D0 7500FE 75 MOV P2,#11111110B
00D3 12024A 76 CALL DELAY1
00D6 7500EF 77 MOV P2,#11101111B
00D9 12024A 78 CALL DELAY1
00DC 7500DF 79 MOV P2,#11011111B
00DF 12024A 80 CALL DELAY1
00E2 7500BF 81 MOV P2,#10111111B
00E5 12024A 82 CALL DELAY1
00E8 75007F 83 MOV P2,#01111111B
00EB 12024A 84 CALL DELAY1
00EE 8000 85 SJMP MAIN
00F0 86 SW3:
00F0 7500BF 87 MOV P2,#10111111B
00F3 12025B 88 CALL DELAY2
00F6 75003F 89 MOV P2,#00111111B
00F9 12025B 90 CALL DELAY2
00FC 750037 91 MOV P2,#00110111B
00FF 12025B 92 CALL DELAY2
0102 75007F 93 MOV P3,#01111111B
0105 12025B 94 CALL DELAY2
0108 750077 95 MOV P3,#01110111B
010B 12025B 96 CALL DELAY2
010E 750073 97 MOV P3,#01110011B
0111 12025B 98 CALL DELAY2
0114 750033 99 MOV P3,#00110011B
0117 12025B 100 CALL DELAY2
011A 750033 101 MOV P2,#00110011B
011D 12025B 102 CALL DELAY2
0120 750031 103 MOV P3,#00110001B
0123 12025B 104 CALL DELAY2
0126 750030 105 MOV P3,#00110000B
0129 12025B 106 CALL DELAY2
012C 750020 107 MOV P3,#00100000B
012F 12025B 108 CALL DELAY2
0132 750032 109 MOV P2,#00110010B
XETTIEP PAGE 4
0135 12025B 110 CALL DELAY2
0138 750022 111 MOV P2,#00100010B
013B 12025B 112 CALL DELAY2
013E 750002 113 MOV P2,#00000010B
0141 12025B 114 CALL DELAY2
0144 750000 115 MOV P2,#00000000B
0147 12025B 116 CALL DELAY2
014A 750000 117 MOV P3,#00000000B
014D 12025B 118 CALL DELAY2
0150 12025B 119 CALL DELAY2
0153 12025B 120 CALL DELAY2
0156 12025B 121 CALL DELAY2
0159 12025B 122 CALL DELAY2
015C 8000 123 SJMP MAIN
015E 124 SW4:
015E 750090 125 MOV P2,#10010000B
0161 750009 126 MOV P3,#00001001B
0164 12025B 127 CALL DELAY2
0167 12025B 128 CALL DELAY2
016A 12025B 129 CALL DELAY2
016D 12025B 130 CALL DELAY2
0170 12025B 131 CALL DELAY2
0173 8000 132 SJMP MAIN
0175 133 SW5:
0175 750096 134 MOV P2,#10010110B
0178 750069 135 MOV P3,#01101001B
017B 12025B 136 CALL DELAY2
017E 12025B 137 CALL DELAY2
0181 12025B 138 CALL DELAY2
0184 12025B 139 CALL DELAY2
0187 12025B 140 CALL DELAY2
018A 8000 141 SJMP MAIN
018C 142 SW6:
018C 750006 143 MOV P2,#00000110B
018F 750060 144 MOV P3,#01100000B
0192 12025B 145 CALL DELAY2
0195 12025B 146 CALL DELAY2
0198 12025B 147 CALL DELAY2
019B 12025B 148 CALL DELAY2
019E 12025B 149 CALL DELAY2
01A1 8000 150 SJMP MAIN
01A3 151 SW7:
01A3 7500F9 152 MOV P2,#11111001B
01A6 75009F 153 MOV P3,#10011111B
01A9 12025B 154 CALL DELAY2
01AC 12025B 155 CALL DELAY2
01AF 12025B 156 CALL DELAY2
01B2 12025B 157 CALL DELAY2
01B5 12025B 158 CALL DELAY2
01B8 8000 159 SJMP MAIN
01BA 160 SW8:
01BA 750000 161 MOV P2,#00000000B
01BD 750000 162 MOV P3,#00000000B
01C0 12025B 163 CALL DELAY2
01C3 12025B 164 CALL DELAY2
01C6 12025B 165 CALL DELAY2
01C9 12025B 166 CALL DELAY2
01CC 12025B 167 CALL DELAY2
XETTIEP PAGE 5
01CF 8000 168 SJMP MAIN
01D1 169 SW9:
01D1 750069 170 MOV P2,#01101001B
01D4 750096 171 MOV P3,#10010110B
01D7 12025B 172 CALL DELAY2
01DA 12025B 173 CALL DELAY2
01DD 12025B 174 CALL DELAY2
01E0 12025B 175 CALL DELAY2
01E3 12025B 176 CALL DELAY2
01E6 8000 177 SJMP MAIN
01E8 178 SW10:
01E8 75007F 179 MOV P2,#01111111B
01EB 12024A 180 CALL DELAY1
01EE 7500BF 181 MOV P2,#10111111B
01F1 12024A 182 CALL DELAY1
01F4 7500DF 183 MOV P2,#11011111B
01F7 12024A 184 CALL DELAY1
01FA 7500EF 185 MOV P2,#11101111B
01FD 12024A 186 CALL DELAY1
0200 7500FE 187 MOV P2,#11111110B
0203 12024A 188 CALL DELAY1
0206 7500FD 189 MOV P2,#11111101B
0209 12024A 190 CALL DELAY1
020C 7500FB 191 MOV P2,#11111011B
020F 12024A 192 CALL DELAY1
0212 7500F7 193 MOV P2,#11110111B
0215 12024A 194 CALL DELAY1
0218 75007F 195 MOV P3,#01111111B
021B 12024A 196 CALL DELAY1
021E 7500BF 197 MOV P3,#10111111B
0221 12024A 198 CALL DELAY1
0224 7500DF 199 MOV P3,#11011111B
0227 12024A 200 CALL DELAY1
022A 7500EF 201 MOV P3,#11101111B
022D 12024A 202 CALL DELAY1
0230 7500FE 203 MOV P3,#11111110B
0233 12024A 204 CALL DELAY1
0236 7500FD 205 MOV P3,#11111101B
0239 12024A 206 CALL DELAY1
023C 7500FB 207 MOV P3,#11111011B
023F 12024A 208 CALL DELAY1
0242 7500F7 209 MOV P3,#11110111B
0245 12024A 210 CALL DELAY1
0248 8000 211 SJMP MAIN
024A 212 DELAY1:
024A 7864 213 MOV R0,#100
024C 7964 214 MOV R1,#100
024E 7A32 215 MOV R2,#50
0250 216 LAP1:
0250 D8FE 217 DJNZ R0,LAP1
0252 7864 218 MOV R0,#100
0254 D9FA 219 DJNZ R1,LAP1
0256 7964 220 MOV R1,#100
0258 DAF6 221 DJNZ R2,LAP1
025A 22 222 RET
025B 223 DELAY2:
025B 7864 224 MOV R0,#100
025D 7964 225 MOV R1,#100
XETTIEP PAGE 6
025F 7A32 226 MOV R2,#50
0261 227 LAP2:
0261 D8FE 228 DJNZ R0,LAP2
0263 7864 229 MOV R0,#100
0265 D9FA 230 DJNZ R1,LAP2
0267 7964 231 MOV R1,#100
0269 DAF6 232 DJNZ R2,LAP2
026B 22 233 RET
234 END
VERSION 1.2h ASSEMBLY COMPLETE, 50 ERRORS FOUND
ERROR SUMMARY:
Line #4, ERROR #2: Undefined symbol
Line #5, ERROR #2: Undefined symbol
Line #5, ERROR #17: Illegal bit designator
Line #6, ERROR #2: Undefined symbol
Line #6, ERROR #17: Illegal bit designator
Line #6, ERROR #18: Target address exceeds relative address range
Line #7, ERROR #2: Undefined symbol
Line #7, ERROR #17: Illegal bit designator
Line #7, ERROR #18: Target address exceeds relative address range
Line #8, ERROR #2: Undefined symbol
Line #8, ERROR #17: Illegal bit designator
Line #8, ERROR #18: Target address exceeds relative address range
Line #9, ERROR #2: Undefined symbol
Line #10, ERROR #2: Undefined symbol
Line #10, ERROR #17: Illegal bit designator
Line #10, ERROR #18: Target address exceeds relative address range
Line #11, ERROR #2: Undefined symbol
Line #11, ERROR #17: Illegal bit designator
Line #11, ERROR #18: Target address exceeds relative address range
Line #12, ERROR #2: Undefined symbol
Line #12, ERROR #17: Illegal bit designator
Line #12, ERROR #18: Target address exceeds relative address range
Line #13, ERROR #2: Undefined symbol
Line #13, ERROR #17: Illegal bit designator
Line #13, ERROR #18: Target address exceeds relative address range
Line #14, ERROR #2: Undefined symbol
Line #15, ERROR #2: Undefined symbol
Line #15, ERROR #17: Illegal bit designator
Line #15, ERROR #18: Target address exceeds relative address range
Line #16, ERROR #2: Undefined symbol
Line #16, ERROR #17: Illegal bit designator
Line #16, ERROR #18: Target address exceeds relative address range
Line #19, ERROR #2: Undefined symbol
Line #21, ERROR #2: Undefined symbol
Line #23, ERROR #2: Undefined symbol
Line #25, ERROR #2: Undefined symbol
Line #27, ERROR #2: Undefined symbol
Line #29, ERROR #2: Undefined symbol
Line #31, ERROR #2: Undefined symbol
Line #33, ERROR #2: Undefined symbol
Line #35, ERROR #2: Undefined symbol
Line #37, ERROR #2: Undefined symbol
Line #39, ERROR #2: Undefined symbol
Line #41, ERROR #2: Undefined symbol
Line #43, ERROR #2: Undefined symbol
Line #45, ERROR #2: Undefined symbol
Line #47, ERROR #2: Undefined symbol
Line #49, ERROR #2: Undefined symbol
XETTIEP PAGE 7
Line #51, ERROR #18: Target address exceeds relative address range
Line #53, ERROR #2: Undefined symbol
Line #53, ERROR #42: More errors detected, not listed
XETTIEP PAGE 8
DELAY1 . . . . . . . . . . . . . C ADDR 024AH
DELAY2 . . . . . . . . . . . . . C ADDR 025BH
LAP1 . . . . . . . . . . . . . . C ADDR 0250H
LAP2 . . . . . . . . . . . . . . C ADDR 0261H
MAIN . . . . . . . . . . . . . . C ADDR 0002H
P1 . . . . . . . . . . . . . . . UNDEFINED
P2 . . . . . . . . . . . . . . . UNDEFINED
P3 . . . . . . . . . . . . . . . UNDEFINED
SW1. . . . . . . . . . . . . . . C ADDR 002CH
SW10 . . . . . . . . . . . . . . C ADDR 01E8H
SW2. . . . . . . . . . . . . . . C ADDR 008EH
SW3. . . . . . . . . . . . . . . C ADDR 00F0H
SW4. . . . . . . . . . . . . . . C ADDR 015EH
SW5. . . . . . . . . . . . . . . C ADDR 0175H
SW6. . . . . . . . . . . . . . . C ADDR 018CH
SW7. . . . . . . . . . . . . . . C ADDR 01A3H
SW8. . . . . . . . . . . . . . . C ADDR 01BAH
SW9. . . . . . . . . . . . . . . C ADDR 01D1H
Em không bết phải khắc phục làm sao...có bác nào giúp mình với...thanks!
ORG 0000H
SJMP MAIN
MAIN:
MOV P1,#11101111B
JNB P1.3,SW1
JNB P1.2,SW2
JNB P1.1,SW3
JNB P1.0,SW4
MOV P1,#11011111B
JNB P1.3,SW5
JNB P1.2,SW6
JNB P1.1,SW7
JNB P1.0,SW8
MOV P1,#10111111B
JNB P1.3,SW9
JNB P1.3,SW10
LJMP MAIN
SW1:
MOV P2,#01111111B
CALL DELAY1
MOV P2,#10111111B
CALL DELAY1
MOV P2,#11011111B
CALL DELAY1
MOV P2,#11101111B
CALL DELAY1
MOV P2,#11111110B
CALL DELAY1
MOV P3,#11101111B
CALL DELAY1
MOV P3,#11111110B
CALL DELAY1
MOV P3,#11111101B
CALL DELAY1
MOV P3,#11111011B
CALL DELAY1
MOV P3,#11110111B
CALL DELAY1
MOV P3,#01111111B
CALL DELAY1
MOV P2,#11110111B
CALL DELAY1
MOV P2,#11111011B
CALL DELAY1
MOV P2,#11111101B
CALL DELAY1
MOV P3,#11011111B
CALL DELAY1
MOV P3,#10111111B
CALL DELAY1
SJMP MAIN
SW2:
MOV P3,#10111111B
CALL DELAY1
MOV P3,#11011111B
CALL DELAY1
MOV P2,#11111101B
CALL DELAY1
MOV P2,#11111011B
CALL DELAY1
MOV P2,#11110111B
CALL DELAY1
MOV P3,#01111111B
CALL DELAY1
MOV P3,#11110111B
CALL DELAY1
MOV P3,#11111011B
CALL DELAY1
MOV P3,#11111101B
CALL DELAY1
MOV P3,#11111110B
CALL DELAY1
MOV P3,#11101111B
CALL DELAY1
MOV P2,#11111110B
CALL DELAY1
MOV P2,#11101111B
CALL DELAY1
MOV P2,#11011111B
CALL DELAY1
MOV P2,#10111111B
CALL DELAY1
MOV P2,#01111111B
CALL DELAY1
SJMP MAIN
SW3:
MOV P2,#10111111B
CALL DELAY2
MOV P2,#00111111B
CALL DELAY2
MOV P2,#00110111B
CALL DELAY2
MOV P3,#01111111B
CALL DELAY2
MOV P3,#01110111B
CALL DELAY2
MOV P3,#01110011B
CALL DELAY2
MOV P3,#00110011B
CALL DELAY2
MOV P2,#00110011B
CALL DELAY2
MOV P3,#00110001B
CALL DELAY2
MOV P3,#00110000B
CALL DELAY2
MOV P3,#00100000B
CALL DELAY2
MOV P2,#00110010B
CALL DELAY2
MOV P2,#00100010B
CALL DELAY2
MOV P2,#00000010B
CALL DELAY2
MOV P2,#00000000B
CALL DELAY2
MOV P3,#00000000B
CALL DELAY2
CALL DELAY2
CALL DELAY2
CALL DELAY2
CALL DELAY2
SJMP MAIN
SW4:
MOV P2,#10010000B
MOV P3,#00001001B
CALL DELAY2
CALL DELAY2
CALL DELAY2
CALL DELAY2
CALL DELAY2
SJMP MAIN
SW5:
MOV P2,#10010110B
MOV P3,#01101001B
CALL DELAY2
CALL DELAY2
CALL DELAY2
CALL DELAY2
CALL DELAY2
SJMP MAIN
SW6:
MOV P2,#00000110B
MOV P3,#01100000B
CALL DELAY2
CALL DELAY2
CALL DELAY2
CALL DELAY2
CALL DELAY2
SJMP MAIN
SW7:
MOV P2,#11111001B
MOV P3,#10011111B
CALL DELAY2
CALL DELAY2
CALL DELAY2
CALL DELAY2
CALL DELAY2
SJMP MAIN
SW8:
MOV P2,#00000000B
MOV P3,#00000000B
CALL DELAY2
CALL DELAY2
CALL DELAY2
CALL DELAY2
CALL DELAY2
SJMP MAIN
SW9:
MOV P2,#01101001B
MOV P3,#10010110B
CALL DELAY2
CALL DELAY2
CALL DELAY2
CALL DELAY2
CALL DELAY2
SJMP MAIN
SW10:
MOV P2,#01111111B
CALL DELAY1
MOV P2,#10111111B
CALL DELAY1
MOV P2,#11011111B
CALL DELAY1
MOV P2,#11101111B
CALL DELAY1
MOV P2,#11111110B
CALL DELAY1
MOV P2,#11111101B
CALL DELAY1
MOV P2,#11111011B
CALL DELAY1
MOV P2,#11110111B
CALL DELAY1
MOV P3,#01111111B
CALL DELAY1
MOV P3,#10111111B
CALL DELAY1
MOV P3,#11011111B
CALL DELAY1
MOV P3,#11101111B
CALL DELAY1
MOV P3,#11111110B
CALL DELAY1
MOV P3,#11111101B
CALL DELAY1
MOV P3,#11111011B
CALL DELAY1
MOV P3,#11110111B
CALL DELAY1
SJMP MAIN
DELAY1:
MOV R0,#100
MOV R1,#100
MOV R2,#50
LAP1:
DJNZ R0,LAP1
MOV R0,#100
DJNZ R1,LAP1
MOV R1,#100
DJNZ R2,LAP1
RET
DELAY2:
MOV R0,#100
MOV R1,#100
MOV R2,#50
LAP2:
DJNZ R0,LAP2
MOV R0,#100
DJNZ R1,LAP2
MOV R1,#100
DJNZ R2,LAP2
RET
END
Nhưng khổ cái nó lại thông báo lỗi như thế...
XETTIEP PAGE 1
0000 1 ORG 0000H
0000 8000 2 SJMP MAIN
0002 3 MAIN:
0002 7500EF 4 MOV P1,#11101111B
****------------------------------------^
****ERROR #2: Undefined symbol
0005 300024 5 JNB P1.3,SW1
****------------------------------------^--^
****ERROR #2: Undefined symbol
****ERROR #17: Illegal bit designator
0008 300000 6 JNB P1.2,SW2
****---------------------------------^
****ERROR #18: Target address exceeds relative address range
000B 300000 7 JNB P1.1,SW3
****---------------------------------^
****ERROR #18: Target address exceeds relative address range
000E 300000 8 JNB P1.0,SW4
****---------------------------------^
****ERROR #18: Target address exceeds relative address range
0011 7500DF 9 MOV P1,#11011111B
****----------------------------^
****ERROR #2: Undefined symbol
0014 300000 10 JNB P1.3,SW5
****---------------------------------^
****ERROR #18: Target address exceeds relative address range
0017 300000 11 JNB P1.2,SW6
****---------------------------------^
****ERROR #18: Target address exceeds relative address range
001A 300000 12 JNB P1.1,SW7
****---------------------------------^
****ERROR #18: Target address exceeds relative address range
001D 300000 13 JNB P1.0,SW8
****---------------------------------^
****ERROR #18: Target address exceeds relative address range
0020 7500BF 14 MOV P1,#10111111B
****----------------------------^
****ERROR #2: Undefined symbol
0023 300000 15 JNB P1.3,SW9
****---------------------------------^
****ERROR #18: Target address exceeds relative address range
0026 300000 16 JNB P1.3,SW10
****----------------------------^--^-^
****ERROR #2: Undefined symbol
****ERROR #17: Illegal bit designator
****ERROR #18: Target address exceeds relative address range
0029 020002 17 LJMP MAIN
002C 18 SW1:
002C 75007F 19 MOV P2,#01111111B
****----------------------------^
****ERROR #2: Undefined symbol
002F 12024A 20 CALL DELAY1
0032 7500BF 21 MOV P2,#10111111B
****----------------------------^
****ERROR #2: Undefined symbol
0035 12024A 22 CALL DELAY1
0038 7500DF 23 MOV P2,#11011111B
****----------------------------^
****ERROR #2: Undefined symbol
XETTIEP PAGE 2
003B 12024A 24 CALL DELAY1
003E 7500EF 25 MOV P2,#11101111B
****----------------------------^
****ERROR #2: Undefined symbol
0041 12024A 26 CALL DELAY1
0044 7500FE 27 MOV P2,#11111110B
****----------------------------^
****ERROR #2: Undefined symbol
0047 12024A 28 CALL DELAY1
004A 7500EF 29 MOV P3,#11101111B
****----------------------------^
****ERROR #2: Undefined symbol
004D 12024A 30 CALL DELAY1
0050 7500FE 31 MOV P3,#11111110B
****----------------------------^
****ERROR #2: Undefined symbol
0053 12024A 32 CALL DELAY1
0056 7500FD 33 MOV P3,#11111101B
****----------------------------^
****ERROR #2: Undefined symbol
0059 12024A 34 CALL DELAY1
005C 7500FB 35 MOV P3,#11111011B
****----------------------------^
****ERROR #2: Undefined symbol
005F 12024A 36 CALL DELAY1
0062 7500F7 37 MOV P3,#11110111B
****----------------------------^
****ERROR #2: Undefined symbol
0065 12024A 38 CALL DELAY1
0068 75007F 39 MOV P3,#01111111B
****----------------------------^
****ERROR #2: Undefined symbol
006B 12024A 40 CALL DELAY1
006E 7500F7 41 MOV P2,#11110111B
****----------------------------^
****ERROR #2: Undefined symbol
0071 12024A 42 CALL DELAY1
0074 7500FB 43 MOV P2,#11111011B
****----------------------------^
****ERROR #2: Undefined symbol
0077 12024A 44 CALL DELAY1
007A 7500FD 45 MOV P2,#11111101B
****----------------------------^
****ERROR #2: Undefined symbol
007D 12024A 46 CALL DELAY1
0080 7500DF 47 MOV P3,#11011111B
****----------------------------^
****ERROR #2: Undefined symbol
0083 12024A 48 CALL DELAY1
0086 7500BF 49 MOV P3,#10111111B
****----------------------------^
****ERROR #2: Undefined symbol
0089 12024A 50 CALL DELAY1
008C 8000 51 SJMP MAIN
****-----------------------------^
****ERROR #18: Target address exceeds relative address range
008E 52 SW2:
008E 7500BF 53 MOV P3,#10111111B
****----------------------------^
XETTIEP PAGE 3
****ERROR #2: Undefined symbol
0091 12024A 54 CALL DELAY1
0094 7500DF 55 MOV P3,#11011111B
0097 12024A 56 CALL DELAY1
009A 7500FD 57 MOV P2,#11111101B
009D 12024A 58 CALL DELAY1
00A0 7500FB 59 MOV P2,#11111011B
00A3 12024A 60 CALL DELAY1
00A6 7500F7 61 MOV P2,#11110111B
00A9 12024A 62 CALL DELAY1
00AC 75007F 63 MOV P3,#01111111B
00AF 12024A 64 CALL DELAY1
00B2 7500F7 65 MOV P3,#11110111B
00B5 12024A 66 CALL DELAY1
00B8 7500FB 67 MOV P3,#11111011B
00BB 12024A 68 CALL DELAY1
00BE 7500FD 69 MOV P3,#11111101B
00C1 12024A 70 CALL DELAY1
00C4 7500FE 71 MOV P3,#11111110B
00C7 12024A 72 CALL DELAY1
00CA 7500EF 73 MOV P3,#11101111B
00CD 12024A 74 CALL DELAY1
00D0 7500FE 75 MOV P2,#11111110B
00D3 12024A 76 CALL DELAY1
00D6 7500EF 77 MOV P2,#11101111B
00D9 12024A 78 CALL DELAY1
00DC 7500DF 79 MOV P2,#11011111B
00DF 12024A 80 CALL DELAY1
00E2 7500BF 81 MOV P2,#10111111B
00E5 12024A 82 CALL DELAY1
00E8 75007F 83 MOV P2,#01111111B
00EB 12024A 84 CALL DELAY1
00EE 8000 85 SJMP MAIN
00F0 86 SW3:
00F0 7500BF 87 MOV P2,#10111111B
00F3 12025B 88 CALL DELAY2
00F6 75003F 89 MOV P2,#00111111B
00F9 12025B 90 CALL DELAY2
00FC 750037 91 MOV P2,#00110111B
00FF 12025B 92 CALL DELAY2
0102 75007F 93 MOV P3,#01111111B
0105 12025B 94 CALL DELAY2
0108 750077 95 MOV P3,#01110111B
010B 12025B 96 CALL DELAY2
010E 750073 97 MOV P3,#01110011B
0111 12025B 98 CALL DELAY2
0114 750033 99 MOV P3,#00110011B
0117 12025B 100 CALL DELAY2
011A 750033 101 MOV P2,#00110011B
011D 12025B 102 CALL DELAY2
0120 750031 103 MOV P3,#00110001B
0123 12025B 104 CALL DELAY2
0126 750030 105 MOV P3,#00110000B
0129 12025B 106 CALL DELAY2
012C 750020 107 MOV P3,#00100000B
012F 12025B 108 CALL DELAY2
0132 750032 109 MOV P2,#00110010B
XETTIEP PAGE 4
0135 12025B 110 CALL DELAY2
0138 750022 111 MOV P2,#00100010B
013B 12025B 112 CALL DELAY2
013E 750002 113 MOV P2,#00000010B
0141 12025B 114 CALL DELAY2
0144 750000 115 MOV P2,#00000000B
0147 12025B 116 CALL DELAY2
014A 750000 117 MOV P3,#00000000B
014D 12025B 118 CALL DELAY2
0150 12025B 119 CALL DELAY2
0153 12025B 120 CALL DELAY2
0156 12025B 121 CALL DELAY2
0159 12025B 122 CALL DELAY2
015C 8000 123 SJMP MAIN
015E 124 SW4:
015E 750090 125 MOV P2,#10010000B
0161 750009 126 MOV P3,#00001001B
0164 12025B 127 CALL DELAY2
0167 12025B 128 CALL DELAY2
016A 12025B 129 CALL DELAY2
016D 12025B 130 CALL DELAY2
0170 12025B 131 CALL DELAY2
0173 8000 132 SJMP MAIN
0175 133 SW5:
0175 750096 134 MOV P2,#10010110B
0178 750069 135 MOV P3,#01101001B
017B 12025B 136 CALL DELAY2
017E 12025B 137 CALL DELAY2
0181 12025B 138 CALL DELAY2
0184 12025B 139 CALL DELAY2
0187 12025B 140 CALL DELAY2
018A 8000 141 SJMP MAIN
018C 142 SW6:
018C 750006 143 MOV P2,#00000110B
018F 750060 144 MOV P3,#01100000B
0192 12025B 145 CALL DELAY2
0195 12025B 146 CALL DELAY2
0198 12025B 147 CALL DELAY2
019B 12025B 148 CALL DELAY2
019E 12025B 149 CALL DELAY2
01A1 8000 150 SJMP MAIN
01A3 151 SW7:
01A3 7500F9 152 MOV P2,#11111001B
01A6 75009F 153 MOV P3,#10011111B
01A9 12025B 154 CALL DELAY2
01AC 12025B 155 CALL DELAY2
01AF 12025B 156 CALL DELAY2
01B2 12025B 157 CALL DELAY2
01B5 12025B 158 CALL DELAY2
01B8 8000 159 SJMP MAIN
01BA 160 SW8:
01BA 750000 161 MOV P2,#00000000B
01BD 750000 162 MOV P3,#00000000B
01C0 12025B 163 CALL DELAY2
01C3 12025B 164 CALL DELAY2
01C6 12025B 165 CALL DELAY2
01C9 12025B 166 CALL DELAY2
01CC 12025B 167 CALL DELAY2
XETTIEP PAGE 5
01CF 8000 168 SJMP MAIN
01D1 169 SW9:
01D1 750069 170 MOV P2,#01101001B
01D4 750096 171 MOV P3,#10010110B
01D7 12025B 172 CALL DELAY2
01DA 12025B 173 CALL DELAY2
01DD 12025B 174 CALL DELAY2
01E0 12025B 175 CALL DELAY2
01E3 12025B 176 CALL DELAY2
01E6 8000 177 SJMP MAIN
01E8 178 SW10:
01E8 75007F 179 MOV P2,#01111111B
01EB 12024A 180 CALL DELAY1
01EE 7500BF 181 MOV P2,#10111111B
01F1 12024A 182 CALL DELAY1
01F4 7500DF 183 MOV P2,#11011111B
01F7 12024A 184 CALL DELAY1
01FA 7500EF 185 MOV P2,#11101111B
01FD 12024A 186 CALL DELAY1
0200 7500FE 187 MOV P2,#11111110B
0203 12024A 188 CALL DELAY1
0206 7500FD 189 MOV P2,#11111101B
0209 12024A 190 CALL DELAY1
020C 7500FB 191 MOV P2,#11111011B
020F 12024A 192 CALL DELAY1
0212 7500F7 193 MOV P2,#11110111B
0215 12024A 194 CALL DELAY1
0218 75007F 195 MOV P3,#01111111B
021B 12024A 196 CALL DELAY1
021E 7500BF 197 MOV P3,#10111111B
0221 12024A 198 CALL DELAY1
0224 7500DF 199 MOV P3,#11011111B
0227 12024A 200 CALL DELAY1
022A 7500EF 201 MOV P3,#11101111B
022D 12024A 202 CALL DELAY1
0230 7500FE 203 MOV P3,#11111110B
0233 12024A 204 CALL DELAY1
0236 7500FD 205 MOV P3,#11111101B
0239 12024A 206 CALL DELAY1
023C 7500FB 207 MOV P3,#11111011B
023F 12024A 208 CALL DELAY1
0242 7500F7 209 MOV P3,#11110111B
0245 12024A 210 CALL DELAY1
0248 8000 211 SJMP MAIN
024A 212 DELAY1:
024A 7864 213 MOV R0,#100
024C 7964 214 MOV R1,#100
024E 7A32 215 MOV R2,#50
0250 216 LAP1:
0250 D8FE 217 DJNZ R0,LAP1
0252 7864 218 MOV R0,#100
0254 D9FA 219 DJNZ R1,LAP1
0256 7964 220 MOV R1,#100
0258 DAF6 221 DJNZ R2,LAP1
025A 22 222 RET
025B 223 DELAY2:
025B 7864 224 MOV R0,#100
025D 7964 225 MOV R1,#100
XETTIEP PAGE 6
025F 7A32 226 MOV R2,#50
0261 227 LAP2:
0261 D8FE 228 DJNZ R0,LAP2
0263 7864 229 MOV R0,#100
0265 D9FA 230 DJNZ R1,LAP2
0267 7964 231 MOV R1,#100
0269 DAF6 232 DJNZ R2,LAP2
026B 22 233 RET
234 END
VERSION 1.2h ASSEMBLY COMPLETE, 50 ERRORS FOUND
ERROR SUMMARY:
Line #4, ERROR #2: Undefined symbol
Line #5, ERROR #2: Undefined symbol
Line #5, ERROR #17: Illegal bit designator
Line #6, ERROR #2: Undefined symbol
Line #6, ERROR #17: Illegal bit designator
Line #6, ERROR #18: Target address exceeds relative address range
Line #7, ERROR #2: Undefined symbol
Line #7, ERROR #17: Illegal bit designator
Line #7, ERROR #18: Target address exceeds relative address range
Line #8, ERROR #2: Undefined symbol
Line #8, ERROR #17: Illegal bit designator
Line #8, ERROR #18: Target address exceeds relative address range
Line #9, ERROR #2: Undefined symbol
Line #10, ERROR #2: Undefined symbol
Line #10, ERROR #17: Illegal bit designator
Line #10, ERROR #18: Target address exceeds relative address range
Line #11, ERROR #2: Undefined symbol
Line #11, ERROR #17: Illegal bit designator
Line #11, ERROR #18: Target address exceeds relative address range
Line #12, ERROR #2: Undefined symbol
Line #12, ERROR #17: Illegal bit designator
Line #12, ERROR #18: Target address exceeds relative address range
Line #13, ERROR #2: Undefined symbol
Line #13, ERROR #17: Illegal bit designator
Line #13, ERROR #18: Target address exceeds relative address range
Line #14, ERROR #2: Undefined symbol
Line #15, ERROR #2: Undefined symbol
Line #15, ERROR #17: Illegal bit designator
Line #15, ERROR #18: Target address exceeds relative address range
Line #16, ERROR #2: Undefined symbol
Line #16, ERROR #17: Illegal bit designator
Line #16, ERROR #18: Target address exceeds relative address range
Line #19, ERROR #2: Undefined symbol
Line #21, ERROR #2: Undefined symbol
Line #23, ERROR #2: Undefined symbol
Line #25, ERROR #2: Undefined symbol
Line #27, ERROR #2: Undefined symbol
Line #29, ERROR #2: Undefined symbol
Line #31, ERROR #2: Undefined symbol
Line #33, ERROR #2: Undefined symbol
Line #35, ERROR #2: Undefined symbol
Line #37, ERROR #2: Undefined symbol
Line #39, ERROR #2: Undefined symbol
Line #41, ERROR #2: Undefined symbol
Line #43, ERROR #2: Undefined symbol
Line #45, ERROR #2: Undefined symbol
Line #47, ERROR #2: Undefined symbol
Line #49, ERROR #2: Undefined symbol
XETTIEP PAGE 7
Line #51, ERROR #18: Target address exceeds relative address range
Line #53, ERROR #2: Undefined symbol
Line #53, ERROR #42: More errors detected, not listed
XETTIEP PAGE 8
DELAY1 . . . . . . . . . . . . . C ADDR 024AH
DELAY2 . . . . . . . . . . . . . C ADDR 025BH
LAP1 . . . . . . . . . . . . . . C ADDR 0250H
LAP2 . . . . . . . . . . . . . . C ADDR 0261H
MAIN . . . . . . . . . . . . . . C ADDR 0002H
P1 . . . . . . . . . . . . . . . UNDEFINED
P2 . . . . . . . . . . . . . . . UNDEFINED
P3 . . . . . . . . . . . . . . . UNDEFINED
SW1. . . . . . . . . . . . . . . C ADDR 002CH
SW10 . . . . . . . . . . . . . . C ADDR 01E8H
SW2. . . . . . . . . . . . . . . C ADDR 008EH
SW3. . . . . . . . . . . . . . . C ADDR 00F0H
SW4. . . . . . . . . . . . . . . C ADDR 015EH
SW5. . . . . . . . . . . . . . . C ADDR 0175H
SW6. . . . . . . . . . . . . . . C ADDR 018CH
SW7. . . . . . . . . . . . . . . C ADDR 01A3H
SW8. . . . . . . . . . . . . . . C ADDR 01BAH
SW9. . . . . . . . . . . . . . . C ADDR 01D1H
Em không bết phải khắc phục làm sao...có bác nào giúp mình với...thanks!
Comment