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

📄 rf.asm

📁 汽车无钥进入系统设计,基于PIC单片机16F639,包括电路图和源码
💻 ASM
📖 第 1 页 / 共 2 页
字号:
;------------------------------------------------------------------------------+
;                                                                              |
;    Module RF                                                                 |
;                                                                              |
;------------------------------------------------------------------------------+
;                                                                              |
;    RF.asm                                                                    |
;    Jan Ornter                                                                |
;    DATE:   11-9-2005                                                         |
;    VER.:   1.0                                                               |
;    This class provides access to the optionally RF-Interface.                |
;    It will transmit a header (see below) and pulse with modulated data (see  |
;    below).                                                                   |
;                                                                              |
;                                                                              |
;     Transmission frame                                                       |
;           |<                 Header                   >|<        Data        |
;               >|                                                             |
;           |<  Init >|< Gap >|<   High    >|<   Low    >|                     |
;            _________         _____________              _                    |
;        ___|         |_______|             |____________|                     |
;        XXXXXXXXXXXXXXXXXXXXXXXXX____                                         |
;------------------------------------------------------------------------------+
#include "Project.inc"
#include "Delay.inc"
#ifndef RF.PIN
	#define RF.PIN		5		; RF Modulation Output
	#define RF.PORT		PORTC
#endif
RF_ovr	udata_ovr
Parity			res 1
RF.COUNTER		res 1
RF.Byte_Counter	res 1
RF.Data_REG		res 1
	ifndef RF.T_HDR_INIT
;------------------------------------------------------------------------------+
;                                                                              |
;    Constant RF.T_HDR_INIT                                                    |
;                                                                              |
;------------------------------------------------------------------------------+
;                                                                              |
;    The initial high time of the header in micro seconds.                     |
;                                                                              |
;                                                                              |
;     Transmission frame                                                       |
;           |<  T_HDR_INIT >|< T_HDR_GAP >|<   T_HDR_HIGH    >|<   T_HDR_LOW   |
;            >|                                                                |
;            _______________               ___________________                 |
;               _                                                              |
;        ___|               |_____________|                                    |
;        |__________________|                                                  |
;------------------------------------------------------------------------------+
#define RF.T_HDR_INIT .4100
	endif
	ifndef RF.T_HDR_GAP
;------------------------------------------------------------------------------+
;                                                                              |
;    Constant RF.T_HDR_GAP                                                     |
;                                                                              |
;------------------------------------------------------------------------------+
;                                                                              |
;    The time of the gap between the initial high time and the filter-sequence.|
;                                                                              |
;                                                                              |
;------------------------------------------------------------------------------+
#define RF.T_HDR_GAP .550
	endif
	ifndef RF.T_HDR_HIGH
;------------------------------------------------------------------------------+
;                                                                              |
;    Constant RF.T_HDR_HIGH                                                    |
;                                                                              |
;------------------------------------------------------------------------------+
;                                                                              |
;    The high time of the filter-sequence.                                     |
;                                                                              |
;                                                                              |
;------------------------------------------------------------------------------+
#define RF.T_HDR_HIGH .2100
	endif
	ifndef RF.T_HDR_LOW
;------------------------------------------------------------------------------+
;                                                                              |
;    Constant RF.T_HDR_LOW                                                     |
;                                                                              |
;------------------------------------------------------------------------------+
;                                                                              |
;    The low time of the filter-sequence.                                      |
;                                                                              |
;                                                                              |
;------------------------------------------------------------------------------+
#define RF.T_HDR_LOW .2100
	endif
	ifndef RF.T_STEP
;------------------------------------------------------------------------------+
;                                                                              |
;    Constant RF.T_STEP                                                        |
;                                                                              |
;------------------------------------------------------------------------------+
;                                                                              |
;    This time adjusts the bitrate of the data transmission.                   |
;                                                                              |
;                                                                              |
;     A pwm coded '1'                                                          |
;         |<   T_STEP  >|<        2*T_STEP         >|                          |
;          _____________                                                       |
;        _|             |___________________________|                          |
;------------------------------------------------------------------------------+
#define RF.T_STEP .250
	endif
	
	
	
	
	global RF.Send_Header, RF.Send_Data, RF.SendBuffer
	code
;------------------------------------------------------------------------------+
;                                                                              |
;    RF.SendBuffer( w  FSR )                                                   |
;                                                                              |
;------------------------------------------------------------------------------+
;                                                                              |
;    This function sends a complete data buffer to the air.                    |
;    The Buffer has to be on Bank0 or Bank1                                    |
;                                                                              |
;                                                                              |
;    Parameters:                                                               |
;    w - The amount of bytes to be sent                                        |
;    FSR - The start address of the buffer                                     |
;                                                                              |
;                                                                              |
;                                                                              |
;    Stacklevel: 3                                                             |
;                                                                              |
;                                                                              |
;    Example:                                                                  |
;    movlw   AFE.ConfData                                                      |
;    movwf   FSR                                                               |
;    movlw   0x07                                                              |
;    call    RF.SendBuffer                                                     |
;                                                                              |
;                                                                              |
;    Description:                                                              |
;        This sends 7 bytes of the buffer "AFE.ConfMap" to the air             |
;                                                                              |
;------------------------------------------------------------------------------+
RF.SendBuffer
	banksel	RF.Byte_Counter
	movwf	RF.Byte_Counter
	call	RF.Send_Header
RF.SendBuffer.loop
	bankisel	PORTA
	movf	INDF,w
	call	RF.Send_Data
	incf	FSR,f
	banksel RF.Byte_Counter
	decfsz	RF.Byte_Counter,f
	goto	RF.SendBuffer.loop
	return
	

⌨️ 快捷键说明

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