[Menu]>[Circuits Gallery]>[LED flasher]
001 002 003 004 005 006 007 008 009 010 011 012 013 014 015 016 017 018 019 020 021 022 023 024 025 026 027 028 029 030 031 032 033 034 035 036 037 038 039 040 041 042 043 044 045 046 047 048 049 050 051 052 053 054 055 056 057 058 059 060 061 062 063 064 065 066 067 068 069 070 071 072 073 074 075 076 077 078 079 080 081 082 083 084 085 086 087 088 089 090 091 092 093 094 095 096 097 098 099 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 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 | ;******************************************************** ; ; The LED flash control processing ; ; Author : Seiichi Inoue ;******************************************************** list p=pic16f84a include p16f84a.inc __config _hs_osc & _wdt_off & _pwrte_on & _cp_off errorlevel -302 ;Eliminate bank warning ;**************** Label Definition ******************** ra0 equ 00 ;RA0 bit ra1 equ 01 ;RA1 bit ra2 equ 02 ;RA2 bit ra3 equ 03 ;RA3 bit ra4 equ 04 ;RA4 bit cnt500u equ 0c ;500usec counter Address cnt1m equ 0d ;1msec counter Address cnt100m equ 0e ;100msec counter Address cnt500m equ 0f ;500msec counter Address cnt1s equ 10 ;1sec counter Address ;************* Pattern Data Definition **************** ; '1':OFF '0':ON ;****** Pattern 0 ****** p00 equ b'11111110' p01 equ b'11111101' p02 equ b'11111011' p03 equ b'11110111' p04 equ b'11101111' p05 equ b'11011111' p06 equ b'10111111' p07 equ b'01111111' ;****** Pattern 1 ****** p10 equ b'01111111' p11 equ b'10111111' p12 equ b'11011111' p13 equ b'11101111' p14 equ b'11110111' p15 equ b'11111011' p16 equ b'11111101' p17 equ b'11111110' ;****** Pattern 2 ****** p20 equ b'01111110' p21 equ b'10111101' p22 equ b'11011011' p23 equ b'11100111' p24 equ b'11011011' p25 equ b'10111101' p26 equ b'01111110' ;****** Pattern 3 ****** p30 equ b'11111110' p31 equ b'11111101' p32 equ b'11111010' p33 equ b'11110101' p34 equ b'11101010' p35 equ b'11010101' p36 equ b'10101010' p37 equ b'01010101' p38 equ b'10101011' p39 equ b'01010111' p3a equ b'10101111' p3b equ b'01011111' p3c equ b'10111111' p3d equ b'01111111' ;****** Pattern 4 ****** p40 equ b'00000000' p41 equ b'11111111' p42 equ b'00000000' p43 equ b'11111111' p44 equ b'00000000' p45 equ b'11111111' p46 equ b'00000000' p47 equ b'11111111' p48 equ b'00000000' ;**************** Program Start *********************** org 0 ;Reset Vector goto init org 4 ;Interrupt Vector goto init ;**************** Initial Process ********************* org 5 init bsf status,rp0 ;Change to Bank1 movlw h'ff' ;Set input mode data movwf trisa ;Set PORTA to Input mode clrf trisb ;Set PORTB to Output mode bcf status,rp0 ;Change to Bank0 movlw h'ff' ;Set LED off data movwf portb ;Output data ;**************** Key Scan Process ******************** keyscan btfss porta,ra0 ;RA0 ON(Low lebel) ? call ptn0 ;Yes. Call Pattern 0 btfss porta,ra1 ;RA1 ON ? call ptn1 ;Yes. Call Pattern 1 btfss porta,ra2 ;RA2 ON ? call ptn2 ;Yes. Call Pattern 2 btfss porta,ra3 ;RA3 ON ? call ptn3 ;Yes. Call Pattern 3 btfss porta,ra4 ;RA4 ON ? call ptn4 ;Yes. Call Pattern 4 goto keyscan ;Retry ;*********** Pattern 0 Output Subroutine *************** ptn0 movlw p00 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p01 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p02 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p03 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p04 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p05 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p06 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p07 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw h'ff' ;Set LED off data movwf portb ;Output data call t100m ;Wait 100msec return ;*********** Pattern 1 Output Subroutine *************** ptn1 movlw p10 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p11 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p12 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p13 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p14 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p15 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p16 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p17 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw h'ff' ;Set LED off data movwf portb ;Output data call t100m ;Wait 100msec return ;*********** Pattern 2 Output Subroutine *************** ptn2 movlw p20 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p21 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p22 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p23 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p24 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p25 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p26 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw h'ff' ;Set LED off data movwf portb ;Output data call t100m ;Wait 100msec return ;*********** Pattern 3 Output Subroutine *************** ptn3 movlw p30 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p31 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p32 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p33 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p34 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p35 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p36 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p37 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p38 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p39 ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p3a ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p3b ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p3c ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw p3d ;Set pattern data movwf portb ;Output data call t100m ;Wait 100msec movlw h'ff' ;Set LED off data movwf portb ;Output data call t100m ;Wait 100msec return ;*********** Pattern 4 Output Subroutine *************** ptn4 movlw p40 ;Set pattern data movwf portb ;Output data call t1s ;Wait 1sec movlw p41 ;Set pattern data movwf portb ;Output data call t1s ;Wait 1sec movlw p42 ;Set pattern data movwf portb ;Output data call t1s ;Wait 1sec movlw p43 ;Set pattern data movwf portb ;Output data call t1s ;Wait 1sec movlw p44 ;Set pattern data movwf portb ;Output data call t1s ;Wait 1sec movlw p45 ;Set pattern data movwf portb ;Output data call t1s ;Wait 1sec movlw p46 ;Set pattern data movwf portb ;Output data call t1s ;Wait 1sec movlw p47 ;Set pattern data movwf portb ;Output data call t1s ;Wait 1sec movlw p48 ;Set pattern data movwf portb ;Output data call t1s ;Wait 1sec movlw h'ff' ;Set LED off data movwf portb ;Output data call t1s ;Wait 1sec return ;******************************************************** ; Timer Subroutine for 10MHz clock ;******************************************************** ;************* 1msec Timer Subroutine ***************** t1m movlw d'2' ;(1) Set loop cnt1 movwf cnt1m ;(1) Save loop cnt1 tm1lp1 movlw d'249' ;(1)*2 Set loop cnt2 movwf cnt500u ;(1)*2 Save loop cnt2 tm1lp2 nop ;(1)*249*2 Time adjust nop ;(1)*249*2 Time adjust decfsz cnt500u,f ;(1)*249*2 cnt500u-1=0 ? goto tm1lp2 ;(2)*248*2 No, continue decfsz cnt1m,f ;(1)*2 cnt1m-1=0 ? goto tm1lp1 ;(2) No. Continue return ;(2) Yes. Cnt end ;Total 2501*0.4usec=1msec ;************* 100msec Timer Subroutine *************** t100m movlw d'100' ;Set loop counter movwf cnt100m ;Save loop counter tm2lp call t1m ;1msec subroutine decfsz cnt100m,f ;cnt100m - 1 = 0 ? goto tm2lp ;No. Continue return ;Yes. Count end ;************* 500msec Timer Subroutine *************** t500m movlw d'5' ;Set loop counter movwf cnt500m ;Save loop counter tm3lp call t100m ;100msec subroutine decfsz cnt500m,f ;cnt500m - 1 = 0 ? goto tm3lp ;No. Continue return ;Yes. Count end ;************** 1sec Timer Subroutine ***************** t1s movlw d'2' ;Set loop counter movwf cnt1s ;Save loop counter tm4lp call t500m ;500msec subroutine decfsz cnt1s,f ;cnt1s - 1 = 0 ? goto tm4lp ;No. Continue return ;Yes. Count end ;******************************************************** ; END of LED flash control processing ;******************************************************** end |
MPASM 02.40 Released LED.ASM 5-19-2000 23:58:29 PAGE 1 LOC OBJECT CODE LINE SOURCE TEXT VALUE 00001 ;******************************************************** 00002 ; 00003 ; The LED flash control processing 00004 ; 00005 ; Author : Seiichi Inoue 00006 ;******************************************************** 00007 00008 LIST P=PIC16F84A 00009 INCLUDE P16F84A.INC 00001 LIST 00002 ; P16F84A.INC Standard Header File, Version 2.00'(modify) 00134 LIST 2007 3FF2 00010 __CONFIG _HS_OSC & _WDT_OFF & _PWRTE_ON & _CP_OFF 00011 ERRORLEVEL -302 ;Suppress bank warning 00012 00013 ;**************** Label Definition ******************** 00000000 00014 RA0 EQU 00 ;RA0 bit 00000001 00015 RA1 EQU 01 ;RA1 bit 00000002 00016 RA2 EQU 02 ;RA2 bit 00000003 00017 RA3 EQU 03 ;RA3 bit 00000004 00018 RA4 EQU 04 ;RA4 bit 0000000C 00019 CNT500U EQU 0C ;500usec counter Address 0000000D 00020 CNT1M EQU 0D ;1msec counter Address 0000000E 00021 CNT100M EQU 0E ;100msec counter Address 0000000F 00022 CNT500M EQU 0F ;500msec counter Address 00000010 00023 CNT1S EQU 10 ;1sec counter Address 00024 00025 ;************* Pattern Data Definition **************** 00026 ; '1':OFF '0':ON 00027 00028 ;****** Pattern 0 ****** 000000FE 00029 P00 EQU B'11111110' 000000FD 00030 P01 EQU B'11111101' 000000FB 00031 P02 EQU B'11111011' 000000F7 00032 P03 EQU B'11110111' 000000EF 00033 P04 EQU B'11101111' 000000DF 00034 P05 EQU B'11011111' 000000BF 00035 P06 EQU B'10111111' 0000007F 00036 P07 EQU B'01111111' 00037 00038 ;****** Pattern 1 ****** 0000007F 00039 P10 EQU B'01111111' 000000BF 00040 P11 EQU B'10111111' 000000DF 00041 P12 EQU B'11011111' 000000EF 00042 P13 EQU B'11101111' 000000F7 00043 P14 EQU B'11110111' 000000FB 00044 P15 EQU B'11111011' 000000FD 00045 P16 EQU B'11111101' 000000FE 00046 P17 EQU B'11111110' 00047 00048 ;****** Pattern 2 ****** 0000007E 00049 P20 EQU B'01111110' 000000BD 00050 P21 EQU B'10111101' MPASM 02.40 Released LED.ASM 5-19-2000 23:58:29 PAGE 2 LOC OBJECT CODE LINE SOURCE TEXT VALUE 000000DB 00051 P22 EQU B'11011011' 000000E7 00052 P23 EQU B'11100111' 000000DB 00053 P24 EQU B'11011011' 000000BD 00054 P25 EQU B'10111101' 0000007E 00055 P26 EQU B'01111110' 00056 00057 ;****** Pattern 3 ****** 000000FE 00058 P30 EQU B'11111110' 000000FD 00059 P31 EQU B'11111101' 000000FA 00060 P32 EQU B'11111010' 000000F5 00061 P33 EQU B'11110101' 000000EA 00062 P34 EQU B'11101010' 000000D5 00063 P35 EQU B'11010101' 000000AA 00064 P36 EQU B'10101010' 00000055 00065 P37 EQU B'01010101' 000000AB 00066 P38 EQU B'10101011' 00000057 00067 P39 EQU B'01010111' 000000AF 00068 P3A EQU B'10101111' 0000005F 00069 P3B EQU B'01011111' 000000BF 00070 P3C EQU B'10111111' 0000007F 00071 P3D EQU B'01111111' 00072 00073 ;****** Pattern 4 ****** 00000000 00074 P40 EQU B'00000000' 000000FF 00075 P41 EQU B'11111111' 00000000 00076 P42 EQU B'00000000' 000000FF 00077 P43 EQU B'11111111' 00000000 00078 P44 EQU B'00000000' 000000FF 00079 P45 EQU B'11111111' 00000000 00080 P46 EQU B'00000000' 000000FF 00081 P47 EQU B'11111111' 00000000 00082 P48 EQU B'00000000' 00083 00084 00085 ;**************** Program Start *********************** 0000 00086 ORG 0 ;Reset Vector 0000 2805 00087 GOTO INIT 0004 00088 ORG 4 ;Interrupt Vector 0004 2805 00089 GOTO INIT 00090 00091 ;**************** Initial Process ********************* 0005 00092 ORG 5 0005 1683 00093 INIT BSF STATUS,RP0 ;Change to Bank1 0006 30FF 00094 MOVLW H'ff' ;Set input mode data 0007 0085 00095 MOVWF TRISA ;Set PORTA to Input mode 0008 0186 00096 CLRF TRISB ;Set PORTB to Output mode 0009 1283 00097 BCF STATUS,RP0 ;Change to Bank0 000A 30FF 00098 MOVLW H'ff' ;Set LED off data 000B 0086 00099 MOVWF PORTB ;Output data 00100 00101 ;**************** Key Scan Process ******************** 000C 1C05 00102 KEYSCAN BTFSS PORTA,RA0 ;RA0 ON(Low lebel) ? 000D 2017 00103 CALL PTN0 ;Yes. Call Pattern 0 MPASM 02.40 Released LED.ASM 5-19-2000 23:58:29 PAGE 3 LOC OBJECT CODE LINE SOURCE TEXT VALUE 000E 1C85 00104 BTFSS PORTA,RA1 ;RA1 ON ? 000F 2033 00105 CALL PTN1 ;Yes. Call Pattern 1 0010 1D05 00106 BTFSS PORTA,RA2 ;RA2 ON ? 0011 204F 00107 CALL PTN2 ;Yes. Call Pattern 2 0012 1D85 00108 BTFSS PORTA,RA3 ;RA3 ON ? 0013 2068 00109 CALL PTN3 ;Yes. Call Pattern 3 0014 1E05 00110 BTFSS PORTA,RA4 ;RA4 ON ? 0015 2096 00111 CALL PTN4 ;Yes. Call Pattern 4 0016 280C 00112 GOTO KEYSCAN ;Retry 00113 00114 ;*********** Pattern 0 Output Subroutine *************** 0017 30FE 00115 PTN0 MOVLW P00 ;Set pattern data 0018 0086 00116 MOVWF PORTB ;Output data 0019 20C0 00117 CALL T100M ;Wait 100msec 001A 30FD 00118 MOVLW P01 ;Set pattern data 001B 0086 00119 MOVWF PORTB ;Output data 001C 20C0 00120 CALL T100M ;Wait 100msec 001D 30FB 00121 MOVLW P02 ;Set pattern data 001E 0086 00122 MOVWF PORTB ;Output data 001F 20C0 00123 CALL T100M ;Wait 100msec 0020 30F7 00124 MOVLW P03 ;Set pattern data 0021 0086 00125 MOVWF PORTB ;Output data 0022 20C0 00126 CALL T100M ;Wait 100msec 0023 30EF 00127 MOVLW P04 ;Set pattern data 0024 0086 00128 MOVWF PORTB ;Output data 0025 20C0 00129 CALL T100M ;Wait 100msec 0026 30DF 00130 MOVLW P05 ;Set pattern data 0027 0086 00131 MOVWF PORTB ;Output data 0028 20C0 00132 CALL T100M ;Wait 100msec 0029 30BF 00133 MOVLW P06 ;Set pattern data 002A 0086 00134 MOVWF PORTB ;Output data 002B 20C0 00135 CALL T100M ;Wait 100msec 002C 307F 00136 MOVLW P07 ;Set pattern data 002D 0086 00137 MOVWF PORTB ;Output data 002E 20C0 00138 CALL T100M ;Wait 100msec 002F 30FF 00139 MOVLW H'ff' ;Set LED off data 0030 0086 00140 MOVWF PORTB ;Output data 0031 20C0 00141 CALL T100M ;Wait 100msec 0032 0008 00142 RETURN 00143 00144 ;*********** Pattern 1 Output Subroutine *************** 0033 307F 00145 PTN1 MOVLW P10 ;Set pattern data 0034 0086 00146 MOVWF PORTB ;Output data 0035 20C0 00147 CALL T100M ;Wait 100msec 0036 30BF 00148 MOVLW P11 ;Set pattern data 0037 0086 00149 MOVWF PORTB ;Output data 0038 20C0 00150 CALL T100M ;Wait 100msec 0039 30DF 00151 MOVLW P12 ;Set pattern data 003A 0086 00152 MOVWF PORTB ;Output data 003B 20C0 00153 CALL T100M ;Wait 100msec 003C 30EF 00154 MOVLW P13 ;Set pattern data 003D 0086 00155 MOVWF PORTB ;Output data 003E 20C0 00156 CALL T100M ;Wait 100msec MPASM 02.40 Released LED.ASM 5-19-2000 23:58:29 PAGE 4 LOC OBJECT CODE LINE SOURCE TEXT VALUE 003F 30F7 00157 MOVLW P14 ;Set pattern data 0040 0086 00158 MOVWF PORTB ;Output data 0041 20C0 00159 CALL T100M ;Wait 100msec 0042 30FB 00160 MOVLW P15 ;Set pattern data 0043 0086 00161 MOVWF PORTB ;Output data 0044 20C0 00162 CALL T100M ;Wait 100msec 0045 30FD 00163 MOVLW P16 ;Set pattern data 0046 0086 00164 MOVWF PORTB ;Output data 0047 20C0 00165 CALL T100M ;Wait 100msec 0048 30FE 00166 MOVLW P17 ;Set pattern data 0049 0086 00167 MOVWF PORTB ;Output data 004A 20C0 00168 CALL T100M ;Wait 100msec 004B 30FF 00169 MOVLW H'ff' ;Set LED off data 004C 0086 00170 MOVWF PORTB ;Output data 004D 20C0 00171 CALL T100M ;Wait 100msec 004E 0008 00172 RETURN 00173 00174 ;*********** Pattern 2 Output Subroutine *************** 004F 307E 00175 PTN2 MOVLW P20 ;Set pattern data 0050 0086 00176 MOVWF PORTB ;Output data 0051 20C0 00177 CALL T100M ;Wait 100msec 0052 30BD 00178 MOVLW P21 ;Set pattern data 0053 0086 00179 MOVWF PORTB ;Output data 0054 20C0 00180 CALL T100M ;Wait 100msec 0055 30DB 00181 MOVLW P22 ;Set pattern data 0056 0086 00182 MOVWF PORTB ;Output data 0057 20C0 00183 CALL T100M ;Wait 100msec 0058 30E7 00184 MOVLW P23 ;Set pattern data 0059 0086 00185 MOVWF PORTB ;Output data 005A 20C0 00186 CALL T100M ;Wait 100msec 005B 30DB 00187 MOVLW P24 ;Set pattern data 005C 0086 00188 MOVWF PORTB ;Output data 005D 20C0 00189 CALL T100M ;Wait 100msec 005E 30BD 00190 MOVLW P25 ;Set pattern data 005F 0086 00191 MOVWF PORTB ;Output data 0060 20C0 00192 CALL T100M ;Wait 100msec 0061 307E 00193 MOVLW P26 ;Set pattern data 0062 0086 00194 MOVWF PORTB ;Output data 0063 20C0 00195 CALL T100M ;Wait 100msec 0064 30FF 00196 MOVLW H'ff' ;Set LED off data 0065 0086 00197 MOVWF PORTB ;Output data 0066 20C0 00198 CALL T100M ;Wait 100msec 0067 0008 00199 RETURN 00200 00201 ;*********** Pattern 3 Output Subroutine *************** 0068 30FE 00202 PTN3 MOVLW P30 ;Set pattern data 0069 0086 00203 MOVWF PORTB ;Output data 006A 20C0 00204 CALL T100M ;Wait 100msec 006B 30FD 00205 MOVLW P31 ;Set pattern data 006C 0086 00206 MOVWF PORTB ;Output data 006D 20C0 00207 CALL T100M ;Wait 100msec 006E 30FA 00208 MOVLW P32 ;Set pattern data 006F 0086 00209 MOVWF PORTB ;Output data MPASM 02.40 Released LED.ASM 5-19-2000 23:58:29 PAGE 5 LOC OBJECT CODE LINE SOURCE TEXT VALUE 0070 20C0 00210 CALL T100M ;Wait 100msec 0071 30F5 00211 MOVLW P33 ;Set pattern data 0072 0086 00212 MOVWF PORTB ;Output data 0073 20C0 00213 CALL T100M ;Wait 100msec 0074 30EA 00214 MOVLW P34 ;Set pattern data 0075 0086 00215 MOVWF PORTB ;Output data 0076 20C0 00216 CALL T100M ;Wait 100msec 0077 30D5 00217 MOVLW P35 ;Set pattern data 0078 0086 00218 MOVWF PORTB ;Output data 0079 20C0 00219 CALL T100M ;Wait 100msec 007A 30AA 00220 MOVLW P36 ;Set pattern data 007B 0086 00221 MOVWF PORTB ;Output data 007C 20C0 00222 CALL T100M ;Wait 100msec 007D 3055 00223 MOVLW P37 ;Set pattern data 007E 0086 00224 MOVWF PORTB ;Output data 007F 20C0 00225 CALL T100M ;Wait 100msec 0080 30AB 00226 MOVLW P38 ;Set pattern data 0081 0086 00227 MOVWF PORTB ;Output data 0082 20C0 00228 CALL T100M ;Wait 100msec 0083 3057 00229 MOVLW P39 ;Set pattern data 0084 0086 00230 MOVWF PORTB ;Output data 0085 20C0 00231 CALL T100M ;Wait 100msec 0086 30AF 00232 MOVLW P3A ;Set pattern data 0087 0086 00233 MOVWF PORTB ;Output data 0088 20C0 00234 CALL T100M ;Wait 100msec 0089 305F 00235 MOVLW P3B ;Set pattern data 008A 0086 00236 MOVWF PORTB ;Output data 008B 20C0 00237 CALL T100M ;Wait 100msec 008C 30BF 00238 MOVLW P3C ;Set pattern data 008D 0086 00239 MOVWF PORTB ;Output data 008E 20C0 00240 CALL T100M ;Wait 100msec 008F 307F 00241 MOVLW P3D ;Set pattern data 0090 0086 00242 MOVWF PORTB ;Output data 0091 20C0 00243 CALL T100M ;Wait 100msec 0092 30FF 00244 MOVLW H'ff' ;Set LED off data 0093 0086 00245 MOVWF PORTB ;Output data 0094 20C0 00246 CALL T100M ;Wait 100msec 0095 0008 00247 RETURN 00248 00249 ;*********** Pattern 4 Output Subroutine *************** 0096 3000 00250 PTN4 MOVLW P40 ;Set pattern data 0097 0086 00251 MOVWF PORTB ;Output data 0098 20CC 00252 CALL T1S ;Wait 1sec 0099 30FF 00253 MOVLW P41 ;Set pattern data 009A 0086 00254 MOVWF PORTB ;Output data 009B 20CC 00255 CALL T1S ;Wait 1sec 009C 3000 00256 MOVLW P42 ;Set pattern data 009D 0086 00257 MOVWF PORTB ;Output data 009E 20CC 00258 CALL T1S ;Wait 1sec 009F 30FF 00259 MOVLW P43 ;Set pattern data 00A0 0086 00260 MOVWF PORTB ;Output data 00A1 20CC 00261 CALL T1S ;Wait 1sec 00A2 3000 00262 MOVLW P44 ;Set pattern data MPASM 02.40 Released LED.ASM 5-19-2000 23:58:29 PAGE 6 LOC OBJECT CODE LINE SOURCE TEXT VALUE 00A3 0086 00263 MOVWF PORTB ;Output data 00A4 20CC 00264 CALL T1S ;Wait 1sec 00A5 30FF 00265 MOVLW P45 ;Set pattern data 00A6 0086 00266 MOVWF PORTB ;Output data 00A7 20CC 00267 CALL T1S ;Wait 1sec 00A8 3000 00268 MOVLW P46 ;Set pattern data 00A9 0086 00269 MOVWF PORTB ;Output data 00AA 20CC 00270 CALL T1S ;Wait 1sec 00AB 30FF 00271 MOVLW P47 ;Set pattern data 00AC 0086 00272 MOVWF PORTB ;Output data 00AD 20CC 00273 CALL T1S ;Wait 1sec 00AE 3000 00274 MOVLW P48 ;Set pattern data 00AF 0086 00275 MOVWF PORTB ;Output data 00B0 20CC 00276 CALL T1S ;Wait 1sec 00B1 30FF 00277 MOVLW H'ff' ;Set LED off data 00B2 0086 00278 MOVWF PORTB ;Output data 00B3 20CC 00279 CALL T1S ;Wait 1sec 00B4 0008 00280 RETURN 00281 00282 ;******************************************************** 00283 ; Timer Subroutine for 10MHz clock 00284 ;******************************************************** 00285 00286 ;************* 1msec Timer Subroutine ***************** 00B5 3002 00287 T1M MOVLW D'2' ;(1) Set loop cnt1 00B6 008D 00288 MOVWF CNT1M ;(1) Save loop cnt1 00B7 30F9 00289 TM1LP1 MOVLW D'249' ;(1)*2 Set loop cnt2 00B8 008C 00290 MOVWF CNT500U ;(1)*2 Save loop cnt2 00B9 0000 00291 TM1LP2 NOP ;(1)*249*2 Time adjust 00BA 0000 00292 NOP ;(1)*249*2 Time adjust 00BB 0B8C 00293 DECFSZ CNT500U,F ;(1)*249*2 cnt500u-1=0 ? 00BC 28B9 00294 GOTO TM1LP2 ;(2)*248*2 No, continue 00BD 0B8D 00295 DECFSZ CNT1M,F ;(1)*2 cnt1m-1=0 ? 00BE 28B7 00296 GOTO TM1LP1 ;(2) No. Continue 00BF 0008 00297 RETURN ;(2) Yes. Cnt end 00298 ;Total 2501*0.4usec=1msec 00299 00300 ;************* 100msec Timer Subroutine *************** 00C0 3064 00301 T100M MOVLW D'100' ;Set loop counter 00C1 008E 00302 MOVWF CNT100M ;Save loop counter 00C2 20B5 00303 TM2LP CALL T1M ;1msec subroutine 00C3 0B8E 00304 DECFSZ CNT100M,F ;cnt100m - 1 = 0 ? 00C4 28C2 00305 GOTO TM2LP ;No. Continue 00C5 0008 00306 RETURN ;Yes. Count end 00307 00308 00309 ;************* 500msec Timer Subroutine *************** 00C6 3005 00310 T500M MOVLW D'5' ;Set loop counter 00C7 008F 00311 MOVWF CNT500M ;Save loop counter 00C8 20C0 00312 TM3LP CALL T100M ;100msec subroutine 00C9 0B8F 00313 DECFSZ CNT500M,F ;cnt500m - 1 = 0 ? 00CA 28C8 00314 GOTO TM3LP ;No. Continue 00CB 0008 00315 RETURN ;Yes. Count end MPASM 02.40 Released LED.ASM 5-19-2000 23:58:29 PAGE 7 LOC OBJECT CODE LINE SOURCE TEXT VALUE 00316 00317 ;************** 1sec Timer Subroutine ***************** 00CC 3002 00318 T1S MOVLW D'2' ;Set loop counter 00CD 0090 00319 MOVWF CNT1S ;Save loop counter 00CE 20C6 00320 TM4LP CALL T500M ;500msec subroutine 00CF 0B90 00321 DECFSZ CNT1S,F ;cnt1s - 1 = 0 ? 00D0 28CE 00322 GOTO TM4LP ;No. Continue 00D1 0008 00323 RETURN ;Yes. Count end 00324 00325 00326 ;******************************************************** 00327 ; END of LED flash control processing 00328 ;******************************************************** 00329 00330 END MPASM 02.40 Released LED.ASM 5-19-2000 23:58:29 PAGE 8 SYMBOL TABLE LABEL VALUE C 00000000 CNT100M 0000000E CNT1M 0000000D CNT1S 00000010 CNT500M 0000000F CNT500U 0000000C DC 00000001 EEADR 00000009 EECON1 00000088 EECON2 00000089 EEDATA 00000008 EEIE 00000006 EEIF 00000004 F 00000001 FSR 00000004 GIE 00000007 INDF 00000000 INIT 00000005 INTCON 0000000B INTE 00000004 INTEDG 00000006 INTF 00000001 IRP 00000007 KEYSCAN 0000000C NOT_PD 00000003 NOT_RBPU 00000007 NOT_TO 00000004 OPTION_REG 00000081 P00 000000FE P01 000000FD P02 000000FB P03 000000F7 P04 000000EF P05 000000DF P06 000000BF P07 0000007F P10 0000007F P11 000000BF P12 000000DF P13 000000EF P14 000000F7 P15 000000FB P16 000000FD P17 000000FE P20 0000007E P21 000000BD P22 000000DB P23 000000E7 P24 000000DB P25 000000BD P26 0000007E P30 000000FE P31 000000FD MPASM 02.40 Released LED.ASM 5-19-2000 23:58:29 PAGE 9 SYMBOL TABLE LABEL VALUE P32 000000FA P33 000000F5 P34 000000EA P35 000000D5 P36 000000AA P37 00000055 P38 000000AB P39 00000057 P3A 000000AF P3B 0000005F P3C 000000BF P3D 0000007F P40 00000000 P41 000000FF P42 00000000 P43 000000FF P44 00000000 P45 000000FF P46 00000000 P47 000000FF P48 00000000 PCL 00000002 PCLATH 0000000A PORTA 00000005 PORTB 00000006 PS0 00000000 PS1 00000001 PS2 00000002 PSA 00000003 PTN0 00000017 PTN1 00000033 PTN2 0000004F PTN3 00000068 PTN4 00000096 RA0 00000000 RA1 00000001 RA2 00000002 RA3 00000003 RA4 00000004 RBIE 00000003 RBIF 00000000 RD 00000000 RP0 00000005 RP1 00000006 STATUS 00000003 T0CS 00000005 T0IE 00000005 T0IF 00000002 T0SE 00000004 T100M 000000C0 T1M 000000B5 T1S 000000CC T500M 000000C6 MPASM 02.40 Released LED.ASM 5-19-2000 23:58:29 PAGE 10 SYMBOL TABLE LABEL VALUE TM1LP1 000000B7 TM1LP2 000000B9 TM2LP 000000C2 TM3LP 000000C8 TM4LP 000000CE TMR0 00000001 TRISA 00000085 TRISB 00000086 W 00000000 WR 00000001 WREN 00000002 WRERR 00000003 Z 00000002 _CP_OFF 00003FFF _CP_ON 0000000F _HS_OSC 00003FFE _LP_OSC 00003FFC _PWRTE_OFF 00003FFF _PWRTE_ON 00003FF7 _RC_OSC 00003FFF _WDT_OFF 00003FFB _WDT_ON 00003FFF _XT_OSC 00003FFD __16F84A 00000001 MEMORY USAGE MAP ('X' = Used, '-' = Unused) 0000 : X---XXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX 0040 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX 0080 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX 00C0 : XXXXXXXXXXXXXXXX XX-------------- ---------------- ---------------- 2000 : -------X-------- ---------------- ---------------- ---------------- All other memory blocks unused. Program Memory Words Used: 207 Program Memory Words Free: 817 Errors : 0 Warnings : 0 reported, 0 suppressed Messages : 0 reported, 2 suppressed |
led_source.zip led_hex.zip |