⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lab5.lst

📁 定时器和中断
💻 LST
📖 第 1 页 / 共 3 页
字号:
0009   1283 1303      00018                 BANKSEL TMR0                                            ; Macro to context save in ISR
000B   110B           00019                 BCF     INTCON,TMR0IF                                           ; Clear the TMR0 interru
                            pt condition
000C   303D           00020                 MOVLW   TMR0Val
000D   0081           00021                 MOVWF   TMR0                                            ; Reload the Timer for accurate 
                            timing
Message[305]: Using default destination of 1 (file).
000E   0BFF           00022                 DECFSZ  Cycle4                                          ; Decrement the ISRCounter (from
                             4 to 0) and test for 0
000F   2815           00023                 goto    SkipToggle              ; if the counter is not yet 0, then toggling is not need
                            ed
0010   2811           00024                 goto    ToggleLED               ; if the counter is 0, run toggle code
                      00025 
0011                  00026 ToggleLED
0011   3004           00027                 MOVLW   D'4'                                    ; put 4 into W to reload into the
0012   00FF           00028                 MOVWF   Cycle4                                  ; Interrupt counter (after 4 counts we n
                            eed to reset it)
                      00029 
0013   3001           00030                 MOVLW   D'1'
Message[305]: Using default destination of 1 (file).
0014   0686           00031                 XORWF   PORTB                                           ; write 1 to W in order to, 
                      00032                                                                 ;  toggle LED 0 of PORTB - XOR with 1 wi
                            ll toggle the bit
                      00033 
0015                  00034 SkipToggle                                              ; Done interrupt, so restore and exit
                      00035                 ISRRestore                              ; Macro to context restore when leaving ISR
MPASM  5.06                          LAB5.ASM   5-28-2007  15:27:37         PAGE  5


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

0015   0828               M         movf    STATUS_TEMP,W   ; (swapf will also work here)
0016   0083               M         movwf   STATUS                  ;
0017   0EA9               M         swapf   W_TEMP,F                ; movf changes STATUS bit Z, but 
0018   0E29               M         swapf   W_TEMP,W                ; swapf does not change STATUS
0019   0009           00036                 retfie                                          ; Return from interrupt
                      00037 
001A                  00038 Initialize
                      00039                 LEDOff  0                               ; Ensure LED 0 is off
001A   30FE               M         movlw   H'FF' - ((1 << 0)         & H'00FF')
001B   0586               M         andwf   PORTB,F
                      00040                 LEDEnable       H'FE'           ; MACRO to setup I/O port to drive LED RB0
001C   1683 1303          M         BANKSEL TRISB
001E   30FE               M         movlw   H'FE'
Message[302]: Register in operand not in bank 0.  Ensure that bank bits are correct.
001F   0086               M         movwf   TRISB
0020   1283 1303          M         BANKSEL PORTB
0022   1283 1303      00041                 banksel PORTA
0024   3004           00042                 MOVLW   D'4'
0025   00FF           00043                 MOVWF   Cycle4                                  ; Write 4 to W to 
0026   2030           00044                 CALL    DoReloadTimer                           ;  preload the ISR counter with
                      00045                                                                 ; Preload the timer for appropriate time
                             delay
0027   178B           00046                 BSF     INTCON,GIE                                              ; Turn on GIE and 
0028   168B           00047                 BSF     INTCON,TMR0IE                                           ;  TMR0 interrupt (T0IE)
0029   1683 1303      00048                 BANKSEL TRISA                                           ; set banking to access OPTION_R
                            EG in bank 1
002B   30C7           00049                 MOVLW   B'11000111'
Message[302]: Register in operand not in bank 0.  Ensure that bank bits are correct.
002C   0081           00050                 MOVWF   OPTION_REG                                              ; Set up TMR0 for 256 pr
                            escale and 
                      00051                                                                 ;  internal clock mode
002D   1283 1303      00052                 BANKSEL PORTA                                           ; return to accessing BANK 0
                      00053 
