📄 lab5.lst
字号:
00012 ISRSave ; Macro to context save in ISR
0004 00A9 M movwf W_TEMP ;
0005 0803 M movf STATUS,W ; (swapf will also work here)
0006 00A8 M movwf STATUS_TEMP ;
0007 110B 00013 bcf INTCON,T0IF ; Clear the TMR0 interrupt condition
0008 2029 00014 call DoReloadTimer ; Reload the Timer for accurate timing
0009 0BB0 00015 decfsz ISRCtr,F ; Decrement the ISRCounter (from 4 to 0) and test for 0
000A 2810 00016 goto SkipToggle ; if the counter is not yet 0, then toggling is not need
ed
000B 280C 00017 goto ToggleLED ; if the counter is 0, run toggle code
00018
000C 00019 ToggleLED
000C 3004 00020 movlw 4 ; put 4 into W to reload into the
000D 00B0 00021 movwf ISRCtr ; Interrupt counter (after 4 counts we need to reset it)
00022
000E 3001 00023 movlw B'00000001' ; write 1 to W in order to,
000F 0686 00024 xorwf PORTB,F ; toggle LED 0 of PORTB - XOR with 1 will toggle the bi
t
00025
0010 00026 SkipToggle ; Done interrupt, so restore and exit
00027 ISRRestore ; Macro to context restore when leaving ISR
0010 0828 M movf STATUS_TEMP,W ; (swapf will also work here)
0011 0083 M movwf STATUS ;
0012 0EA9 M swapf W_TEMP,F ; movf changes STATUS bit Z, but
0013 0E29 M swapf W_TEMP,W ; swapf does not change STATUS
0014 0009 00028 retfie ; Return from interrupt
00029
0015 00030 Initialize
00031 LEDOff 0 ; Ensure LED 0 is off
0015 30FE M movlw H'FF' - ((1 << 0) & H'00FF')
0016 0586 M andwf PORTB,F
00032 LEDEnable H'FE' ; MACRO to setup I/O port to drive LED RB0
0017 1683 1303 M BANKSEL TRISB
0019 30FE M movlw H'FE'
Message[302]: Register in operand not in bank 0. Ensure that bank bits are correct.
MPASM 4.00 Released LAB5.ASM 4-5-2005 13:32:47 PAGE 5
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
001A 0086 M movwf TRISB
001B 1283 1303 M BANKSEL PORTB
001D 3004 00033 movlw 4 ; Write 4 to W to
001E 00B0 00034 movwf ISRCtr ; preload the ISR counter with
001F 2029 00035 call DoReloadTimer ; Preload the timer for appropriate time delay
0020 30A0 00036 movlw B'10100000' ; Turn on GIE and
0021 008B 00037 movwf INTCON ; TMR0 interrupt (T0IE)
0022 1683 1303 00038 BANKSEL OPTION_REG ; set banking to access OPTION_REG in bank 1
0024 30C7 00039 movlw B'11000111' ; Set up TMR0 for 256 prescale and
Message[302]: Register in operand not in bank 0. Ensure that bank bits are correct.
0025 0081 00040 movwf OPTION_REG ; internal clock mode
0026 1283 1303 00041 BANKSEL PORTB ; return to accessing BANK 0
00042
0028 2828 00043 goto $ ; Wait forever for Interrupt
00044
00045
00046 ; Subroutine to reload TMR0
0029 00047 DoReloadTimer
0029 303D 00048 movlw D'256' - D'195' ; Preload Timer to
002A 0081 00049 movwf TMR0 ; count 195 times before roll-over
002B 0008 00050 return ; return from subroutine
00051 END
MPASM 4.00 Released LAB5.ASM 4-5-2005 13:32:47 PAGE 6
SYMBOL TABLE
LABEL VALUE
ACKDT 00000005
ACKEN 00000004
ACKSTAT 00000006
ADCON0 0000001F
ADCON1 0000009F
ADCS0 00000006
ADCS1 00000007
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
CM1 00000001
MPASM 4.00 Released LAB5.ASM 4-5-2005 13:32:47 PAGE 7
SYMBOL TABLE
LABEL VALUE
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
D 00000005
DATA_ADDRESS 00000005
DC 00000001
D_A 00000005
Dly0 00000020
Dly1 00000021
Dly2 00000022
Dly3 00000023
Dly32
DoDly32 00000401
DoReloadTimer 00000029
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
INTF 00000001
IRP 00000007
MPASM 4.00 Released LAB5.ASM 4-5-2005 13:32:47 PAGE 8
SYMBOL TABLE
LABEL VALUE
ISR 00000004
ISRCtr 00000030
ISRRestore
ISRSave
Initialize 00000015
LEDEnable
LEDOff
LEDOn
NOT_A 00000005
NOT_ADDRESS 00000005
NOT_BO 00000000
NOT_BOR 00000000
NOT_DONE 00000002
NOT_PD 00000003
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -