📄 pulse.lst
字号:
MPASM 03.70.01 Released PULSE.ASM 3-28-2006 22:24:42 PAGE 1
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
00001 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
00002 ;
00003 ; PULSE.ASM MPB 21-8-05
00004 ; Generates timed output interval using Timer 2
00005 ; in compare mode
00006 ; Timer interrupt sets output, cleared after 1ms
00007 ;
00008 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
00009
00010 PROCESSOR 16F877A
00011 ; Clock = XT 4MHz, standard fuse settings
2007 3731 00012 __CONFIG 0x3731
00013
00014 ; LABEL EQUATES ......................................
00015
00016 INCLUDE "P16F877A.INC" ; Standard register labels
00001 LIST
00002 ; P16F877A.INC Standard Header File, Version 1.00 Microchip Technology, Inc.
00398 LIST
00017
00000020 00018 Count EQU 20 ; soft timer
00019
00020 ; Program begins ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
00021
0000 00022 ORG 0 ; Place machine code
0000 0000 00023 NOP ; for ICD mode
0001 2805 00024 GOTO init ; Jump over ISR vector
00025
0004 00026 ORG 4 ; ISR vector address
0004 2820 00027 GOTO isr ; run ISR
00028
0005 0000 00029 init NOP
0006 1683 1303 00030 BANKSEL TRISC ; Select bank 1
0008 30FB 00031 MOVLW B'11111011' ; RC2 = output
Message[302]: Register in operand not in bank 0. Ensure that bank bits are correct.
0009 0087 00032 MOVWF TRISC ; Initialise display port
000A 3004 00033 MOVLW B'00000100' ; Timer1 interrupt..
Message[302]: Register in operand not in bank 0. Ensure that bank bits are correct.
000B 008C 00034 MOVWF PIE1 ; ..enable
00035
000C 1283 1303 00036 BANKSEL PORTC ; Select bank 0
000E 0187 00037 CLRF PORTC ; Clear output
000F 30C0 00038 MOVLW B'11000000' ; Peripheral interupt..
0010 008B 00039 MOVWF INTCON ; ..enable
0011 3008 00040 MOVLW B'00001000' ; Compare mode..
0012 0097 00041 MOVWF CCP1CON ; ..set output on match
0013 3027 00042 MOVLW 027 ; Initial value..
0014 0096 00043 MOVWF CCPR1H ; .. for high byte (10ms)
0015 3010 00044 MOVLW 010 ; Initial value..
0016 0095 00045 MOVWF CCPR1L ; .. for low byte (10ms)
0017 3001 00046 MOVLW B'00000001' ; Timer1 enable..
0018 0090 00047 MOVWF T1CON ; with internal clock (1MHz)
00048
MPASM 03.70.01 Released PULSE.ASM 3-28-2006 22:24:42 PAGE 2
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
0019 2831 00049 GOTO start ; Jump to main program
00050
00051 ; SUBROUTINES............................................
00052
00053 ; 1ms delay with 1us cycle time (1000 cycles)
00054
001A 30F9 00055 onems MOVLW D'249' ; Count for 1ms delay
001B 00A0 00056 MOVWF Count ; Load count
001C 0000 00057 loop NOP ; Pad for 4 cycle loop
Message[305]: Using default destination of 1 (file).
001D 0BA0 00058 DECFSZ Count ; Count
001E 281C 00059 GOTO loop ; until Z
001F 0008 00060 RETURN ; and finish
00061
00062
00063 ; INTERRUPT SERVICE ROUTINE..............................
00064
00065 ; Reset interrupt, check buttons, generate 1ms pulse
00066
0020 018C 00067 isr CLRF PIR1 ; clear interrupt flags
0021 018F 00068 CLRF TMR1H ; clear timer high..
0022 018E 00069 CLRF TMR1L ; ..and low byte
00070
0023 1808 00071 BTFSC PORTD,0 ; dec frequency button?
0024 2828 00072 GOTO other ; no
Message[305]: Using default destination of 1 (file).
0025 0F96 00073 INCFSZ CCPR1H ; yes, inc period, zero?
0026 2828 00074 GOTO other ; no
Message[305]: Using default destination of 1 (file).
0027 0396 00075 DECF CCPR1H ; yes, step back
00076
0028 1888 00077 other BTFSC PORTD,1 ; inc frequency button?
0029 282D 00078 GOTO wait ; no
Message[305]: Using default destination of 1 (file).
002A 0B96 00079 DECFSZ CCPR1H ; yes, inc period, zero?
002B 282D 00080 GOTO wait ; no
Message[305]: Using default destination of 1 (file).
002C 0A96 00081 INCF CCPR1H ; yes, step back
00082
002D 201A 00083 wait CALL onems ; wait 1ms
002E 1197 00084 BCF CCP1CON,3 ; clear output
002F 1597 00085 BSF CCP1CON,3 ; re-enable timer mode
00086
0030 0009 00087 RETFIE ; return to main program
00088
00089
00090 ;-----------------------------------------------------------
00091 ; Main program
00092 ;-----------------------------------------------------------
0031 2831 00093 start GOTO start ; wait for timer interrupt
00094 END ; of source code
MPASM 03.70.01 Released PULSE.ASM 3-28-2006 22:24:42 PAGE 3
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 03.70.01 Released PULSE.ASM 3-28-2006 22:24:42 PAGE 4
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
Count 00000020
D 00000005
DATA_ADDRESS 00000005
DC 00000001
D_A 00000005
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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -