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

📄 transponder_afe.lst

📁 汽车无钥进入系统设计,基于PIC单片机16F639,包括电路图和源码
💻 LST
📖 第 1 页 / 共 4 页
字号:
                      00015 
                      00016 ;/*
                      00017 ;
                      00018 ;       This macro initialises the SPI module
                      00019 ;
                      00020 ;*/
                      00021 SPI.Init macro
MPASM  5.14               TRANSPONDER_AFE.ASM   10-20-2008  11:17:36         PAGE  6


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

                      00022         banksel TRISC
                      00023         movlw   b'11001110'             ; Set LFDATA,ALERT, and CS as inputs 
                      00024         movwf   TRISC                   ; 
                      00025         banksel PORTC
                      00026         bsf             AFECS                   ; Take AFE CS Line high
                      00027         endm
                      00028 
                      00029 
                      00030 
                      00031 
                      00032 ;
                      00033 ;       This macro shifts data out of the MCU through the SPI-Interface.
                      00034 ;
                      00035 ;
                      00036 ;       @param SPI.BufferH The most significant Byte of the Data
                      00037 ;       @param SPI.BufferL The least significant Byte of the Data
                      00038 ;
                      00039 ;       @example
                      00040 ;       pagesel SPI.BufferH
                      00041 ;       movlw   0xf0
                      00042 ;       movwf   SPI.BufferH
                      00043 ;       movlw   0x0f
                      00044 ;       movwf   SPI.BufferL
                      00045 ;       call    SPI.Write
                      00046 ;       @end-ex
                      00047 ;       @ex-desc This sends 0xf00f over the SPI-Bus
                      00048 ;
                      00049 ;       @status Written
                      00050 ;
                      00051 ;       @stacklevel +1
                      00052 ;
                      00053 ;
                      00054 ;
                      00055 ;SPI.Write macro
                      00056 ;       call    SPI.ShiftOutBuffer
                      00057 ;       endm
                      00058 
                      00059 
                      00060 
                      00061 ;
                      00062 ;       This macro reads two Bytes from the SPI-Bus.
                      00063 ;       Put the Read command and the address in the SPI.BufferH and SPI.BufferL Registers.
                      00064 ;       Then call SPI.Read.
                      00065 ;       Then read the returned values in SPI.BufferH and SPI.BufferL.
                      00066 ;
                      00067 ;
                      00068 ;       @param SPI.BufferH The most significant Byte of the Data
                      00069 ;       @param SPI.BufferL The least significant Byte of the Data
                      00070 ;
                      00071 ;
                      00072 ;       @return SPI.BufferH The most significant Byte of the Data
                      00073 ;       @return SPI.BufferL The least significant Byte of the Data
                      00074 ;
