📄 rf.lst
字号:
0003 00044 RF.Data_REG res 1
00045
00046
00047 ifndef RF.T_HDR_INIT
00048 ;/*
00049 ; The initial high time of the header in micro seconds.
00050 ;
00051 ; @timingdiagram Transmission frame
00052 ; |< T_HDR_INIT >|< T_HDR_GAP >|< T_HDR_HIGH >|< T_HDR_LOW >|
00053 ; _______________ ___________________ _
00054 ; ___| |_____________| |__________________|
00055 ;
00056 ;*/
00057 #define RF.T_HDR_INIT .4100
00058 endif
00059 ifndef RF.T_HDR_GAP
00060 ;/*
00061 ; The time of the gap between the initial high time and the filter-sequence.
00062 ;*/
00063 #define RF.T_HDR_GAP .550
00064 endif
00065 ifndef RF.T_HDR_HIGH
00066 ;/*
00067 ; The high time of the filter-sequence.
00068 ;*/
00069 #define RF.T_HDR_HIGH .2100
00070 endif
00071 ifndef RF.T_HDR_LOW
00072 ;/*
00073 ; The low time of the filter-sequence.
00074 ;*/
00075 #define RF.T_HDR_LOW .2100
00076 endif
00077 ifndef RF.T_STEP
00078 ;/*
00079 ;
00080 ; This time adjusts the bitrate of the data transmission.
00081 ;
00082 ;
00083 ; @timingdiagram A pwm coded '1'
00084 ; |< T_STEP >|< 2*T_STEP >|
MPASM 5.14 RF.ASM 9-26-2008 8:07:49 PAGE 6
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
00085 ; _____________
00086 ; _| |___________________________|
00087 ;
00088 ;
00089 ; @timingdiagram A pwm coded '0'
00090 ; |< 2*T_STEP >|< T_STEP >|
00091 ; ___________________________
00092 ; _| |_____________|
00093 ;
00094 ;*/
00095 #define RF.T_STEP .250
00096 endif
00097
00098
00099
00100
0000 00101 global RF.Send_Header, RF.Send_Data, RF.SendBuffer
00102
00103 code
00104
00105 ;/*
00106 ; This function sends a complete data buffer to the air.
00107 ; The Buffer has to be on Bank0 or Bank1
00108 ;
00109 ; @param w The amount of bytes to be sent
00110 ; @param FSR The start address of the buffer
00111 ;
00112 ; @example
00113 ; movlw AFE.ConfData
00114 ; movwf FSR
00115 ; movlw 0x07
00116 ; call RF.SendBuffer
00117 ; @end-ex
00118 ; @ex-desc This sends 7 bytes of the buffer "AFE.ConfMap" to the air
00119 ;
00120 ; @status Tested
00121 ;
00122 ; @stacklevel 1 /*/RF.Send_Data
00123 ;
00124 ;*/
0000 00125 RF.SendBuffer
0000 ???? ???? 00126 banksel RF.Byte_Counter
0002 00?? 00127 movwf RF.Byte_Counter
0003 2??? 00128 call RF.Send_Header
0004 00129 RF.SendBuffer.loop
0004 1383 00130 bankisel PORTA
0005 0800 00131 movf INDF,w
0006 2??? 00132 call RF.Send_Data
0007 0A84 00133 incf FSR,f
0008 ???? ???? 00134 banksel RF.Byte_Counter
000A 0B?? 00135 decfsz RF.Byte_Counter,f
000B 2??? 00136 goto RF.SendBuffer.loop
000C 0008 00137 return
MPASM 5.14 RF.ASM 9-26-2008 8:07:49 PAGE 7
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
00138
00139 ;----------------------------------------------------
00140 ; Send UHF Data Byte
00141 ; Data format:
00142 ; ---------------------------------------------------
00143 ;/*
00144 ;
00145 ; This function will transmit one byte of data over the RF antenna.
00146 ; The value in w will be sent to the air over the RF antenna.
00147 ;
00148 ; @param w The Byte of data to be sent
00149 ;
00150 ; @example
00151 ; movlw 0xf0
00152 ; call RF.Send_Data
00153 ; @end-ex
00154 ; @ex-desc This sends 0xf0 over the RF antenna
00155 ;
00156 ; @status Tested
00157 ;
00158 ; @stacklevel 1 /*/Delay.start /*/Delay.wait
00159 ; @registers /*/Delay.start /*/Delay.wait
00160 ; @calls Delay.start /*/Delay.start Delay.wait /*/Delay.wait
00161 ;
00162 ;*/
000D 00163 RF.Send_Data
000D ???? ???? 00164 banksel RF.Data_REG
000F 00?? 00165 movwf RF.Data_REG ; Load Data to Send
0010 01?? 00166 clrf Parity
00167 ; Send Byte using UHF transmitter
00168
0011 00169 Transmit8
0011 ???? ???? 00170 banksel RF.COUNTER
0013 3008 00171 movlw .8
0014 00?? 00172 movwf RF.COUNTER ; initialize count register
0015 00173 TransmitNext
0015 ???? ???? 00174 banksel RF.Data_REG
0017 0C?? 00175 rrf RF.Data_REG, f ; rotate receive register
0018 1803 00176 btfsc STATUS, C ; test bit to be transmited
0019 2??? 00177 goto SendOne ; send high value
00178
001A 00179 SendZero
001A 2??? 00180 call Delay.Wait
001B 1283 1303 00181 banksel RF.PORT
001D 1687 00182 bsf RF.PORT,RF.PIN ; rf modulation on
001E 300A 00183 movlw ((2*RF.T_STEP)/.50)
001F 2??? 00184 call Delay.start
0020 2??? 00185 call Delay.Wait
0021 1283 1303 00186 banksel RF.PORT
0023 1287 00187 bcf RF.PORT,RF.PIN ; rf modulation off
0024 3005 00188 movlw (RF.T_STEP/.50)
0025 2??? 00189 call Delay.start
0026 2??? 00190 goto SendNextBit ; send next bit
MPASM 5.14 RF.ASM 9-26-2008 8:07:49 PAGE 8
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
00191
0027 00192 SendOne
0027 2??? 00193 call Delay.Wait
0028 1283 1303 00194 banksel RF.PORT
002A 1687 00195 bsf RF.PORT,RF.PIN ; rf modulation on
002B 3005 00196 movlw (RF.T_STEP/.50)
002C 2??? 00197 call Delay.start
002D 2??? 00198 call Delay.Wait
002E 1283 1303 00199 banksel RF.PORT
0030 1287 00200 bcf RF.PORT,RF.PIN ; rf modulation off
0031 300A 00201 movlw ((2*RF.T_STEP)/.50)
0032 2??? 00202 call Delay.start
0033 ???? ???? 00203 banksel Parity
0035 0A?? 00204 incf Parity,f
00205 ; goto SendNextBit ; send next bit
00206
0036 00207 SendNextBit
0036 ???? ???? 00208 banksel RF.COUNTER
0038 08?? 00209 movf RF.COUNTER,f
0039 1903 00210 btfsc STATUS,Z
003A 2??? 00211 goto EndTX
003B 0B?? 00212 decfsz RF.COUNTER, f ; decrement counter register
003C 2??? 00213 goto TransmitNext ; transmit next bit
003D 00214 SendParity
00215 ; btfsc Parity,7
00216 ; goto EndTX
00217 ; bsf Parity,7
003D 1C00 00218 btfss Parity,0
003E 2??? 00219 goto SendOne
003F ???? ???? 00220 banksel Parity
0041 1800 00221 btfsc Parity,0
0042 2??? 00222 goto SendZero
0043 00223 EndTX
0043 2??? 00224 call Delay.Wait
0044 3400 00225 retlw 0x00 ; return to main routine
00226
00227
00228 ;----------------------------------------------------
00229 ; Same as the LF data
00230 ; Data format: (4ms + 500us + 2ms + 2ms)
00231 ; ---------------------------------------------------
00232 ;/*
00233 ;
00234 ; This function will transmit the header over the RF antenna.
00235 ; The header is used to activate the receiver.
00236 ; Data format: (4ms + 500us + 2ms + 2ms)
00237 ;
00238 ;
00239 ; @example
00240 ; call RF.Send_Header
00241 ; @end-ex
00242 ; @ex-desc This sends the header
00243 ;
MPASM 5.14 RF.ASM 9-26-2008 8:07:49 PAGE 9
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
00244 ; @status Tested
00245 ;
00246 ; @stacklevel 1 /*/Delay.start /*/Delay.wait
00247 ; @registers /*/Delay.start /*/Delay.wait
00248 ; @calls Delay.start /*/Delay.start Delay.wait /*/Delay.wait
00249 ;
00250 ;
00251 ;*/
0045 00252 RF.Send_Header
0045 1283 1303 00253 banksel RF.PORT
0047 1687 00254 bsf RF.PORT,RF.PIN ; modulation data for rf
0048 3052 00255 movlw (RF.T_HDR_INIT/.50)
0049 2??? 00256 call Delay.start
004A 2??? 00257 call Delay.Wait
004B 1283 1303 00258 banksel RF.PORT
004D 1287 00259 bcf RF.PORT,RF.PIN ; turn off modulation data for rf
004E 300B 00260 movlw (RF.T_HDR_GAP/.50)
004F 2??? 00261 call Delay.start
0050 2??? 00262 call Delay.Wait
0051 1283 1303 00263 banksel RF.PORT
0053 1687 00264 bsf RF.PORT,RF.PIN ; modulation data for rf
0054 302A 00265 MOVLW (RF.T_HDR_HIGH/.50)
0055 2??? 00266 call Delay.start
0056 2??? 00267 call Delay.Wait
0057 1283 1303 00268 banksel RF.PORT
0059 1287 00269 bcf RF.PORT,RF.PIN ; turn off modulation data for rf
005A 302A 00270 movlw (RF.T_HDR_LOW/.50)
005B 2??? 00271 call Delay.start
005C 0008 00272 return
00273
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -