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

📄 transponder_afe.lst

📁 汽车无钥进入系统设计,基于PIC单片机16F639,包括电路图和源码
💻 LST
📖 第 1 页 / 共 4 页
字号:
0016   00??           00196         movwf   TEMP
0017   3E??           00197         addlw   AFE.ConfMap
0018   0084           00198         movwf   FSR
0019   0D??           00199         rlf             TEMP,w
001A   3EE0           00200         addlw   AFE.WriteCMD
001B   ???? ????      00201         banksel SPI.BufferH
001D   00??           00202         movwf   SPI.BufferH
001E   ????           00203         bankisel        AFE.ConfMap
001F   0D00           00204         rlf             INDF,w
0020   ???? ????      00205         banksel SPI.BufferH
0022   1C03           00206         btfss   STATUS,C                
0023   1000           00207         bcf             SPI.BufferH,0           
0024   1803           00208         btfsc   STATUS,C                
0025   1400           00209         bsf             SPI.BufferH,0
MPASM  5.14               TRANSPONDER_AFE.ASM   10-20-2008  11:17:36         PAGE 11


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

0026   ????           00210         bankisel        AFE.ConfMap
0027   0D00           00211         rlf             INDF,w
0028   ???? ????      00212         banksel SPI.BufferH
002A   00??           00213         movwf   SPI.BufferL
002B   1000           00214         bcf             SPI.BufferL,0
002C   ????           00215         bankisel        AFE.ConfMap
002D   0800           00216         movf    INDF,w
002E   2???           00217         call    AFE.CalcParity
002F   ???? ????      00218         banksel SPI.BufferH
0031   04??           00219         iorwf   SPI.BufferL,f
0032   2???           00220         call    SPI.Write
0033   3400           00221         retlw   0x00                            ;Debug only
                      00222 
                      00223 ;/*
                      00224 ;       This function reads one register file in the AFE.
                      00225 ;
                      00226 ;       @param w The address of the register to be read
                      00227 ;       @return w The value in the register (without parity)
                      00228 ;       @return AFE.ConfMap[x]  Writes the value to the configuration map in RAM
                      00229 ;
                      00230 ;       @stacklevel 1 /*/SPI.Read
                      00231 ;       @calls SPI.Read /*/SPI.Read
                      00232 ;       @registers      FSR /*/SPI.Read
                      00233 ;
                      00234 ;       @status Tested
                      00235 ;
                      00236 ;       @example
                      00237 ;               movlw   0x04                            ;load address of AFE register to w
                      00238 ;               call    AFE.ReadRegister        ;read register
                      00239 ;               ;now the value of the register is in w
                      00240 ;       @end-ex
                      00241 ;       @ex-desc This example reads the Sensitivity control of Channel X and Y (Register 4) to w
                      00242 ;
                      00243 ;*/
0034                  00244 AFE.ReadRegister
0034   ???? ????      00245         banksel TEMP
0036   00??           00246         movwf   TEMP
0037   3E??           00247         addlw   AFE.ConfMap
0038   0084           00248         movwf   FSR
0039   0D??           00249         rlf             TEMP,w
003A   3EC0           00250         addlw   AFE.ReadCMD
003B   ???? ????      00251         banksel SPI.BufferH
003D   00??           00252         movwf   SPI.BufferH
003E   2???           00253         call    SPI.Read
003F   ???? ????      00254         banksel SPI.BufferH
0041   0C??           00255         rrf             SPI.BufferH,w   ;Shift bit 0 in Carry
0042   0C??           00256         rrf             SPI.BufferL,w
0043   ????           00257         bankisel        AFE.ConfMap
0044   0080           00258         movwf   INDF                    ;synchronizing memory map with device
0045   0008           00259         return
                      00260 
                      00261 ;/*
                      00262 ;       This function writes and verifies one register file in the AFE.
MPASM  5.14               TRANSPONDER_AFE.ASM   10-20-2008  11:17:36         PAGE 12


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

                      00263 ;
                      00264 ;       @param w The AFE-Register to write
                      00265 ;       @param AFE.ConfMap[x] The value that should be written to the AFE-Register
                      00266 ;       @return w 0 if succesfull, 1 otherwise
                      00267 ;
                      00268 ;       @status Tested
                      00269 ;       @stacklevel 1 /*/AFE.WriteRegister /*/AFE.ReadRegister
                      00270 ;       @registers      FSR /*/AFE.WriteRegister /*/AFE.ReadRegister
                      00271 ;       @calls AFE.WriteRegister /*/AFE.WriteRegister AFE.ReadRegister /*/AFE.ReadRegister
                      00272 ;
                      00273 ;       @example
                      00274 ;               movlw   0xff                                            ;move value to AFE.Buffer
                      00275 ;               banksel AFE.Buffer
                      00276 ;               movwf   AFE.Buffer
                      00277 ;               movlw   0x04                                            ;move register address to w
                      00278 ;               call    AFE.WriteNVerifyRegister        ;writes and verifies the register
                      00279 ;               andlw   0xff                                            ;update status register
                      00280 ;               btfss   STATUS,Z                                        ;was there an error
                      00281 ;               goto    errorOccured                            ;yes, the goto error handler
                      00282 ;       @end-ex
                      00283 ;       @ex-desc        This example sets the Sensitivity Conrol Bits of Channel X and Channel Y (Regist
                            er 4)to the maximum.
                      00284 ;
                      00285 ;*/
