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

📄 rf_blink_led.lss

📁 基于ATmega128的无线通信节点程序
💻 LSS
📖 第 1 页 / 共 2 页
字号:
 19e:	80 93 6b 02 	sts	0x026B, r24
for(n=7;n<rfTxInfo.length+1;n++){pTxBuffer[n]=pRxBuffer[n];}
 1a2:	47 e0       	ldi	r20, 0x07	; 7
 1a4:	99 27       	eor	r25, r25
 1a6:	87 fd       	sbrc	r24, 7
 1a8:	90 95       	com	r25
 1aa:	01 96       	adiw	r24, 0x01	; 1
 1ac:	88 30       	cpi	r24, 0x08	; 8
 1ae:	91 05       	cpc	r25, r1
 1b0:	84 f0       	brlt	.+32     	; 0x1d2
 1b2:	9c 01       	movw	r18, r24
 1b4:	e4 2f       	mov	r30, r20
 1b6:	ff 27       	eor	r31, r31
 1b8:	df 01       	movw	r26, r30
 1ba:	ae 50       	subi	r26, 0x0E	; 14
 1bc:	be 4f       	sbci	r27, 0xFE	; 254
 1be:	8c 91       	ld	r24, X
 1c0:	e1 59       	subi	r30, 0x91	; 145
 1c2:	fd 4f       	sbci	r31, 0xFD	; 253
 1c4:	80 83       	st	Z, r24
 1c6:	4f 5f       	subi	r20, 0xFF	; 255
 1c8:	84 2f       	mov	r24, r20
 1ca:	99 27       	eor	r25, r25
 1cc:	82 17       	cp	r24, r18
 1ce:	93 07       	cpc	r25, r19
 1d0:	8c f3       	brlt	.-30     	; 0x1b4
 rfTxInfo.destAddr=dest.addr;//71
 1d2:	d0 93 6a 02 	sts	0x026A, r29
 1d6:	c0 93 69 02 	sts	0x0269, r28

  		if (!basicRfSendPacket(&rfTxInfo)) 			    // No acknowledgment received -> Blink the red LED
 1da:	87 e6       	ldi	r24, 0x67	; 103
 1dc:	92 e0       	ldi	r25, 0x02	; 2
 1de:	0e 94 ca 02 	call	0x594
 1e2:	88 23       	and	r24, r24
 1e4:	51 f4       	brne	.+20     	; 0x1fa
		{
			SET_RLED();
 1e6:	da 98       	cbi	0x1b, 2	; 27
			 halWait(50000);
 1e8:	80 e5       	ldi	r24, 0x50	; 80
 1ea:	93 ec       	ldi	r25, 0xC3	; 195
 1ec:	03 c0       	rjmp	.+6      	; 0x1f4
			CLR_RLED();
		}
  	}	
  	
  else {
  		SET_RLED();
 1ee:	da 98       	cbi	0x1b, 2	; 27
  		halWait(500000000);
 1f0:	80 e0       	ldi	r24, 0x00	; 0
 1f2:	95 e6       	ldi	r25, 0x65	; 101
 1f4:	0e 94 db 01 	call	0x3b6
		CLR_RLED();
 1f8:	da 9a       	sbi	0x1b, 2	; 27
	   }
  /************************************************************/
      CLR_GLED();
 1fa:	d9 9a       	sbi	0x1b, 1	; 27

    // Continue using the (one and only) reception structure
    return pRRI;

} // basicRfReceivePacket
 1fc:	c8 01       	movw	r24, r16
 1fe:	df 91       	pop	r29
 200:	cf 91       	pop	r28
 202:	1f 91       	pop	r17
 204:	0f 91       	pop	r16
 206:	08 95       	ret

00000208 <main>:




//-------------------------------------------------------------------------------------------------------
//	void main (void)
//
//	DESCRIPTION:
//		Startup routine and main loop
//-------------------------------------------------------------------------------------------------------
void main (void) {
 208:	cf ef       	ldi	r28, 0xFF	; 255
 20a:	d0 e1       	ldi	r29, 0x10	; 16
 20c:	de bf       	out	0x3e, r29	; 62
 20e:	cd bf       	out	0x3d, r28	; 61
    UINT16 ledDutyCycle, dimmerDifference;
    UINT8 n;
	BYTE temp;
SHORT_ADDR dest;
    // Initalize ports for communication with CC2420 and other peripheral units
    PORT_INIT();
 210:	80 b5       	in	r24, 0x20	; 32
 212:	84 60       	ori	r24, 0x04	; 4
 214:	80 bd       	out	0x20, r24	; 32
 216:	97 e6       	ldi	r25, 0x67	; 103
 218:	9a bb       	out	0x1a, r25	; 26
 21a:	9b bb       	out	0x1b, r25	; 27
 21c:	87 e1       	ldi	r24, 0x17	; 23
 21e:	87 bb       	out	0x17, r24	; 23
 220:	87 e0       	ldi	r24, 0x07	; 7
 222:	88 bb       	out	0x18, r24	; 24
 224:	80 e2       	ldi	r24, 0x20	; 32
 226:	81 bb       	out	0x11, r24	; 17
 228:	80 ea       	ldi	r24, 0xA0	; 160
 22a:	82 bb       	out	0x12, r24	; 18
 22c:	83 e0       	ldi	r24, 0x03	; 3
 22e:	82 b9       	out	0x02, r24	; 2
 230:	83 e4       	ldi	r24, 0x43	; 67
 232:	83 b9       	out	0x03, r24	; 3
 234:	10 92 61 00 	sts	0x0061, r1
	PORTE=1<<3;
 238:	88 e0       	ldi	r24, 0x08	; 8
 23a:	83 b9       	out	0x03, r24	; 3
//	DDRD=0xFF;
//	PORTD=0xFF;
    SPI_INIT();
 23c:	80 e5       	ldi	r24, 0x50	; 80
 23e:	8d b9       	out	0x0d, r24	; 13
 240:	11 e0       	ldi	r17, 0x01	; 1
 242:	1e b9       	out	0x0e, r17	; 14

ConsoleInit() ;
 244:	10 92 90 00 	sts	0x0090, r1
 248:	99 b9       	out	0x09, r25	; 9
 24a:	86 e0       	ldi	r24, 0x06	; 6
 24c:	80 93 95 00 	sts	0x0095, r24
 250:	52 9a       	sbi	0x0a, 2	; 10
 252:	59 9a       	sbi	0x0b, 1	; 11
 254:	8a b1       	in	r24, 0x0a	; 10
 256:	88 61       	ori	r24, 0x18	; 24
 258:	8a b9       	out	0x0a, r24	; 10
//ConsolePutString("hello!");
    // Initialize PWM0 with a period of CLK/1024
//    PWM0_INIT(TIMER_CLK_DIV1024);

    // Initialize and enable the ADC for reading the pot meter
 //   ADC_INIT();
 //   ADC_SET_CHANNEL(ADC_INPUT_0_POT_METER);
//	ADC_ENABLE();

    // Wait for the user to select node address, and initialize for basic RF operation

basicRfInit(&rfRxInfo, 11,NODE[NODE_ID].PanId.addr, NODE[NODE_ID].Addr.addr);
 25a:	20 91 bc 01 	lds	r18, 0x01BC
 25e:	30 91 bd 01 	lds	r19, 0x01BD
 262:	40 91 ba 01 	lds	r20, 0x01BA
 266:	50 91 bb 01 	lds	r21, 0x01BB
 26a:	6b e0       	ldi	r22, 0x0B	; 11
 26c:	88 ee       	ldi	r24, 0xE8	; 232
 26e:	91 e0       	ldi	r25, 0x01	; 1
 270:	0e 94 0b 02 	call	0x416


   // Turn on RX mode
    basicRfReceiveOn();
 274:	0e 94 d3 03 	call	0x7a6



    // Initalize common protocol parameters
    rfTxInfo.length = 10;
 278:	8a e0       	ldi	r24, 0x0A	; 10
 27a:	80 93 6b 02 	sts	0x026B, r24
    rfTxInfo.ackRequest = TRUE;
 27e:	10 93 6e 02 	sts	0x026E, r17
    rfTxInfo.pPayload = pTxBuffer;
 282:	2f e6       	ldi	r18, 0x6F	; 111
 284:	32 e0       	ldi	r19, 0x02	; 2
 286:	30 93 6d 02 	sts	0x026D, r19
 28a:	20 93 6c 02 	sts	0x026C, r18
    rfRxInfo.pPayload = pRxBuffer;
 28e:	82 ef       	ldi	r24, 0xF2	; 242
 290:	91 e0       	ldi	r25, 0x01	; 1
 292:	90 93 ef 01 	sts	0x01EF, r25
 296:	80 93 ee 01 	sts	0x01EE, r24
SET_YLED();
 29a:	d8 98       	cbi	0x1b, 0	; 27
    for (n = 0; n < 10; n++) {
 29c:	80 e0       	ldi	r24, 0x00	; 0
 29e:	f9 01       	movw	r30, r18
        pTxBuffer[n] = n;
 2a0:	81 93       	st	Z+, r24
 2a2:	8f 5f       	subi	r24, 0xFF	; 255
 2a4:	8a 30       	cpi	r24, 0x0A	; 10
 2a6:	e0 f3       	brcs	.-8      	; 0x2a0
    }

	// The main loop:
	while (TRUE) {


//刷新缓冲区
while ( UCSR0A & (1<<RXC0) ) 
	temp= UDR0;	
 2a8:	5f 9b       	sbis	0x0b, 7	; 11
 2aa:	03 c0       	rjmp	.+6      	; 0x2b2
 2ac:	8c b1       	in	r24, 0x0c	; 12
 2ae:	5f 99       	sbic	0x0b, 7	; 11
 2b0:	fd cf       	rjmp	.-6      	; 0x2ac

 ConsoleGet(temp);
 2b2:	5f 9b       	sbis	0x0b, 7	; 11
 2b4:	fe cf       	rjmp	.-4      	; 0x2b2
 2b6:	8c b1       	in	r24, 0x0c	; 12
 	while(temp!=0x3F)
		ConsoleGet(temp);
 2b8:	8f 33       	cpi	r24, 0x3F	; 63
 2ba:	19 f0       	breq	.+6      	; 0x2c2
 2bc:	5f 9b       	sbis	0x0b, 7	; 11
 2be:	fe cf       	rjmp	.-4      	; 0x2bc
 2c0:	fa cf       	rjmp	.-12     	; 0x2b6


	SET_RLED();
 2c2:	da 98       	cbi	0x1b, 2	; 27
halWait(5000000);
 2c4:	80 e4       	ldi	r24, 0x40	; 64
 2c6:	9b e4       	ldi	r25, 0x4B	; 75
 2c8:	0e 94 db 01 	call	0x3b6
	CLR_RLED();
 2cc:	da 9a       	sbi	0x1b, 2	; 27

rfTxInfo.length= ConsoleGetString(pTxBuffer,BASIC_RF_MAX_PAYLOAD_SIZE);
 2ce:	64 e7       	ldi	r22, 0x74	; 116
 2d0:	70 e0       	ldi	r23, 0x00	; 0
 2d2:	8f e6       	ldi	r24, 0x6F	; 111
 2d4:	92 e0       	ldi	r25, 0x02	; 2
 2d6:	0e 94 6d 05 	call	0xada
rfTxInfo.length= rfTxInfo.length+5;
 2da:	98 2f       	mov	r25, r24
 2dc:	9b 5f       	subi	r25, 0xFB	; 251
 2de:	90 93 6b 02 	sts	0x026B, r25


pTxBuffer[7]=pTxBuffer[2];
 2e2:	80 91 71 02 	lds	r24, 0x0271
 2e6:	80 93 76 02 	sts	0x0276, r24
pTxBuffer[8]=pTxBuffer[3];
 2ea:	80 91 72 02 	lds	r24, 0x0272
 2ee:	80 93 77 02 	sts	0x0277, r24
pTxBuffer[9]=pTxBuffer[4];
 2f2:	80 91 73 02 	lds	r24, 0x0273
 2f6:	80 93 78 02 	sts	0x0278, r24
pTxBuffer[10]=pTxBuffer[5];
 2fa:	80 91 74 02 	lds	r24, 0x0274
 2fe:	80 93 79 02 	sts	0x0279, r24
pTxBuffer[11]=pTxBuffer[6];
 302:	80 91 75 02 	lds	r24, 0x0275
 306:	80 93 7a 02 	sts	0x027A, r24

dest.val[0]=pTxBuffer[1];
 30a:	c0 91 70 02 	lds	r28, 0x0270
dest.val[1]=pTxBuffer[0];
 30e:	80 91 6f 02 	lds	r24, 0x026F
 312:	d8 2f       	mov	r29, r24
rfTxInfo.destAddr=dest.addr;//71
 314:	d0 93 6a 02 	sts	0x026A, r29
 318:	c0 93 69 02 	sts	0x0269, r28
pTxBuffer[4]=dest.val[1];//79
 31c:	80 93 73 02 	sts	0x0273, r24
pTxBuffer[5]=dest.val[0];//71目

⌨️ 快捷键说明

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