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

📄 2.4g+̤

📁 2.4G无线模块资料
💻 4G+̤
📖 第 1 页 / 共 3 页
字号:
; 		}
L14:
	.dbline 187
; 		if(accept_flag==1)
	lds R24,_accept_flag
	cpi R24,1
	brne L18
	.dbline 188
; 		{
	.dbline 189
; 		    accept_flag=0;
	clr R2
	sts _accept_flag,R2
	.dbline 190
;     	 	PORTB = 0x80;
	ldi R24,128
	out 0x5,R24
	.dbline 191
; 		    delayms(1000);	//延时10ms*10=100ms
	ldi R16,1000
	ldi R17,3
	rcall _delayms
	.dbline 192
; 		    PORTB = 0x00;
	clr R2
	out 0x5,R2
	.dbline 201
; //			nrf24l01init();
; //    		nRF24L01_CEL;
; //			delay();
; //			nRF24L01_CSNH;			// Spi disable
; //			delay();
; //			nRF24L01_SCKL;	
; //			delay();
; //			Buffer[1]=0;
; 			RX_Mode();
	rcall _RX_Mode
	.dbline 203
; 	//		delayms(1000);	//延时10ms*10=100ms
; 		}
L18:
	.dbline 204
L3:
	.dbline 157
	rjmp L2
X0:
	.dbline -2
L1:
	adiw R28,1
	.dbline 0 ; func end
	ret
	.dbsym r Get_SO 20 c
	.dbend
	.dbfunc e nrf24l01init _nrf24l01init fV
	.even
_nrf24l01init::
	.dbline -1
	.dbline 209
; 	}
; 
; 
; }
; void nrf24l01init(void)
; {
	.dbline 210
;  	 nRF24L01_IRQ_DIR;
	cbi 0x4,2
	.dbline 211
; 	 nRF24L01_MISO_DIR;
	cbi 0x4,1
	.dbline 212
; 	 nRF24L01_CE_DIR;
	sbi 0xa,5
	.dbline 213
; 	 nRF24L01_SCK_DIR;
	sbi 0xa,7
	.dbline 214
; 	 nRF24L01_CSN_DIR;
	sbi 0xa,6
	.dbline 215
; 	 nRF24L01_MOSI_DIR;
	sbi 0x4,0
	.dbline -2
L20:
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e init_CPU _init_CPU fV
	.even
_init_CPU::
	.dbline -1
	.dbline 222
; }
; /*-----------------------------------------------------------------------------
;    Module:   init_CPU
;    Function: Initialization of CPU
; ------------------------------------------------------------------------------*/
; void init_CPU (void)
; {
	.dbline 223
;  	MCUCR = 0x00;	// 
	clr R2
	out 0x35,R2
	.dbline 224
; 	EICRA = 0x00; //extended ext ints
	sts 105,R2
	.dbline 225
;     EIMSK = 0x00;
	out 0x1d,R2
	.dbline 227
; 	 
; 	TIMSK0 = 0x01; //timer 0 interrupt sources
	ldi R24,1
	sts 110,R24
	.dbline 228
; 	TIMSK1 = 0x00; //timer 1 interrupt sources
	sts 111,R2
	.dbline 229
; 	TIMSK2 = 0x00; //timer 2 interrupt sources
	sts 112,R2
	.dbline 230
; 	 CLI(); //disable all interrupts
	cli
	.dbline 231
; 	 NOP();
	nop
	.dbline 232
; 	PORTB = 0x01;
	out 0x5,R24
	.dbline 233
;  	DDRB  = 0xf3;
	ldi R24,243
	out 0x4,R24
	.dbline 234
; 	PORTD = 0x80;
	ldi R24,128
	out 0xb,R24
	.dbline 235
; 	DDRD  = 0xff;
	ldi R24,255
	out 0xa,R24
	.dbline 236
; 	PORTC = 0x80;
	ldi R24,128
	out 0x8,R24
	.dbline 237
; 	DDRC  = 0x78;
	ldi R24,120
	out 0x7,R24
	.dbline 238
; 	nrf24l01init();
	rcall _nrf24l01init
	.dbline 239
;     nRF24L01_CEL;
	cbi 0xb,5
	.dbline 240
; 	delay();
	rcall _delay
	.dbline 241
; 	nRF24L01_CSNH;			// Spi disable
	sbi 0xb,6
	.dbline 242
; 	delay();
	rcall _delay
	.dbline 243
; 	nRF24L01_SCKL;	
	cbi 0xb,7
	.dbline 244
; 	delay();
	rcall _delay
	.dbline -2
L21:
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e delay _delay fV
	.even
_delay::
	.dbline -1
	.dbline 247
; }
; void delay(void)//
; {
	.dbline 248
; 	NOP();
	nop
	.dbline 249
; 	NOP();
	nop
	.dbline 250
; 	NOP();
	nop
	.dbline 251
; 	NOP();
	nop
	.dbline 252
; 	NOP();
	nop
	.dbline 253
; 	NOP();
	nop
	.dbline -2
L22:
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e delayms _delayms fV
;            dly -> R16,R17
	.even
_delayms::
	.dbline -1
	.dbline 256
; }
; void delayms(unsigned short	dly)//
; {
	.dbline 257
	rjmp L27
L24:
	.dbline 257
L25:
	.dbline 257
	subi R16,1
	sbci R17,0
L27:
	.dbline 257
; 	for(;dly>0;dly--) ;
	cpi R16,0
	cpc R16,R17
	brne L24
X1:
	.dbline -2
L23:
	.dbline 0 ; func end
	ret
	.dbsym r dly 16 s
	.dbend
	.dbfunc e clear_buf _clear_buf fV
;         number -> R18
;            ptr -> R16,R17
	.even
_clear_buf::
	.dbline -1
	.dbline 261
; }
; 
; void clear_buf(unsigned char	*ptr,unsigned char number)//清零buffer,指定字节个数
; {
	.dbline 262
	rjmp L32
L29:
	.dbline 262
	clr R2
	movw R30,R16
	st Z+,R2
	movw R16,R30
L30:
	.dbline 262
	dec R18
L32:
	.dbline 262
; 	for (;number>0;number--) *ptr++=0;
	clr R2
	cp R2,R18
	brlo L29
	.dbline -2
L28:
	.dbline 0 ; func end
	ret
	.dbsym r number 18 c
	.dbsym r ptr 16 pc
	.dbend
	.dbfunc e SPI_RW _SPI_RW fc
;        bit_ctr -> R20
;           byte -> R22
	.even
_SPI_RW::
	rcall push_gset2
	mov R22,R16
	.dbline -1
	.dbline 273
; }
; //------------------------------------------------------
; /**************************************************
; Function: SPI_RW();
; 
; Description:
;   Writes one byte to nRF24L01, and return the byte read
;   from nRF24L01 during write, according to SPI protocol  */
; /**************************************************/
; unsigned char SPI_RW(unsigned char byte)
; {
	.dbline 275
; 	unsigned char  bit_ctr;	
;    	for(bit_ctr=0;bit_ctr<8;bit_ctr++)   	// output 8-bit
	clr R20
	rjmp L37
L34:
	.dbline 276
;    	{
	.dbline 277
;    		if(byte & 0x80) 
	sbrs R22,7
	rjmp L38
	.dbline 278
;    			nRF24L01_MOSIH;
	sbi 0x5,0
	rjmp L39
L38:
	.dbline 280
;    		else 
;    			nRF24L01_MOSIL;
	cbi 0x5,0
L39:
	.dbline 281
; 		delay();
	rcall _delay
	.dbline 282
;    		byte = (byte << 1);           		// shift next bit into MSB..
	lsl R22
	.dbline 283
;    		nRF24L01_SCKH;
	sbi 0xb,7
	.dbline 284
; 		delay();
	rcall _delay
	.dbline 285
;  		if(PINB&nRF24L01_MISO) byte |= 1;
	sbis 0x3,1
	rjmp L40
	.dbline 285
	ori R22,1
L40:
	.dbline 286
	cbi 0xb,7
	.dbline 287
	rcall _delay
	.dbline 288
L35:
	.dbline 275
	inc R20
L37:
	.dbline 275
	cpi R20,8
	brlo L34
	.dbline 289
;    		nRF24L01_SCKL;
; 		delay();
;    	}
;     return(byte);           		  		// return read byte
	mov R16,R22
	.dbline -2
L33:
	rcall pop_gset2
	.dbline 0 ; func end
	ret
	.dbsym r bit_ctr 20 c
	.dbsym r byte 22 c
	.dbend
	.dbfunc e SPI_RW_Reg _SPI_RW_Reg fc
;         status -> R20
;          value -> R22
;            reg -> R20
	.even
_SPI_RW_Reg::
	rcall push_gset2
	mov R22,R18
	mov R20,R16
	.dbline -1
	.dbline 298
; }
; /**************************************************
; Function: SPI_RW_Reg();
; 
; Description:
;   Writes value 'value' to register 'reg' */
; /**************************************************/
; unsigned char SPI_RW_Reg(unsigned char reg, unsigned char value)
; {
	.dbline 300
; 	unsigned char status;
; 	nRF24L01_CSNL;
	cbi 0xb,6
	.dbline 301
; 	delay();
	rcall _delay
	.dbline 302
; 	status = SPI_RW(reg);      // select register
	mov R16,R20
	rcall _SPI_RW
	mov R20,R16
	.dbline 303
;   	SPI_RW(value);             // ..and write value to it..
	mov R16,R22
	rcall _SPI_RW
	.dbline 304
; 	nRF24L01_CSNH;
	sbi 0xb,6
	.dbline 305
; 	delay();
	rcall _delay
	.dbline 306
;   	return(status);            // return nRF24L01 status byte
	mov R16,R20
	.dbline -2
L42:
	rcall pop_gset2
	.dbline 0 ; func end
	ret
	.dbsym r status 20 c
	.dbsym r value 22 c
	.dbsym r reg 20 c
	.dbend
	.dbfunc e SPI_Read _SPI_Read fc
;        reg_val -> R20
;            reg -> R20
	.even
_SPI_Read::
	rcall push_gset1
	mov R20,R16
	.dbline -1
	.dbline 315
; }
; /**************************************************
; Function: SPI_Read();
; 
; Description:
;   Read one byte from nRF24L01 register, 'reg'  */
; /**************************************************/
; unsigned char SPI_Read(unsigned char reg)
; {
	.dbline 317
; 	unsigned char reg_val;
; 	nRF24L01_CSNL;
	cbi 0xb,6
	.dbline 318
; 	delay();
	rcall _delay
	.dbline 319
;   	SPI_RW(reg);            // Select register to read from..
	mov R16,R20
	rcall _SPI_RW
	.dbline 320
;   	reg_val = SPI_RW(0);    // ..then read registervalue
	clr R16
	rcall _SPI_RW
	mov R20,R16
	.dbline 321
; 	nRF24L01_CSNH;
	sbi 0xb,6
	.dbline 322
; 	delay();
	rcall _delay
	.dbline 323
;   	return(reg_val);        // return register value
	mov R16,R20
	.dbline -2
L43:
	rcall pop_gset1
	.dbline 0 ; func end
	ret
	.dbsym r reg_val 20 c
	.dbsym r reg 20 c
	.dbend
	.dbfunc e SPI_Read_Buf _SPI_Read_Buf fc
;         status -> R20
;       byte_ctr -> R22
;          bytes -> R10
;           pBuf -> R12,R13

⌨️ 快捷键说明

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