MPASM  5.14               TRANSPONDER_AFE.ASM   10-20-2008  11:17:36         PAGE  7


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

                      00075 ;       @example
                      00076 ;       pagesel SPI.BufferH
                      00077 ;       movlw   0xf0
                      00078 ;       movwf   SPI.BufferH
                      00079 ;       movlw   0x0f
                      00080 ;       movwf   SPI.BufferL
                      00081 ;       call    SPI.Read
                      00082 ;       @end-ex
                      00083 ;       @ex-desc This sends 0xf00f over the SPI-Bus, and reads the answer to SPI.BufferH and SPI.BufferL
                            .
                      00084 ;
                      00085 ;       @status Written
                      00086 ;
                      00087 ;       @stacklevel +1
                      00088 ;
                      00089 ;
                      00090 ;
                      00091 ;SPI.Read macro
                      00092 ;       call    SPI.ShiftOutBuffer
                      00093 ;       call    SPI.ShiftInBuffer
                      00094 ;       endm
                      00095 
                      00096 
                      00097         endif
                      00064 #include EEPROM.inc
                      00001 #ifndef EEPROM_INC
                      00002 #define EEPROM_INC
                      00003 
                      00004         #define EEPROM.RamAddress
                      00005 
                      00006 ;/*
                      00007 ;       The address in the EEPROM for the next operation on it.
                      00008 ;*/
  0000                00009         extern EEPROM.ADDRESS
  0000                00010         extern EEPROM.ByteCount
  0000                00011         extern EEPROM.Write, EEPROM.WriteBytes, EEPROM.Read, EEPROM.ReadBytes
                      00012 
                      00013 
                      00014 ;/*
                      00015 ;
                      00016 ;       This macro initialises the EEPROM module
                      00017 ;
                      00018 ;       @example
                      00019 ;       EEPROM.Init             ;initialises the EEPROM module
                      00020 ;       @end-ex
                      00021 ;       @ex-desc That's it
                      00022 ;
                      00023 ;       @status Tested
                      00024 ;
                      00025 ;       @stacklevel 0
                      00026 ;
                      00027 ;       @registers EEDATA, EEADR, EECON1, EECON1
                      00028 ;
MPASM  5.14               TRANSPONDER_AFE.ASM   10-20-2008  11:17:36         PAGE  8


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

                      00029 ;
                      00030 ;*/
                      00031 EEPROM.Init     macro
                      00032         banksel EEADR
                      00033         CLRF    EEDAT
                      00034         CLRF    EEADR
                      00035         CLRF    EECON1
                      00036         CLRF    EECON2
                      00037         endm
                      00038 
                      00039 
                      00040 #endif
                      00065 
                      00066 
                      00067 
  000000C0            00068 AFE.ReadCMD                     equ     0xC0
  000000E0            00069 AFE.WriteCMD            equ     0xE0
                      00070 
                      00071 
                      00072 
                      00073 AFE_ovr udata
0000                  00074 AFE.ConfMap     res 8
0008                  00075 COUNTER         res 1
0009                  00076 TEMP            res 1
000A                  00077 TEMP1           res 1
000B                  00078 TEMP2           res 1
000C                  00079 TEMP3           res 1
000D                  00080 AFE.Buffer      res 1
                      00081 
                      00082 
                      00083 
  0000                00084         global AFE.ConfMap, AFE.Buffer
  0000                00085         global AFE.LoadCfg, AFE.SafeCfg, AFE.ReadCfg, AFE.WriteCfg, AFE.WriteRegister, AFE.ReadRegister,
                             AFE.WriteNVerifyRegister
  0000                00086         global AFE.CalcColumnParity
                      00087 
                      00088 flag_ovr        udata_ovr
0000                  00089 flag    res     1               ;using bit 2
                      00090 
                      00091 
                      00092 ;-------------------------------------------
                      00093 ; Default Configuration stored in EEPROM
                      00094 ;-------------------------------------------
                      00095 
                      00096 
                      00097 EE_SEC  code 
                      00098 
                      00099 
                      00100 
0000   00A0           00101 AFE.EEConfig0   DE      b'10100000'     ; Wakeup => High = 2ms, Low = 2ms
0001   0000           00102 AFE.EEConfig1   DE      b'00000000'     ; Demodulator output
0002   0000           00103 AFE.EEConfig2   DE      b'00000000'
0003   0000           00104 AFE.EEConfig3   DE      b'00000000'
MPASM  5.14               TRANSPONDER_AFE.ASM   10-20-2008  11:17:36         PAGE  9


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

0004   0000           00105 AFE.EEConfig4   DE      b'00000000'
0005   0000           00106 AFE.EEConfig5   DE      b'00000000'     ; modulation depth = 50 % for new device
0006   005F           00107 AFE.EEConfig6   DE      b'01011111'     ; column parity at defalt mode (50%)
                      00108 
                      00109 
                      00110 
                      00111 
                      00112         code
                      00113 
                      00114 
                      00115 
                      00116 
                      00117 ;/*
                      00118 ;       This function loads the default configuration from the EEPROM and stores it in the RAM.
                      00119 ;
                      00120 ;       @status Tested
                      00121 ;
                      00122 ;       @stacklevel 1 /*/EEPROM.ReadBytes
                      00123 ;       @registers FSR /*/EEPROM.ReadBytes
                      00124 ;       @calls EEPROM.ReadBytes /*/EEPROM.ReadBytes
                      00125 ;       @example
                      00126 ;               call    AFE.LoadCfg
                      00127 ;       @end-ex
                      00128 ;       @ex-desc Now the configuration(RAM) has been reatored from the Backup in your data EEPROM
                      00129 ;
                      00130 ;*/
0000                  00131 AFE.LoadCfg
0000   ????           00132         bankisel        AFE.ConfMap
0001   30??           00133         movlw   AFE.ConfMap
0002   0084           00134         movwf   FSR
0003   30??           00135         movlw   AFE.EEConfig0
0004   ???? ????      00136         banksel EEPROM.ADDRESS
0006   00??           00137         movwf   EEPROM.ADDRESS
0007   3007           00138         movlw   0x7
0008   2???           00139         call    EEPROM.ReadBytes
0009   0008           00140         return
                      00141 
                      00142 
                      00143 ;/*
                      00144 ;       This function saves the configuration from the RAM into the EEPROM.
                      00145 ;
                      00146 ;       @status Written
                      00147 ;
                      00148 ;       @stacklevel 1 /*/EEPROM.WriteBytes
                      00149 ;       @registers FSR /*/EEPROM.WriteBytes
                      00150 ;       @calls EEPROM.WriteBytes /*/EEPROM.WriteBytes
                      00151 ;       @example
                      00152 ;               call    AFE.SafeCfg
                      00153 ;       @end-ex
                      00154 ;       @ex-desc Now you have a copy of the configuration(RAM) in the data EEPROM of your device
                      00155 ;
                      00156 ;*/
000A                  00157 AFE.SafeCfg
MPASM  5.14               TRANSPONDER_AFE.ASM   10-20-2008  11:17:36         PAGE 10


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

000A   ????           00158         bankisel        AFE.ConfMap
000B   30??           00159         movlw   AFE.ConfMap
000C   0084           00160         movwf   FSR
000D   30??           00161         movlw   AFE.EEConfig0
000E   ???? ????      00162         banksel EEPROM.ADDRESS
0010   00??           00163         movwf   EEPROM.ADDRESS
0011   3007           00164         movlw   0x7
0012   2???           00165         call    EEPROM.WriteBytes
0013   0008           00166         return
                      00167 
                      00168 
                      00169 
                      00170 ;/*
                      00171 ;       This function writes to one register file in the AFE.
                      00172 ;       The row parity will be calculated internally.
                      00173 ;       The column parity will be written to the configuration map in RAM.
                      00174 ;       NOT to the device.
                      00175 ;
                      00176 ;       @param w The AFE-Register to write
                      00177 ;       @param AFE.ConfMap[x] The value that should be written to the AFE-Register
                      00178 ;
                      00179 ;       @status Tested
                      00180 ;
                      00181 ;       @registers      FSR /*/AFE.CalcParity /*/SPI.Write
                      00182 ;       @calls AFE.CalcParity /*/AFE.CalcParity SPI.Write /*/SPI.Write
                      00183 ;       @stacklevel 1 /*/AFE.CalcParity /*/SPI.Write
                      00184 ;
                      00185 ;       @example
                      00186 ;               movlw   0xff                                            ;move value to AFE.Buffer
                      00187 ;               banksel AFE.ConfMap
                      00188 ;               movwf   AFE.ConfMap+4
                      00189 ;               movlw   0x04                                            ;move register address to w
                      00190 ;               call    AFE.WriteRegister                       ;writes the register
                      00191 ;       @end-ex
                      00192 ;       @ex-desc        This example sets the Sensitivity Conrol Bits of Channel X and Channel Y (Regist
                            er 4)to the maximum.
                      00193 ;*/
0014                  00194 AFE.WriteRegister
0014   ???? ????      00195         banksel TEMP

⌨️ 快捷键说明

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