0046                  00286 AFE.WriteNVerifyRegister
0046   ???? ????      00287         banksel TEMP2
0048   00??           00288         movwf   TEMP2
0049   2???           00289         call    AFE.WriteRegister
004A   0800           00290         movf    INDF,w
004B   ???? ????      00291         banksel AFE.Buffer
004D   00??           00292         movwf   AFE.Buffer
004E   ???? ????      00293         banksel TEMP2
0050   08??           00294         movf    TEMP2,w
0051   2???           00295         call    AFE.ReadRegister
0052   ???? ????      00296         banksel AFE.Buffer
0054   06??           00297         xorwf   AFE.Buffer,w
0055   1D03           00298         btfss   STATUS,Z
0056   3401           00299         retlw   0x01
0057   ???? ????      00300         banksel flag
0059   1900           00301         btfsc   flag,2
005A   2???           00302         goto    return_write_cfg
005B   0008           00303         return
                      00304 
                      00305 ;/*
                      00306 ;       This function writes and verifies the whole register map in the RAM to the AFE.
                      00307 ;       
                      00308 ;       @status Tested
                      00309 ;
                      00310 ;       @stacklevel /*/AFE.WriteNVerifyRegister
                      00311 ;       @registers /*/AFE.WriteNVerifyRegister
                      00312 ;       @calls AFE.WriteNVerifyRegister /*/AFE.WriteNVerifyRegister
                      00313 ;
                      00314 ;       @example
MPASM  5.14               TRANSPONDER_AFE.ASM   10-20-2008  11:17:36         PAGE 13


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

                      00315 ;               call    AFE.writeCfg
                      00316 ;       @end-ex
                      00317 ;       @ex-desc Now the configuration has been written from your RAM to the AFE
                      00318 ;*/
005C                  00319 AFE.WriteCfg
005C   2???           00320         call    AFE.CalcColumnParity            ;Ensure parity bits are correct
005D   ???? ????      00321         banksel flag
005F   1500           00322         bsf             flag,2
0060   ???? ????      00323         banksel TEMP3
0062   3007           00324         movlw   0x07
0063   00??           00325         movwf   TEMP3
0064                  00326 AFE.WriteCfg.loop
0064   ???? ????      00327         banksel TEMP3
0066   ????           00328         bankisel        AFE.ConfMap
0067   03??           00329         decf    TEMP3,w
0068   2???           00330         goto    AFE.WriteNVerifyRegister        ;reducing stacklevel
0069                  00331 return_write_cfg
0069   ???? ????      00332         banksel TEMP3
006B   39FF           00333         andlw   0xff
006C   1D03           00334         btfss   STATUS,Z
006D   3401           00335         retlw   0x01
006E   0B??           00336         decfsz  TEMP3,f
006F   2???           00337         goto    AFE.WriteCfg.loop
0070   1100           00338         bcf             flag,2
                      00339         
                      00340 
0071   3400           00341         retlw   0x00
                      00342 
                      00343 
                      00344 
                      00345 
                      00346 
                      00347 ;/*
                      00348 ;       This function reads the whole register map from the AFE to the RAM.
                      00349 ;
                      00350 ;       @status Written
                      00351 ;
                      00352 ;       @stacklevel 1 /*/AFE.ReadRegister
                      00353 ;       @registers /*/AFE.ReadRegister
                      00354 ;       @calls AFE.ReadRegister /*/AFE.ReadRegister
                      00355 ;
                      00356 ;       @example
                      00357 ;               call AFE.ReadConfig
                      00358 ;       @end-ex
                      00359 ;       @ex-desc That's it. The configuration is now in your RAM at the address AFE.ConfMap
                      00360 ;
                      00361 ;*/
0072                  00362 AFE.ReadCfg
                      00363 
0072   ???? ????      00364         banksel TEMP3
0074   3007           00365         movlw   0x07
0075   00??           00366         movwf   TEMP3
0076                  00367 AFE.ReadCfg.loop
MPASM  5.14               TRANSPONDER_AFE.ASM   10-20-2008  11:17:36         PAGE 14


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

0076   03??           00368         decf    TEMP3,w
0077   2???           00369         call    AFE.ReadRegister
0078   ???? ????      00370         banksel TEMP3
007A   0B??           00371         decfsz  TEMP3,f
007B   2???           00372         goto    AFE.ReadCfg.loop
                      00373         
007C   0008           00374         return
                      00375 
                      00376 
                      00377 
                      00378 ;/*
                      00379 ;       This calculates the odd parity of a Byte.
                      00380 ;       
                      00381 ;       @param w The byte to calculate odd parity from
                      00382 ;       @return w The parity bit
                      00383 ;
                      00384 ;       @status Tested
                      00385 ;
                      00386 ;       @stacklevel 1
                      00387 ;
                      00388 ;       @example
                      00389 ;               movlw   0x02                                    ;move the byte the parity should be calc
                            ulated from in w
                      00390 ;               call    AFE.CalcParity          ;returns the paritybit in w
                      00391 ;               andlw   0xff                            ;setting the STATUS register
                      00392 ;               banksel TransmitBuffer
                      00393 ;               btfss   STATUS,Z                        ;next if Parity is one
                      00394 ;               bsf             TransmitBuffer,0        ;set Parity Bit(suggested it is Bit 0 in Transmi
                            tBuffer)
                      00395 ;               btfsc   STATUS,Z                        ;next if Parity is zero
                      00396 ;               bcf             TransmitBuffer,0        ;clear Parity Bit
                      00397 ;       @end-ex
                      00398 ;       @ex-desc Calculates the odd parity of 0x02 and sets the parity bit (TransmitBuffer,0) appropriat
                            e
                      00399 ;
                      00400 ;
                      00401 ;
                      00402 ;*/
007D                  00403 AFE.CalcParity
007D   ???? ????      00404         banksel TEMP1
007F   00??           00405         movwf   TEMP1
0080   3000           00406         movlw   0x00
0081   00??           00407         movwf   TEMP
0082   3008           00408         movlw   0x08
0083   00??           00409         movwf   COUNTER
0084                  00410 BeginParityCalc
0084   0C??           00411         rrf             TEMP1,f
0085   1803           00412         btfsc   STATUS,C
0086   0A??           00413         incf    TEMP,f
0087   0B??           00414         decfsz  COUNTER,f
0088   2???           00415         goto    BeginParityCalc
0089   1800           00416         btfsc   TEMP,0
008A   3400           00417         retlw   0x00
MPASM  5.14               TRANSPONDER_AFE.ASM   10-20-2008  11:17:36         PAGE 15


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

008B   3401           00418         retlw   0x01
                      00419 
                      00420 
                      00421 ;/*
                      00422 ;       This calculates the odd column parity of the configuration register.
                      00423 ;       
                      00424 ;       @return w The parity byte
                      00425 ;
                      00426 ;       @status Tested
                      00427 ;
                      00428 ;       @stacklevel 1
                      00429 ;
                      00430 ;       @example
                      00431 ;               call    AFE.CalcColumnParity            ;Calculate the column parity
                      00432 ;               banksel AFE.Buffer                      
                      00433 ;               movwf   AFE.Buffer                      ;move parity to transmitbuffer
                      00434 ;               movlw   0x6                                     ;move address of column parity register 
                            to w
                      00435 ;               call    AFE.WriteRegister       ;write the column parity to the AFE
                      00436 ;       @end-ex
                      00437 ;       @ex-desc Calculates the odd parity of 0x02 and sets the parity bit (TransmitBuffer,0) appropriat
                            e
                      00438 ;
                      00439 ;
                      00440 ;
                      00441 ;*/
008C                  00442 AFE.CalcColumnParity
008C   ???? ????      00443         banksel AFE.ConfMap
008E   08??           00444         movf    AFE.ConfMap,w
008F   06??           00445         xorwf   (AFE.ConfMap+1),w
0090   06??           00446         xorwf   (AFE.ConfMap+2),w
0091   06??           00447         xorwf   (AFE.ConfMap+3),w

⌨️ 快捷键说明

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