002F   282F           00054                 goto    $                               ; Wait forever for Interrupt
                      00055 
                      00056 
                      00057 ; Subroutine to reload TMR0 
0030                  00058 DoReloadTimer
0030   303D           00059                 MOVLW   D'61'                                           ; Preload Timer to 
0031   0081           00060                 MOVWF   TMR0                                            ; count 195 times before roll-ov
                            er
0032   0008           00061                 RETURN                                          ; return from subroutine
                      00062                 END
MPASM  5.06                          LAB5.ASM   5-28-2007  15:27:37         PAGE  6


SYMBOL TABLE
  LABEL                             VALUE 

ACKDT                             00000005
ACKEN                             00000004
ACKSTAT                           00000006
ADCON0                            0000001F
ADCON1                            0000009F
ADCS0                             00000006
ADCS1                             00000007
ADCS2                             00000006
ADDEN                             00000003
ADFM                              00000007
ADIE                              00000006
ADIF                              00000006
ADON                              00000000
ADRESH                            0000001E
ADRESL                            0000009E
BCLIE                             00000003
BCLIF                             00000003
BF                                00000000
BRGH                              00000002
C                                 00000000
C1INV                             00000004
C1OUT                             00000006
C2INV                             00000005
C2OUT                             00000007
CCP1CON                           00000017
CCP1IE                            00000002
CCP1IF                            00000002
CCP1M0                            00000000
CCP1M1                            00000001
CCP1M2                            00000002
CCP1M3                            00000003
CCP1X                             00000005
CCP1Y                             00000004
CCP2CON                           0000001D
CCP2IE                            00000000
CCP2IF                            00000000
CCP2M0                            00000000
CCP2M1                            00000001
CCP2M2                            00000002
CCP2M3                            00000003
CCP2X                             00000005
CCP2Y                             00000004
CCPR1H                            00000016
CCPR1L                            00000015
CCPR2H                            0000001C
CCPR2L                            0000001B
CHS0                              00000003
CHS1                              00000004
CHS2                              00000005
CIS                               00000003
CKE                               00000006
CKP                               00000004
CM0                               00000000
MPASM  5.06                          LAB5.ASM   5-28-2007  15:27:37         PAGE  7


SYMBOL TABLE
  LABEL                             VALUE 

CM1                               00000001
CM2                               00000002
CMCON                             0000009C
CMIE                              00000006
CMIF                              00000006
CREN                              00000004
CSRC                              00000007
CVR0                              00000000
CVR1                              00000001
CVR2                              00000002
CVR3                              00000003
CVRCON                            0000009D
CVREN                             00000007
CVROE                             00000006
CVRR                              00000005
Cycle4                            0000007F
D                                 00000005
DATA_ADDRESS                      00000005
DC                                00000001
D_A                               00000005
Dly0                              00000020
Dly1                              00000021
Dly2                              00000022
Dly3                              00000023
Dly32                             
DoDly32                           00000401
DoReloadTimer                     00000030
EEADR                             0000010D
EEADRH                            0000010F
EECON1                            0000018C
EECON2                            0000018D
EEDATA                            0000010C
EEDATH                            0000010E
EEIE                              00000004
EEIF                              00000004
EEPGD                             00000007
F                                 00000001
FERR                              00000002
FSR                               00000004
GCEN                              00000007
GIE                               00000007
GO                                00000002
GO_DONE                           00000002
I2C_DATA                          00000005
I2C_READ                          00000002
I2C_START                         00000003
I2C_STOP                          00000004
IBF                               00000007
IBOV                              00000005
INDF                              00000000
INTCON                            0000000B
INTE                              00000004
INTEDG                            00000006
MPASM  5.06                          LAB5.ASM   5-28-2007  15:27:37         PAGE  8


SYMBOL TABLE
  LABEL                             VALUE 

INTF                              00000001
IRP                               00000007
ISR                               00000004
ISRCtr                            00000030
ISRRestore                        
ISRSave                           
Initialize                        0000001A
LEDEnable                         
LEDOff                            
LEDOn                             
NOT_A                             00000005

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -