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

📄 nrf_main.s

📁 基于m16的nrf905接收发送程序
💻 S
字号:
	.module nrf_main.c
	.area text(rom, con, rel)
	.dbfile C:\DOCUME~1\Administrator\桌面\nrftest\nrf_main.c
	.dbfunc e led_on _led_on fV
	.even
_led_on::
	.dbline -1
	.dbline 8
; #include <iom16v.h>
; #include <macros.h>
; #include "nrf905.h"
; #include "lcd.h"
; #include "delay.h"
; 
; void led_on( void )
; {
	.dbline 9
; DDRD |= ( 1 << PD0 );
	sbi 0x11,0
	.dbline 10
; PORTD &=~ ( 1 << PB0 );
	cbi 0x12,0
	.dbline -2
L1:
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e led_of _led_of fV
	.even
_led_of::
	.dbline -1
	.dbline 13
; }
; void led_of( void )
; {
	.dbline 14
; DDRD |= ( 1 << PB0 );
	sbi 0x11,0
	.dbline 15
; PORTD |= ( 1 << PB0 );
	sbi 0x12,0
	.dbline -2
L2:
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e port_key_init _port_key_init fV
	.even
_port_key_init::
	.dbline -1
	.dbline 19
; }
; 
; void port_key_init( void )
; {
	.dbline 20
;  	 DDRA = 0X00;
	clr R2
	out 0x1a,R2
	.dbline 21
; 	 PORTA = 0XFF;
	ldi R24,255
	out 0x1b,R24
	.dbline -2
L3:
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e get_key _get_key fV
	.even
_get_key::
	st -y,R20
	st -y,R21
	sbiw R28,1
	.dbline -1
	.dbline 25
; }
; 
; void get_key( void )
; {
	.dbline 26
;  	 switch( PINA & 0xff )
	in R20,0x19
	clr R21
	andi R21,0
	cpi R20,223
	ldi R30,0
	cpc R21,R30
	brne X12
	xjmp L14
X12:
X0:
	ldi R24,223
	ldi R25,0
	cp R24,R20
	cpc R25,R21
	brlt L18
X1:
L17:
	cpi R20,127
	ldi R30,0
	cpc R21,R30
	brne X13
	xjmp L16
X13:
X2:
	cpi R20,127
	ldi R30,0
	cpc R21,R30
	brge X14
	xjmp L5
X14:
X3:
L19:
	cpi R20,191
	ldi R30,0
	cpc R21,R30
	brne X15
	xjmp L15
X15:
X4:
	xjmp L5
L18:
	cpi R20,239
	ldi R30,0
	cpc R21,R30
	brne X16
	xjmp L13
X16:
X5:
	cpi R20,239
	ldi R30,0
	cpc R21,R30
	brge X17
	xjmp L5
X17:
X6:
L20:
	cpi R20,247
	ldi R30,0
	cpc R21,R30
	breq L12
X7:
	cpi R20,251
	ldi R30,0
	cpc R21,R30
	breq L11
X8:
	cpi R20,253
	ldi R30,0
	cpc R21,R30
	breq L10
X9:
	cpi R20,254
	ldi R30,0
	cpc R21,R30
	breq L9
X10:
	cpi R20,255
	ldi R30,0
	cpc R21,R30
	brne X18
	xjmp L6
X18:
X11:
	xjmp L5
L9:
	.dbline 29
; 	 {
; 	 case 0b11111111: break;
; 	 case 0b11111110: nrf905_SendData('0'); LCD_write_char( 1, 8, '0' ); break;
	ldi R16,48
	xcall _nrf905_SendData
	.dbline 29
	ldi R24,48
	std y+0,R24
	ldi R18,8
	ldi R16,1
	xcall _LCD_write_char
	.dbline 29
	xjmp L6
L10:
	.dbline 30
; 	 case 0b11111101: nrf905_SendData('1'); LCD_write_char( 1, 8, '1' ); break;
	ldi R16,49
	xcall _nrf905_SendData
	.dbline 30
	ldi R24,49
	std y+0,R24
	ldi R18,8
	ldi R16,1
	xcall _LCD_write_char
	.dbline 30
	xjmp L6
L11:
	.dbline 31
; 	 case 0b11111011: nrf905_SendData('2'); LCD_write_char( 1, 8, '2' ); break;
	ldi R16,50
	xcall _nrf905_SendData
	.dbline 31
	ldi R24,50
	std y+0,R24
	ldi R18,8
	ldi R16,1
	xcall _LCD_write_char
	.dbline 31
	xjmp L6
L12:
	.dbline 32
; 	 case 0b11110111: nrf905_SendData('3'); LCD_write_char( 1, 8, '3' ); break;
	ldi R16,51
	xcall _nrf905_SendData
	.dbline 32
	ldi R24,51
	std y+0,R24
	ldi R18,8
	ldi R16,1
	xcall _LCD_write_char
	.dbline 32
	xjmp L6
L13:
	.dbline 33
; 	 case 0b11101111: nrf905_SendData('4'); LCD_write_char( 1, 8, '4' ); break;
	ldi R16,52
	xcall _nrf905_SendData
	.dbline 33
	ldi R24,52
	std y+0,R24
	ldi R18,8
	ldi R16,1
	xcall _LCD_write_char
	.dbline 33
	xjmp L6
L14:
	.dbline 34
; 	 case 0b11011111: nrf905_SendData('5'); LCD_write_char( 1, 8, '5' ); break;
	ldi R16,53
	xcall _nrf905_SendData
	.dbline 34
	ldi R24,53
	std y+0,R24
	ldi R18,8
	ldi R16,1
	xcall _LCD_write_char
	.dbline 34
	xjmp L6
L15:
	.dbline 35
; 	 case 0b10111111: nrf905_SendData('6'); LCD_write_char( 1, 8, '6' ); break;
	ldi R16,54
	xcall _nrf905_SendData
	.dbline 35
	ldi R24,54
	std y+0,R24
	ldi R18,8
	ldi R16,1
	xcall _LCD_write_char
	.dbline 35
	xjmp L6
L16:
	.dbline 36
; 	 case 0b01111111: nrf905_SendData('7'); LCD_write_char( 1, 8, '7' ); break;
	ldi R16,55
	xcall _nrf905_SendData
	.dbline 36
	ldi R24,55
	std y+0,R24
	ldi R18,8
	ldi R16,1
	xcall _LCD_write_char
	.dbline 36
L5:
L6:
	.dbline -2
L4:
	.dbline 0 ; func end
	adiw R28,1
	ld R21,y+
	ld R20,y+
	ret
	.dbend
	.dbfunc e led_port_init _led_port_init fV
	.even
_led_port_init::
	.dbline -1
	.dbline 41
; 	 }
; }
; 
; void led_port_init( void )
; {
	.dbline 42
; DDRA = 0xff;
	ldi R24,255
	out 0x1a,R24
	.dbline 43
; PORTA = 0XFF;
	out 0x1b,R24
	.dbline -2
L21:
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e led_onon _led_onon fV
;              t -> R16
	.even
_led_onon::
	st -y,R20
	st -y,R21
	.dbline -1
	.dbline 47
; }
; 
; void led_onon( uchar t )
; {
	.dbline 48
; switch( t )
	mov R20,R16
	clr R21
	cpi R20,48
	ldi R30,0
	cpc R21,R30
	breq L26
X19:
	cpi R20,49
	ldi R30,0
	cpc R21,R30
	breq L27
X20:
	cpi R20,50
	ldi R30,0
	cpc R21,R30
	breq L28
X21:
	cpi R20,51
	ldi R30,0
	cpc R21,R30
	breq L29
X22:
	cpi R20,52
	ldi R30,0
	cpc R21,R30
	breq L30
X23:
	cpi R20,53
	ldi R30,0
	cpc R21,R30
	breq L31
X24:
	cpi R20,54
	ldi R30,0
	cpc R21,R30
	breq L32
X25:
	cpi R20,55
	ldi R30,0
	cpc R21,R30
	breq L33
X26:
	xjmp L24
L26:
	.dbline 50
; {
; case '0': PORTA = 0B11111110; break; 
	ldi R24,254
	out 0x1b,R24
	.dbline 50
	xjmp L24
L27:
	.dbline 51
; case '1': PORTA = 0B11111101; break;
	ldi R24,253
	out 0x1b,R24
	.dbline 51
	xjmp L24
L28:
	.dbline 52
; case '2': PORTA = 0B11111011; break;
	ldi R24,251
	out 0x1b,R24
	.dbline 52
	xjmp L24
L29:
	.dbline 53
; case '3': PORTA = 0B11110111; break;
	ldi R24,247
	out 0x1b,R24
	.dbline 53
	xjmp L24
L30:
	.dbline 54
; case '4': PORTA = 0B11101111; break;
	ldi R24,239
	out 0x1b,R24
	.dbline 54
	xjmp L24
L31:
	.dbline 55
; case '5': PORTA = 0B11011111; break;
	ldi R24,223
	out 0x1b,R24
	.dbline 55
	xjmp L24
L32:
	.dbline 56
; case '6': PORTA = 0B10111111; break;
	ldi R24,191
	out 0x1b,R24
	.dbline 56
	xjmp L24
L33:
	.dbline 57
; case '7': PORTA = 0B01111111; break;
	ldi R24,127
	out 0x1b,R24
	.dbline 57
	.dbline 58
; default :  break;
L24:
	.dbline -2
L22:
	.dbline 0 ; func end
	ld R21,y+
	ld R20,y+
	ret
	.dbsym r t 16 c
	.dbend
	.dbfunc e main _main fV
;          r_tmp -> R10
	.even
_main::
	sbiw R28,2
	.dbline -1
	.dbline 65
; }
; }
; 
; #define receive
; //#define send
; void main( void )
; {
	.dbline 67
;      uchar r_tmp;
;  	 port_key_init();
	xcall _port_key_init
	.dbline 68
; 	 led_port_init();	   
	xcall _led_port_init
	.dbline 69
;  	 LCD_init();
	xcall _LCD_init
	.dbline 70
; 	 SPI_Init();
	xcall _SPI_Init
	.dbline 71
; 	 nrf905_Init();
	xcall _nrf905_Init
	.dbline 81
; 	 
; 	 #ifdef send
; 	 	 
; 	 LCD_write_string( 2, 3, "fasong" );
; 	 while( 1 ) get_key();	 
; 	 
; 	 #endif
; 	 
; 	 #ifdef receive
; 	 LCD_write_string( 2, 3, "jieshou" );
	ldi R24,<L35
	ldi R25,>L35
	std y+1,R25
	std y+0,R24
	ldi R18,3
	ldi R16,2
	xcall _LCD_write_string
	xjmp L37
L36:
	.dbline 84
; 	 
; 	 while( 1 )
; 	 {
	.dbline 85
; 	  	led_of();
	xcall _led_of
	xjmp L40
L39:
	.dbline 88
; 	    //led_on();
; 		while( PINB & 0b00001000 )
; 		{ 
	.dbline 95
; 		   /*
; 		   led_on();
; 		   r_tmp = nrf905_ReadData();
; 		   LCD_write_char( 1, 6, r_tmp );
; 		   delay_nms( 1 );	
; 		   */
; 		   r_tmp = nrf905_ReadData();
	xcall _nrf905_ReadData
	mov R10,R16
	.dbline 96
; 		   LCD_write_char( 1, 6, r_tmp );
	std y+0,R10
	ldi R18,6
	ldi R16,1
	xcall _LCD_write_char
	.dbline 97
; 		   led_onon( r_tmp );	 	
	mov R16,R10
	xcall _led_onon
	.dbline 98
; 		}
L40:
	.dbline 87
	sbic 0x16,3
	rjmp L39
X27:
	.dbline 99
; 	 }
L37:
	.dbline 83
	xjmp L36
X28:
	.dbline -2
L34:
	.dbline 0 ; func end
	adiw R28,2
	ret
	.dbsym r r_tmp 10 c
	.dbend
	.area data(ram, con, rel)
	.dbfile C:\DOCUME~1\Administrator\桌面\nrftest\nrf_main.c
L35:
	.blkb 8
	.area idata
	.byte 'j,'i,'e,'s,'h,'o,'u,0
	.area data(ram, con, rel)
	.dbfile C:\DOCUME~1\Administrator\桌面\nrftest\nrf_main.c
; 	 #endif
; }

⌨️ 快捷键说明

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