FM1702SL.rar

源代码在线查看: spird.src

软件大小: 96 K
上传用户: 一眼万年
关键词: 1702 FM SL
下载地址: 免注册下载 普通下载 VIP

相关代码

				; .\SPIRD.SRC generated from: SPIRD.C
				; COMPILER INVOKED BY:
				;        C:\Keil\C51\BIN\C51.EXE SPIRD.C BROWSE DEBUG OBJECTEXTEND CODE SRC(.\SPIRD.SRC)
				
				$NOMOD51
				
				NAME	SPIRD
				
				P0	DATA	080H
				P1	DATA	090H
				P2	DATA	0A0H
				P3	DATA	0B0H
				P4	DATA	0D8H
				T0	BIT	0B0H.4
				AC	BIT	0D0H.6
				T1	BIT	0B0H.5
				T2	BIT	090H.0
				EA	BIT	0A8H.7
				SPEAKER	BIT	0B0H.4
				IE	DATA	0A8H
				EXF2	BIT	0C8H.6
				RD	BIT	0B0H.7
				ES	BIT	0A8H.4
				IP	DATA	0B8H
				RI	BIT	098H.0
				INT0	BIT	0B0H.2
				CY	BIT	0D0H.7
				TI	BIT	098H.1
				INT1	BIT	0B0H.3
				RCAP2H	DATA	0CBH
				PS	BIT	0B8H.4
				SP	DATA	081H
				T2EX	BIT	090H.1
				OV	BIT	0D0H.2
				RCAP2L	DATA	0CAH
				C_T2	BIT	0C8H.1
				WR	BIT	0B0H.6
				RCLK	BIT	0C8H.5
				TCLK	BIT	0C8H.4
				SBUF	DATA	099H
				PCON	DATA	087H
				RF_MOSI	BIT	090H.2
				RF_MISO	BIT	090H.3
				SCON	DATA	098H
				TMOD	DATA	089H
				TCON	DATA	088H
				IE0	BIT	088H.1
				IE1	BIT	088H.3
				B	DATA	0F0H
				CP_RL2	BIT	0C8H.0
				ACC	DATA	0E0H
				ET0	BIT	0A8H.1
				key	BIT	0D8H.3
				LCD_RD	BIT	0A0H.5
				LCD_CS	BIT	0A0H.4
				ET1	BIT	0A8H.3
				TF0	BIT	088H.5
				ET2	BIT	0A8H.5
				TF1	BIT	088H.7
				TF2	BIT	0C8H.7
				RB8	BIT	098H.2
				TH0	DATA	08CH
				EX0	BIT	0A8H.0
				IT0	BIT	088H.0
				TH1	DATA	08DH
				TB8	BIT	098H.3
				EX1	BIT	0A8H.2
				IT1	BIT	088H.2
				TH2	DATA	0CDH
				LCD_DATA	BIT	0A0H.7
				P	BIT	0D0H.0
				SM0	BIT	098H.7
				TL0	DATA	08AH
				CARD_LED	BIT	0B0H.3
				SM1	BIT	098H.6
				TL1	DATA	08BH
				SM2	BIT	098H.5
				TL2	DATA	0CCH
				PT0	BIT	0B8H.1
				PT1	BIT	0B8H.3
				RS0	BIT	0D0H.3
				PT2	BIT	0B8H.5
				TR0	BIT	088H.4
				RS1	BIT	0D0H.4
				TR1	BIT	088H.6
				TR2	BIT	0C8H.2
				PX0	BIT	0B8H.0
				PX1	BIT	0B8H.2
				RF_SCK	BIT	090H.1
				DPH	DATA	083H
				LCD_WR	BIT	0A0H.6
				DPL	DATA	082H
				EXEN2	BIT	0C8H.3
				REN	BIT	098H.4
				T2CON	DATA	0C8H
				RF_NSS	BIT	090H.4
				RXD	BIT	0B0H.0
				TXD	BIT	0B0H.1
				RF_RST	BIT	0B0H.5
				F0	BIT	0D0H.5
				PSW	DATA	0D0H
				?PR?_SPIRead?SPIRD   SEGMENT CODE 
				?PR?_SPIWrite?SPIRD  SEGMENT CODE 
					PUBLIC	_SPIWrite
					PUBLIC	_SPIRead
				; 
				; #include 
				; #include 
				; #include 
				; #include 
				; #include 
				; #include "FM1702.h"
				; 
				; sbit RF_NSS	=	P1^4;
				; sbit RF_MISO	=	P1^3;
				; sbit RF_MOSI	=	P1^2;
				; sbit RF_SCK	=	P1^1;
				; 
				; sbit RF_RST  	=   P3^5;	//由高变低时启动内部复位程序	
				; 
				; sbit CARD_LED	=	P3^3;
				; sbit SPEAKER    =   P3^4; 
				; 
				; sbit LCD_CS =	P2^4;
				; sbit LCD_RD =	P2^5;
				; sbit LCD_WR =	P2^6;
				; sbit LCD_DATA =	P2^7;
				; 
				; sfr P4 = 0xD8;
				; sbit key	= P4^3;
				; 
				; 
				; /****************************************************************/
				; /*名称: SPIRead */
				; /*功能: 该函数根据给定的地址读取FM1702SL的寄存器*/
				; /*输入: 寄存器地址, 读出值存放首地址*/
				; /*输出: 寄存器值*/
				; /****************************************************************/
				; unsigned char SPIRead(unsigned char SpiAddress)
				
					RSEG  ?PR?_SPIRead?SPIRD
				_SPIRead:
					USING	0
							; SOURCE LINE # 34
				;---- Variable 'SpiAddress?040' assigned to Register 'R7' ----
				; {
							; SOURCE LINE # 35
				; 	unsigned char data i,k,rdata,temp;
				; 	rdata=0;
							; SOURCE LINE # 37
				;---- Variable 'rdata?043' assigned to Register 'R6' ----
					CLR  	A
					MOV  	R6,A
				; 	SpiAddress=_crol_(SpiAddress,1);
							; SOURCE LINE # 38
					MOV  	R0,#01H
					MOV  	A,R7
					INC  	R0
					SJMP 	?C0023
				?C0022:
					RL   	A
				?C0023:
					DJNZ 	R0,?C0022
					MOV  	R7,A
				; 	SpiAddress=SpiAddress | 0x80;
							; SOURCE LINE # 39
					ORL  	AR7,#080H
				; 	RF_SCK=0;
							; SOURCE LINE # 40
					CLR  	RF_SCK
				; 	RF_NSS=0;
							; SOURCE LINE # 41
					CLR  	RF_NSS
				; 
				; //Send SpiAddress;
				; 	for (i=0;i							; SOURCE LINE # 44
				;---- Variable 'i?041' assigned to Register 'R5' ----
					CLR  	A
					MOV  	R5,A
				?C0001:
				; 	{
							; SOURCE LINE # 45
				; 		temp=SpiAddress&0x80;
							; SOURCE LINE # 46
					MOV  	A,R7
					ANL  	A,#080H
					MOV  	R4,A
				;---- Variable 'temp?044' assigned to Register 'R4' ----
				; 		if (temp==0x80)	RF_MOSI=1;
							; SOURCE LINE # 47
					CJNE 	R4,#080H,?C0004
					SETB 	RF_MOSI
					SJMP 	?C0005
				?C0004:
				; 		else RF_MOSI=0;
							; SOURCE LINE # 48
					CLR  	RF_MOSI
				?C0005:
				; 		RF_SCK=1;
							; SOURCE LINE # 49
					SETB 	RF_SCK
				; 		SpiAddress=_crol_(SpiAddress,1);
							; SOURCE LINE # 50
					MOV  	R0,#01H
					MOV  	A,R7
					INC  	R0
					SJMP 	?C0025
				?C0024:
					RL   	A
				?C0025:
					DJNZ 	R0,?C0024
					MOV  	R7,A
				; 		RF_SCK=0;
							; SOURCE LINE # 51
					CLR  	RF_SCK
				; 	}
							; SOURCE LINE # 52
					INC  	R5
					CJNE 	R5,#08H,?C0001
				?C0002:
				; //Send SpiAddress;
				; //Receive data
				; 
				; 		for (k=0;k							; SOURCE LINE # 56
				;---- Variable 'k?042' assigned to Register 'R5' ----
					CLR  	A
					MOV  	R5,A
				?C0006:
				; 		{
							; SOURCE LINE # 57
				; 			RF_SCK=1;
							; SOURCE LINE # 58
					SETB 	RF_SCK
				; 			CY=RF_MISO;
							; SOURCE LINE # 59
					MOV  	C,RF_MISO
				; 			if (CY) rdata+=1;
							; SOURCE LINE # 60
					JNB  	CY,?C0009
					INC  	R6
				?C0009:
				; 			rdata=_crol_(rdata,1);
							; SOURCE LINE # 61
					MOV  	R0,#01H
					MOV  	R7,AR6
					MOV  	A,R7
					INC  	R0
					SJMP 	?C0027
				?C0026:
					RL   	A
				?C0027:
					DJNZ 	R0,?C0026
					MOV  	R6,A
				; 			RF_SCK=0;
							; SOURCE LINE # 62
					CLR  	RF_SCK
				; 			_nop_();
							; SOURCE LINE # 63
					NOP  	
				; 		}
							; SOURCE LINE # 64
					INC  	R5
					CJNE 	R5,#08H,?C0006
				?C0007:
				; 
				; 
				; 	RF_NSS=1;		
							; SOURCE LINE # 67
					SETB 	RF_NSS
				; 	CY=0;
							; SOURCE LINE # 68
					CLR  	CY
				; 	return(rdata);
							; SOURCE LINE # 69
					MOV  	R7,AR6
				; }
							; SOURCE LINE # 70
				?C0010:
					RET  	
				; END OF _SPIRead
				
				; /****************************************************************/
				; /*名称: SPIWrite */
				; /*功能: 该函数根据给定的地址写入FM1702SL的寄存器*/
				; /*输入: 寄存器地址,要写入的字节数 */
				; /*输出: N/A*/
				; /****************************************************************/
				; void SPIWrite(unsigned char idata SpiAddress,unsigned char idata SpiData)
				
					RSEG  ?PR?_SPIWrite?SPIRD
				_SPIWrite:
					USING	0
							; SOURCE LINE # 77
				;---- Variable 'temp?149' assigned to Register 'R6' ----
				;---- Variable 'SpiAddress?145' assigned to Register 'R7' ----
				;---- Variable 'SpiData?146' assigned to Register 'R5' ----
				; {
							; SOURCE LINE # 78
				; 	unsigned char data i,k,temp;
				; 
				; //	temp=SpiAddress&0xc0;
				; //	if (temp!=0)
				; //	{
				; //		CY=1;
				; //		return;
				; //	}
				; 	SpiAddress=_crol_(SpiAddress,1);
							; SOURCE LINE # 87
					MOV  	R0,#01H
					MOV  	A,R7
					INC  	R0
					SJMP 	?C0029
				?C0028:
					RL   	A
				?C0029:
					DJNZ 	R0,?C0028
					MOV  	R7,A
				; 	SpiAddress=SpiAddress &0x7e;
							; SOURCE LINE # 88
					ANL  	AR7,#07EH
				; 	RF_SCK=0;
							; SOURCE LINE # 89
					CLR  	RF_SCK
				; 	RF_NSS=0; 
							; SOURCE LINE # 90
					CLR  	RF_NSS
				; 
				; //Send SpiAddress
				; 	for (i=0;i							; SOURCE LINE # 93
				;---- Variable 'i?147' assigned to Register 'R4' ----
					CLR  	A
					MOV  	R4,A
				?C0011:
				; 	{
							; SOURCE LINE # 94
				; 		temp=SpiAddress&0x80;
							; SOURCE LINE # 95
					MOV  	A,R7
					ANL  	A,#080H
					MOV  	R6,A
				; 		if (temp==0x80)	RF_MOSI=1;
							; SOURCE LINE # 96
					CJNE 	R6,#080H,?C0014
					SETB 	RF_MOSI
					SJMP 	?C0015
				?C0014:
				; 		else RF_MOSI=0;
							; SOURCE LINE # 97
					CLR  	RF_MOSI
				?C0015:
				; 		RF_SCK=1;
							; SOURCE LINE # 98
					SETB 	RF_SCK
				; 		SpiAddress=_crol_(SpiAddress,1);
							; SOURCE LINE # 99
					MOV  	R0,#01H
					MOV  	A,R7
					INC  	R0
					SJMP 	?C0031
				?C0030:
					RL   	A
				?C0031:
					DJNZ 	R0,?C0030
					MOV  	R7,A
				; 		RF_SCK=0;
							; SOURCE LINE # 100
					CLR  	RF_SCK
				; 	}
							; SOURCE LINE # 101
					INC  	R4
					CJNE 	R4,#08H,?C0011
				?C0012:
				; //Send SpiAddress
				; //	Send data;
				; 
				; 		for(k=0;k							; SOURCE LINE # 105
				;---- Variable 'k?148' assigned to Register 'R4' ----
					CLR  	A
					MOV  	R4,A
				?C0016:
				; 		{
							; SOURCE LINE # 106
				; 			temp=SpiData&0x80;
							; SOURCE LINE # 107
					MOV  	A,R5
					ANL  	A,#080H
					MOV  	R6,A
				; 			if (temp==0x80)	RF_MOSI=1;
							; SOURCE LINE # 108
					CJNE 	R6,#080H,?C0019
					SETB 	RF_MOSI
					SJMP 	?C0020
				?C0019:
				; 			else RF_MOSI=0;
							; SOURCE LINE # 109
					CLR  	RF_MOSI
				?C0020:
				; 			RF_SCK=1;
							; SOURCE LINE # 110
					SETB 	RF_SCK
				; 			SpiData=_crol_(SpiData,1);
							; SOURCE LINE # 111
					MOV  	R0,#01H
					MOV  	R7,AR5
					MOV  	A,R7
					INC  	R0
					SJMP 	?C0033
				?C0032:
					RL   	A
				?C0033:
					DJNZ 	R0,?C0032
					MOV  	R5,A
				; 			RF_SCK=0;
							; SOURCE LINE # 112
					CLR  	RF_SCK
				; 		}
							; SOURCE LINE # 113
					INC  	R4
					CJNE 	R4,#08H,?C0016
				?C0017:
				; 
				; //Send data;
				; 	RF_NSS=1;
							; SOURCE LINE # 116
					SETB 	RF_NSS
				; 	CY=0;
							; SOURCE LINE # 117
					CLR  	CY
				; //	return;
				; }
							; SOURCE LINE # 119
					RET  	
				; END OF _SPIWrite
				
					END
							

相关资源