📄 transponder_afe.lst
字号:
MPASM 5.14 TRANSPONDER_AFE.ASM 10-20-2008 11:17:36 PAGE 1
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
00001 ;------------------------------------------------------------------------------
00002 ; Transponder_AFE.ASM ;AFE 应答器
00003 ;
00004 ; Jan Ornter
00005 ;
00006 ; DATE: 11-9-2005
00007 ; VER.: 1.0
00008 ;
00009 ;------------------------------------------------------------------------------
00010 ;------------------------------------------------------------------------------
00011 ; LEGAL NOTICE
00012 ;
00013 ; The information contained in this document is proprietary and
00014 ; confidential information of Microchip Technology Inc. Therefore all
00015 ; parties are required to sign a non-disclosure agreement before
00016 ; receiving this document.
00017 ;
00018 ; The information contained in this Application Note is for suggestion
00019 ; only. It is your responsibility to ensure that your application meets
00020 ; with your specifications. No representation or warranty is given and
00021 ; no liability is assumed by Microchip Technology Incorporated with
00022 ; respect to the accuracy or use of such information or infringement of
00023 ; patents or other intellectual property arising from such use or
00024 ; otherwise.
00025 ;
00026 ; Software License Agreement
00027 ;
00028 ; The software supplied herewith by Microchip Technology Incorporated
00029 ; (the "Company") for its PICmicro?Microcontroller is intended and
00030 ; supplied to you, the Company's customer, for use solely and
00031 ; exclusively on Microchip PICmicro Microcontroller products. The
00032 ; software is owned by the Company and/or its supplier, and is
00033 ; protected under applicable copyright laws. All rights are reserved.
00034 ; Any use in violation of the foregoing restrictions may subject the
00035 ; user to criminal sanctions under applicable laws, as well as to
00036 ; civil liability for the breach of the terms and conditions of this
00037 ; license.
00038 ;
00039 ; THIS SOFTWARE IS PROVIDED IN AN "AS IS" CONDITION. NO WARRANTIES,
00040 ; WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED
00041 ; TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
00042 ; PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT,
00043 ; IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR
00044 ; CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
00045 ;------------------------------------------------------------------------------
00046
00047
00048
00049
00050
00051 ;/*
00052 ;
00053 ; This class provides access to the Analog Front End.
MPASM 5.14 TRANSPONDER_AFE.ASM 10-20-2008 11:17:36 PAGE 2
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
00054 ;
00055 ;*/
00056
00057
00058
00059
00060
00061 #include Project.inc
00001
00002
00003 list p=16F636 ; list directive to define processor
00004 #include <p16f636.inc> ; processor specific variable definitions
00001 LIST
00002 ; P16F636.INC Standard Header File, Version 1.00 Microchip Technology, Inc.
00317 LIST
00005
00006 ERRORLEVEL 0,-302,-312 ; Messages, Warnings and Errors Printed
00007 ; Ignore [301] => Processor Mismatch.
00008 ; Ignore [302] => Register in operand not in bank 0.
00009 ; Ignore [312] => Pagesel not needed for
Device
00062 #include Delay.inc
00001 #ifndef DELAY_INC
00002 #define DELAY_INC
00003
00004
00005 #define Delay.Returned Delay.flag,3
00006
0000 00007 extern Delay.wait_w_x_50us, Delay.flag, Delay.Counter
0000 00008 extern Delay.start, Delay.Wait
00009 ;
00010 ;
00011 ; This macro initialises the delay module
00012 ;
00013 ;
00014 ;Delay.Init macro
00015 ; banksel OPTION_REG
00016 ; MOVLW b'00000000' ; SET UP FOR TMR0'S PRESCALER VALUE TO 1
00017 ; ; (RAPU, bit7) = 0 to enable weak pull-up for Po
rtA also
00018 ; MOVWF OPTION_REG ; this is used for Delay loop only
00019 ; endm
00020
00021 ;/*
00022 ;
00023 ; This macro waits for up to 12 ms.
00024 ; The time has to be a multible of 50us.
00025 ; It is just added to enhance readability of the source code.
00026 ; It calls Delay.wait_w_x_50us with appropriate parameters.
00027 ; This function is intended to run at 8 MHz.
00028 ; If running other speeds, change the Delay.wait_w_x_50us method.
00029 ;
00030 ; @param time The value of time
MPASM 5.14 TRANSPONDER_AFE.ASM 10-20-2008 11:17:36 PAGE 3
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
00031 ; @param unit The character corresponding to the unit of time (i.e. 'u', 'm')
00032 ;
00033 ; @example
00034 ; banksel PORTB
00035 ; bsf PORTB,0
00036 ; Delay.waitFor .500, 'u'
00037 ; banksel PORTB
00038 ; bcf PORTB,0
00039 ; @end-ex
00040 ; @ex-desc This sets Pin RB0 high for approx. 500 us
00041 ;
00042 ; @status Tested
00043 ;
00044 ; @stacklevel +1
00045 ;
00046 ; @registers Delay.Returned
00047 ;
00048 ;*/
00049
00050
00051 Delay.WaitFor macro time, unit
00052
00053 if(unit == 'u')
00054 movlw (time/.50)
00055 else
00056 if (unit == 'm')
00057 movlw ((time*.1000)/.50)
00058 endif
00059 endif
00060 call Delay.wait_w_x_50us
00061
00062 endm
00063
00064
00065 ;Delay.start macro us ;build as function? Yes, absolutely
00066 ; banksel OPTION_REG ;2Cycles 1 ;setting prescaler to 1:2
00067 ; clrf OPTION_REG ;1Cycles 1
00068 ; banksel TMR0 ;2Cycles 1
00069 ; movlw 0xEA ;1Cycles 1 ;0x100 - 0x32 (50u) + 0x06 (stat
ic offset) + 0x07(Interrupt) + 0x0F (n first cycle)= 0xEA to compenste static Offsets
00070 ; movwf TMR0 ;1Cycles 1
00071 ; bsf INTCON,T0IE
00072 ; banksel Delay.Counter ;don't care timer already started
00073 ; movlw (us/.50)
00074 ; movwf Delay.Counter
00075 ; banksel Delay.flag
00076 ; bcf Delay.Returned
00077 ; nop
00078 ; endm
00079
00080 ;Delay.Wait macro
00081 ; banksel Delay.flag
00082 ; btfss Delay.Returned
MPASM 5.14 TRANSPONDER_AFE.ASM 10-20-2008 11:17:36 PAGE 4
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
00083 ; goto $-1 ;at least 1 Cycle
00084 ; bcf INTCON,T0IE
00085 ; endm
00086
00087 ;/*
00088 ;
00089 ; This macro must be called within the Interrupt routine, to enable the counter.
00090 ; The Counter function is optimized for the following Interrupt routine.
00091 ; If you do changes to that routine you will have to modify counter.start function,
00092 ; to compensate these instructions (or you will loose precision).
00093 ;
00094 ; @param w The multiplicator
00095 ;
00096 ; @example
00097 ; INT code 0x04
00098 ; movwf W_TEMP ; Save off current W register contents
00099 ; movf STATUS,w
00100 ; clrf STATUS ; Force to page0
00101 ; movwf STATUS_TEMP
00102 ; movf PCLATH,w
00103 ; movwf PCLATH_TEMP ; Save PCLATH
00104 ; movf FSR,w
00105 ; movwf FSR_TEMP ; Save FSR
00106 ; GOTO INT_SERV
00107 ;
00108 ;
00109 ; INT_SERV
00110 ; TIMER0_INT
00111 ; btfss INTCON,T0IE ; Check if PORTA Interrupt Enabled
00112 ; goto NEXT_INT ; ... No, then continue search
00113 ;
00114 ; btfss INTCON,T0IF ; Check if TMR0 Interrupt Flag Set
00115 ; goto NEXT_INT
00116 ;
00117 ; Delay.Isr ; Handles the delay routines
00118 ;
00119 ; ; *** If you want to use Timer0 for other Interrupts modify the Delay.start function,
00120 ; ; *** to compensate all instructions, you place here.
00121 ;
00122 ; bcf INTCON,T0IF
00123 ; goto EndIsr
00124 ;
00125 ;
00126 ; ; ***You may place other Interrupt Handlers here***
00127 ;
00128 ;
00129 ;
00130 ; EndIsr
00131 ; clrf STATUS ;Select Bank0
00132 ; movf FSR_TEMP,w
00133 ; movwf FSR ;Restore FSR
00134 ; movf PCLATH_TEMP,w
MPASM 5.14 TRANSPONDER_AFE.ASM 10-20-2008 11:17:36 PAGE 5
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
00135 ; movwf PCLATH ;Restore PCLATH
00136 ; movf STATUS_TEMP,w
00137 ; movwf STATUS ;Restore STATUS
00138 ; swapf W_TEMP,f
00139 ; swapf W_TEMP,w ;Restore W without corrupting STATUS bits
00140 ; RETFIE
00141 ; @end-ex
00142 ; @ex-desc
00143 ;
00144 ; @status Tested
00145 ;
00146 ; @stacklevel 0
00147 ;
00148 ; @registers TMR0
00149 ;
00150 ;*/
00151 Delay.Isr macro
00152 banksel TMR0 ;2Cycles n
00153 movlw 0xD8 ;1Cycle n ;so set 0x100-0x32+0x02+0x0E=0xDC
00154 movwf TMR0 ;1Cycle n
00155 banksel Delay.Counter ;2Cycles 1
00156 decfsz Delay.Counter ;1Cycle 1
00157 goto Delay.Isr.End ;2Cycle 0
00158 banksel Delay.flag ;2Cycles 1
00159 bsf Delay.Returned ;1Cycle 1
00160 Delay.Isr.End
00161 endm
00162
00163
00164
00165 #endif
00063 #include SPI.inc
00001 ifndef SPI_INC
00002 #define SPI_INC
00003
00004 ;/*
00005 ; Stores the most significant Byte
00006 ;*/
0000 00007 extern SPI.BufferH
00008 ;/*
00009 ; Stores the least significant Byte
00010 ;*/
0000 00011 extern SPI.BufferL
0000 00012 extern SPI.Read, SPI.Write
00013 ;extern SPI.ShiftOutBuffer, SPI.ShiftInBuffer
00014
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -