?? ver1.lst
字號:
MPASM 4.00 Released VER1.ASM 4-4-2005 23:14:04 PAGE 1
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
00001 ; proportional to integral ppm converter
00002 ; the device works as an integrator
00003
00004
00005 list p=12F675
00006 radix hex
00007 include P12F675.INC
00001 LIST
00002 ; P12F675.INC Standard Header File, Version 1.04 Microchip Technology, Inc.
00284 LIST
00008 errorlevel -302
2007 3F94 00009 __CONFIG _CPD_OFF&_CP_OFF&_BODEN_OFF&_MCLRE_OFF&_WDT_OFF&_INTRC_OSC_NOCLKOUT
00010
00011 resetout macro
00012 bcf GPIO, 0x01;
00013 endm
00014
00015 setout macro
00016 bsf GPIO, 0x01;
00017 endm
00018
00019 setstate0 macro
00020 movlw 0xf0 ;
00021 andwf MYSTAT, f ;
00022 bsf mystat0 ;
00023 endm
00024
00025 setstate1 macro
00026 movlw 0xf0 ;
00027 andwf MYSTAT, f ;
00028 bsf mystat1 ;
00029 endm
00030
00031 setstate2 macro
00032 movlw 0xf0 ;
00033 andwf MYSTAT, f ;
00034 bsf mystat2 ;
00035 endm
00036
00037 setstate3 macro
00038 movlw 0xf0 ;
00039 andwf MYSTAT, f ;
00040 bsf mystat3 ;
00041 endm
00042
00043 exitint macro
00044 goto reti ;
00045 endm
00046
00047 prepare0 macro
00048 resetout
00049 movlw intv0 ; intv0 is the state0 timeout
00050 movwf TMR0
MPASM 4.00 Released VER1.ASM 4-4-2005 23:14:04 PAGE 2
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
00051 bcf INTCON, T0IF ;
00052 endm
00053
00054 prepare1 macro
00055 resetout
00056 movlw intv1 ; intv1 is the state1 timeout
00057 movwf TMR0
00058 bcf INTCON, T0IF ;
00059 endm
00060
00061 prepare2 macro
00062 setout
00063 movf psout, w ; psout is the state2 timeout
00064 movwf TMR0 ; aka the pulse out
00065 bcf INTCON, T0IF ;
00066 endm
00067
00068 prepare3 macro
00069 resetout
00070 movlw intv3 ; intv0 is the state0 timeout
00071 movwf TMR0
00072 bcf INTCON, T0IF ;
00073 endm
00074
00075 docalculus macro
00076
00077 decfsz tctr, f ; decrement it
00078 goto exitc ;
00079
00080 movlw sltick ; back again
00081 movwf tctr ;
00082
00083 movf TMR0, w ; load it
00084 movwf psin ; to psin
00085
00086 movf psin, w ;
00087 addlw th0 ;
00088 btfss STATUS, C ; it should be some carry to carry on
00089 goto exitc ; pulse too short
00090
00091 movf psin, w ;
00092 addlw th1 ;
00093 btfss STATUS, C ; it should be some carry to carry on
00094 goto calmin ; minimal pulse detected
00095
00096 movf psin, w ;
00097 addlw th2 ;
00098 btfss STATUS, C ; it should be some carry to carry on
00099 goto exitc ; pulse is neutral
00100
00101 movf psin, w ;
00102 addlw th3 ;
00103 btfss STATUS, C ; it should be some carry to carry on
MPASM 4.00 Released VER1.ASM 4-4-2005 23:14:04 PAGE 3
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
00104 goto calmax ; maximal pulse detected
00105
00106 goto exitc ; pulse is too long
00107
00108 calmin movlw thmax ; test for minimal pulse (maximal couter0 value)
00109 addwf psout, w ;
00110 btfss STATUS, C ;
00111 incf psout, f ; increment if the overflow was not generated
00112 goto exitc ;
00113
00114 calmax movlw thmin ; test for minimal pulse (maximal couter0 value)
00115 addwf psout, w ;
00116 btfsc STATUS, C ;
00117 decf psout, f ; increment if the overflow was not generated
00118 goto exitc ;
00119
00120 exitc nop;
00121 endm
00122
00123 ; now file deffinitions
00124 ;*****constants
00125
00126
00127 ; HARDWARE
00128
00129 ; GP0 in
00130 ; GP1 out
00131 ; GP2
00132 ; GP3 i/o
00133 ; GP4
00134 ; GP5
00135
00136 ; now file definitions
00137
00138 ;CONSTANTS
000000C9 00139 intv0 equ d'201' ; timeout state0, 7mS
000000EE 00140 intv1 equ d'238' ; -//- state1 2.3mS
0000008A 00141 intv3 equ d'138' ; -//- state3 15mS
0000000A 00142 th0 equ d'10' ; too short inpulse th
00000007 00143 th1 equ d'7' ; bandgap short
00000005 00144 th2 equ d'5' ; bandgap long
00000002 00145 th3 equ d'2' ; too long th
00000008 00146 thmax equ d'8' ; maximal pulse out wdth
00000010 00147 thmin equ d'16' ; minimal -//-
000000F4 00148 psstart equ d'244' ; startup value -//-
0000000F 00149 sltick equ d'15' ; slope limiter value
00150
00151 ; the temporary files
00000020 00152 W_TEMP equ 0x20 ; temporary w file
00000021 00153 STATUS_TEMP equ 0x21
00000022 00154 PCLATH_TEMP equ 0x22
00155
00156 ; play files
MPASM 4.00 Released VER1.ASM 4-4-2005 23:14:04 PAGE 4
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
00000023 00157 MYSTAT equ 0x23 ; mystat
00158 #define mystat0 MYSTAT, 0 ; mystat0
00159 #define mystat1 MYSTAT, 1 ; mystat1
00160 #define mystat2 MYSTAT, 2 ; mystat2
00161 #define mystat3 MYSTAT, 3 ; mystat3
00162
00000026 00163 psin equ 0x26 ; input wdth
00000027 00164 psout equ 0x27 ; output wdth
00000028 00165 tctr equ 0x28 ; a counter for slope limiter
00166
0000 00167 start org 0x0000 ; reset vector
0000 0000 00168 nop ; allow debugger
0001 0000 00169 nop
0002 2881 00170 goto init ; goto initblock
00171
00172 ; ISR XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
00173
0004 00174 intr org 0x0004 ; interrupt vector
0004 00A0 00175 MOVWF W_TEMP ;copy W to temp register,could be in either bank
0005 0E03 00176 SWAPF STATUS, W ;swap status to be saved into W
0006 1283 00177 BCF STATUS, RP0 ;change to bank 0 regardless ofcurrent bank
0007 00A1 00178 MOVWF STATUS_TEMP ;save status to bank 0 register
00179
0008 1283 00180 bcf STATUS, RP0
0009 1303 00181 bcf STATUS, RP1
00182
000A 1D0B 00183 TM0T btfss INTCON, T0IF ; timer0 interr test
000B 283D 00184 goto notm ; if no timer0 interrupt
000C 110B 00185 bcf INTCON, T0IF ; clear it
000D 1D23 00186 btfss mystat2
000E 2817 00187 goto tmns2 ; if no state 2
00188 prepare3 ;
M resetout
000F 1085 M bcf GPIO, 0x01;
0010 308A M movlw intv3 ; intv0 is the state0 timeout
0011 0081 M movwf TMR0
0012 110B M bcf INTCON, T0IF ;
00189 setstate3
0013 30F0 M movlw 0xf0 ;
0014 05A3 M andwf MYSTAT, f ;
0015 15A3 M bsf mystat3 ;
00190 exitint ;
0016 287C M goto reti ;
00191
0017 1CA3 00192 tmns2 btfss mystat1 ;
0018 2821 00193 goto tmns1 ;
00194 prepare2 ;
M setout
0019 1485 M bsf GPIO, 0x01;
001A 0827 M movf psout, w ; psout is the state2 timeout
001B 0081 M movwf TMR0 ; aka the pulse out
001C 110B M bcf INTCON, T0IF ;
00195 setstate2 ;
MPASM 4.00 Released VER1.ASM 4-4-2005 23:14:04 PAGE 5
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
001D 30F0 M movlw 0xf0 ;
001E 05A3 M andwf MYSTAT, f ;
001F 1523 M bsf mystat2 ;
00196 exitint ;
0020 287C M goto reti ;
00197
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -