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

📄 rf.asm

📁 汽车无钥进入系统设计,基于PIC单片机16F639,包括电路图和源码
💻 ASM
📖 第 1 页 / 共 2 页
字号:
;----------------------------------------------------
;	Send UHF Data Byte
;	Data format: 
; ---------------------------------------------------
;------------------------------------------------------------------------------+
;                                                                              |
;    RF.Send_Data( w )                                                         |
;                                                                              |
;------------------------------------------------------------------------------+
;                                                                              |
;    This function will transmit one byte of data over the RF antenna.         |
;    The value in w will be sent to the air over the RF antenna.               |
;                                                                              |
;                                                                              |
;    Parameters:                                                               |
;    w - The Byte of data to be sent                                           |
;                                                                              |
;                                                                              |
;                                                                              |
;    Used SFRs:    INTCON OPTION_REG                                           |
;                                                                              |
;                                                                              |
;    Calls subroutines:                                                        |
;    Delay.start                                                               |
;    Delay.wait                                                                |
;                                                                              |
;                                                                              |
;    Stacklevel: 2                                                             |
;                                                                              |
;                                                                              |
;    Example:                                                                  |
;    movlw   0xf0                                                              |
;    call    RF.Send_Data                                                      |
;                                                                              |
;                                                                              |
;    Description:                                                              |
;        This sends 0xf0 over the RF antenna                                   |
;                                                                              |
;------------------------------------------------------------------------------+
RF.Send_Data
	banksel RF.Data_REG
	movwf	RF.Data_REG		; Load Data to Send
	clrf	Parity
	; Send Byte using UHF transmitter
Transmit8	
	banksel RF.COUNTER
	movlw	.8
	movwf	RF.COUNTER	; initialize count register
TransmitNext
	banksel RF.Data_REG
	rrf		RF.Data_REG, f		; rotate receive register
	btfsc	STATUS, C		; test bit to be transmited
	goto	SendOne			; send high value
SendZero
	call 	Delay.Wait
	banksel RF.PORT
	bsf		RF.PORT,RF.PIN	; rf modulation on
	movlw	((2*RF.T_STEP)/.50)
	call 	Delay.start
	call 	Delay.Wait
	banksel RF.PORT
	bcf		RF.PORT,RF.PIN	; rf modulation off
	movlw	(RF.T_STEP/.50)
	call 	Delay.start
	goto	SendNextBit		; send next bit
SendOne
	call 	Delay.Wait
	banksel RF.PORT
	bsf		RF.PORT,RF.PIN	; rf modulation on
	movlw	(RF.T_STEP/.50)
	call 	Delay.start
	call 	Delay.Wait
	banksel RF.PORT
	bcf		RF.PORT,RF.PIN	; rf modulation off
	movlw	((2*RF.T_STEP)/.50)
	call 	Delay.start
	banksel	Parity
	incf	Parity,f
;	goto	SendNextBit		; send next bit
SendNextBit	
	banksel RF.COUNTER
	movf	RF.COUNTER,f
	btfsc	STATUS,Z
	goto	EndTX
	decfsz	RF.COUNTER, f	; decrement counter register
	goto	TransmitNext 	; transmit next bit
SendParity
;	btfsc	Parity,7
;	goto	EndTX
;	bsf		Parity,7
	btfss	Parity,0
	goto	SendOne
	banksel Parity
	btfsc	Parity,0
	goto	SendZero
EndTX
	call 	Delay.Wait
	retlw	0x00			; return to main routine
;----------------------------------------------------
;	Same as the LF data
;	Data format: (4ms + 500us + 2ms + 2ms) 
; ---------------------------------------------------
;------------------------------------------------------------------------------+
;                                                                              |
;    RF.Send_Header()                                                          |
;                                                                              |
;------------------------------------------------------------------------------+
;                                                                              |
;    This function will transmit the header over the RF antenna.               |
;    The header is used to activate the receiver.                              |
;    Data format: (4ms + 500us + 2ms + 2ms)                                    |
;                                                                              |
;                                                                              |
;                                                                              |
;    Used SFRs:    INTCON OPTION_REG                                           |
;                                                                              |
;                                                                              |
;    Calls subroutines:                                                        |
;    Delay.start                                                               |
;    Delay.wait                                                                |
;                                                                              |
;                                                                              |
;    Stacklevel: 2                                                             |
;                                                                              |
;                                                                              |
;    Example:                                                                  |
;    call    RF.Send_Header                                                    |
;                                                                              |
;                                                                              |
;    Description:                                                              |
;        This sends the header                                                 |
;                                                                              |
;------------------------------------------------------------------------------+
RF.Send_Header
	banksel	RF.PORT
	bsf		RF.PORT,RF.PIN	; modulation data for rf
	movlw	(RF.T_HDR_INIT/.50)
	call	Delay.start
	call	Delay.Wait
	banksel	RF.PORT
	bcf		RF.PORT,RF.PIN	; turn off modulation data for rf
	movlw	(RF.T_HDR_GAP/.50)
	call	Delay.start
	call	Delay.Wait
	banksel	RF.PORT
	bsf		RF.PORT,RF.PIN	; modulation data for rf
	MOVLW	(RF.T_HDR_HIGH/.50)
	call	Delay.start
	call	Delay.Wait
	banksel	RF.PORT
	bcf		RF.PORT,RF.PIN	; turn off modulation data for rf
	movlw	(RF.T_HDR_LOW/.50)
	call	Delay.start
	return	
;****************************************************** 
;	END OF FILE : UHF_TX.ASM
;******************************************************	
	END

⌨️ 快捷键说明

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