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

📄 main.lss

📁 一个WSN的树状路由,对于那些学WSN路由方面的朋友应该有说帮助.
💻 LSS
📖 第 1 页 / 共 5 页
字号:
      Channel += NRef * FRef;
     572:	ca 01       	movw	r24, r20
     574:	b9 01       	movw	r22, r18
     576:	a6 01       	movw	r20, r12
     578:	95 01       	movw	r18, r10
     57a:	0e 94 da 18 	call	0x31b4
     57e:	dc 01       	movw	r26, r24
     580:	cb 01       	movw	r24, r22
     582:	e8 0e       	add	r14, r24
     584:	f9 1e       	adc	r15, r25
     586:	0a 1f       	adc	r16, r26
     588:	1b 1f       	adc	r17, r27
      Channel -= CC1000ControlM_IF;
     58a:	20 e1       	ldi	r18, 0x10	; 16
     58c:	36 eb       	ldi	r19, 0xB6	; 182
     58e:	4d ef       	ldi	r20, 0xFD	; 253
     590:	5f ef       	ldi	r21, 0xFF	; 255
     592:	e2 0e       	add	r14, r18
     594:	f3 1e       	adc	r15, r19
     596:	04 1f       	adc	r16, r20
     598:	15 1f       	adc	r17, r21

      diff = Channel - desiredFreq;
     59a:	d8 01       	movw	r26, r16
     59c:	c7 01       	movw	r24, r14
     59e:	29 81       	ldd	r18, Y+1	; 0x01
     5a0:	3a 81       	ldd	r19, Y+2	; 0x02
     5a2:	4b 81       	ldd	r20, Y+3	; 0x03
     5a4:	5c 81       	ldd	r21, Y+4	; 0x04
     5a6:	82 1b       	sub	r24, r18
     5a8:	93 0b       	sbc	r25, r19
     5aa:	a4 0b       	sbc	r26, r20
     5ac:	b5 0b       	sbc	r27, r21
      if (diff < 0) {
     5ae:	b7 ff       	sbrs	r27, 7
     5b0:	07 c0       	rjmp	.+14     	; 0x5c0
        diff = 0 - diff;
     5b2:	b0 95       	com	r27
     5b4:	a0 95       	com	r26
     5b6:	90 95       	com	r25
     5b8:	81 95       	neg	r24
     5ba:	9f 4f       	sbci	r25, 0xFF	; 255
     5bc:	af 4f       	sbci	r26, 0xFF	; 255
     5be:	bf 4f       	sbci	r27, 0xFF	; 255
        }
      if (diff < Offset) {
     5c0:	29 89       	ldd	r18, Y+17	; 0x11
     5c2:	3a 89       	ldd	r19, Y+18	; 0x12
     5c4:	4b 89       	ldd	r20, Y+19	; 0x13
     5c6:	5c 89       	ldd	r21, Y+20	; 0x14
     5c8:	82 17       	cp	r24, r18
     5ca:	93 07       	cpc	r25, r19
     5cc:	a4 07       	cpc	r26, r20
     5ce:	b5 07       	cpc	r27, r21
     5d0:	e4 f4       	brge	.+56     	; 0x60a
          RXFreq = RXCalc;
     5d2:	29 86       	std	Y+9, r2	; 0x09
     5d4:	3a 86       	std	Y+10, r3	; 0x0a
     5d6:	4b 86       	std	Y+11, r4	; 0x0b
     5d8:	5c 86       	std	Y+12, r5	; 0x0c
          TXFreq = TXCalc;
     5da:	6d 86       	std	Y+13, r6	; 0x0d
     5dc:	7e 86       	std	Y+14, r7	; 0x0e
     5de:	8f 86       	std	Y+15, r8	; 0x0f
     5e0:	98 8a       	std	Y+16, r9	; 0x10
          ActualChannel = Channel;
     5e2:	ed 82       	std	Y+5, r14	; 0x05
     5e4:	fe 82       	std	Y+6, r15	; 0x06
     5e6:	0f 83       	std	Y+7, r16	; 0x07
     5e8:	18 87       	std	Y+8, r17	; 0x08
          FSep = CC1000ControlM_FSepTbl[i];
     5ea:	2b 8d       	ldd	r18, Y+27	; 0x1b
     5ec:	3c 8d       	ldd	r19, Y+28	; 0x1c
     5ee:	20 50       	subi	r18, 0x00	; 0
     5f0:	3f 4f       	sbci	r19, 0xFF	; 255
     5f2:	f9 01       	movw	r30, r18
     5f4:	20 81       	ld	r18, Z
     5f6:	31 81       	ldd	r19, Z+1	; 0x01
     5f8:	2d 8f       	std	Y+29, r18	; 0x1d
     5fa:	3e 8f       	std	Y+30, r19	; 0x1e
          RefDiv = i + 6;
     5fc:	fe 89       	ldd	r31, Y+22	; 0x16
     5fe:	fa 5f       	subi	r31, 0xFA	; 250
     600:	fd 8b       	std	Y+21, r31	; 0x15
          Offset = diff;
     602:	89 8b       	std	Y+17, r24	; 0x11
     604:	9a 8b       	std	Y+18, r25	; 0x12
     606:	ab 8b       	std	Y+19, r26	; 0x13
     608:	bc 8b       	std	Y+20, r27	; 0x14
     60a:	2e 89       	ldd	r18, Y+22	; 0x16
     60c:	2f 5f       	subi	r18, 0xFF	; 255
     60e:	2e 8b       	std	Y+22, r18	; 0x16
     610:	4b 8d       	ldd	r20, Y+27	; 0x1b
     612:	5c 8d       	ldd	r21, Y+28	; 0x1c
     614:	4e 5f       	subi	r20, 0xFE	; 254
     616:	5f 4f       	sbci	r21, 0xFF	; 255
     618:	4b 8f       	std	Y+27, r20	; 0x1b
     61a:	5c 8f       	std	Y+28, r21	; 0x1c
     61c:	89 8d       	ldd	r24, Y+25	; 0x19
     61e:	9a 8d       	ldd	r25, Y+26	; 0x1a
     620:	02 96       	adiw	r24, 0x02	; 2
     622:	89 8f       	std	Y+25, r24	; 0x19
     624:	9a 8f       	std	Y+26, r25	; 0x1a
     626:	29 30       	cpi	r18, 0x09	; 9
     628:	08 f4       	brcc	.+2      	; 0x62c
     62a:	1f cf       	rjmp	.-450    	; 0x46a
        }
    }

  if (RefDiv != 0) {
     62c:	9d 89       	ldd	r25, Y+21	; 0x15
     62e:	99 23       	and	r25, r25
     630:	09 f4       	brne	.+2      	; 0x634
     632:	60 c0       	rjmp	.+192    	; 0x6f4

      CC1000ControlM_gCurrentParameters[0x3] = (uint8_t )(RXFreq & 0xFF);
     634:	a9 85       	ldd	r26, Y+9	; 0x09
     636:	a0 93 be 02 	sts	0x02BE, r26
      CC1000ControlM_gCurrentParameters[0x2] = (uint8_t )((RXFreq >> 8) & 0xFF);
     63a:	29 85       	ldd	r18, Y+9	; 0x09
     63c:	3a 85       	ldd	r19, Y+10	; 0x0a
     63e:	4b 85       	ldd	r20, Y+11	; 0x0b
     640:	5c 85       	ldd	r21, Y+12	; 0x0c
     642:	bb 27       	eor	r27, r27
     644:	a5 2f       	mov	r26, r21
     646:	94 2f       	mov	r25, r20
     648:	83 2f       	mov	r24, r19
     64a:	80 93 bd 02 	sts	0x02BD, r24
      CC1000ControlM_gCurrentParameters[0x1] = (uint8_t )((RXFreq >> 16) & 0xFF);
     64e:	ca 01       	movw	r24, r20
     650:	aa 27       	eor	r26, r26
     652:	bb 27       	eor	r27, r27
     654:	80 93 bc 02 	sts	0x02BC, r24

      CC1000ControlM_gCurrentParameters[0x6] = (uint8_t )(TXFreq & 0xFF);
     658:	3d 85       	ldd	r19, Y+13	; 0x0d
     65a:	30 93 c1 02 	sts	0x02C1, r19
      CC1000ControlM_gCurrentParameters[0x5] = (uint8_t )((TXFreq >> 8) & 0xFF);
     65e:	2d 85       	ldd	r18, Y+13	; 0x0d
     660:	3e 85       	ldd	r19, Y+14	; 0x0e
     662:	4f 85       	ldd	r20, Y+15	; 0x0f
     664:	58 89       	ldd	r21, Y+16	; 0x10
     666:	bb 27       	eor	r27, r27
     668:	a5 2f       	mov	r26, r21
     66a:	94 2f       	mov	r25, r20
     66c:	83 2f       	mov	r24, r19
     66e:	80 93 c0 02 	sts	0x02C0, r24
      CC1000ControlM_gCurrentParameters[0x4] = (uint8_t )((TXFreq >> 16) & 0xFF);
     672:	ca 01       	movw	r24, r20
     674:	aa 27       	eor	r26, r26
     676:	bb 27       	eor	r27, r27
     678:	80 93 bf 02 	sts	0x02BF, r24

      CC1000ControlM_gCurrentParameters[0x8] = (uint8_t )(FSep & 0xFF);
     67c:	3d 8d       	ldd	r19, Y+29	; 0x1d
     67e:	30 93 c3 02 	sts	0x02C3, r19
      CC1000ControlM_gCurrentParameters[0x7] = (uint8_t )((FSep >> 8) & 0xFF);
     682:	4d 8d       	ldd	r20, Y+29	; 0x1d
     684:	5e 8d       	ldd	r21, Y+30	; 0x1e
     686:	85 2f       	mov	r24, r21
     688:	99 27       	eor	r25, r25
     68a:	80 93 c2 02 	sts	0x02C2, r24

      if (ActualChannel < 500000000) {
     68e:	8d 81       	ldd	r24, Y+5	; 0x05
     690:	9e 81       	ldd	r25, Y+6	; 0x06
     692:	af 81       	ldd	r26, Y+7	; 0x07
     694:	b8 85       	ldd	r27, Y+8	; 0x08
     696:	80 30       	cpi	r24, 0x00	; 0
     698:	e5 e6       	ldi	r30, 0x65	; 101
     69a:	9e 07       	cpc	r25, r30
     69c:	ed ec       	ldi	r30, 0xCD	; 205
     69e:	ae 07       	cpc	r26, r30
     6a0:	ed e1       	ldi	r30, 0x1D	; 29
     6a2:	be 07       	cpc	r27, r30
     6a4:	a8 f4       	brcc	.+42     	; 0x6d0
          if (ActualChannel < 400000000) {
     6a6:	80 50       	subi	r24, 0x00	; 0
     6a8:	94 48       	sbci	r25, 0x84	; 132
     6aa:	a7 4d       	sbci	r26, 0xD7	; 215
     6ac:	b7 41       	sbci	r27, 0x17	; 23
     6ae:	28 f4       	brcc	.+10     	; 0x6ba
              CC1000ControlM_gCurrentParameters[0x9] = (8 << 4) | (1 << 2);
     6b0:	84 e8       	ldi	r24, 0x84	; 132
     6b2:	80 93 c4 02 	sts	0x02C4, r24
              CC1000ControlM_gCurrentParameters[0x1d] = (9 << 4) | (1 << 0);
     6b6:	81 e9       	ldi	r24, 0x91	; 145
     6b8:	04 c0       	rjmp	.+8      	; 0x6c2
            }
          else {
              CC1000ControlM_gCurrentParameters[0x9] = (4 << 4) | (1 << 2);
     6ba:	84 e4       	ldi	r24, 0x44	; 68
     6bc:	80 93 c4 02 	sts	0x02C4, r24
              CC1000ControlM_gCurrentParameters[0x1d] = (8 << 4) | (1 << 0);
     6c0:	81 e8       	ldi	r24, 0x81	; 129
     6c2:	80 93 d8 02 	sts	0x02D8, r24
            }
          CC1000ControlM_gCurrentParameters[0xa] = 1 << 1;
     6c6:	82 e0       	ldi	r24, 0x02	; 2
     6c8:	80 93 c5 02 	sts	0x02C5, r24
          CC1000ControlM_gCurrentParameters[0x12] = 7 << 4;
     6cc:	80 e7       	ldi	r24, 0x70	; 112
     6ce:	0a c0       	rjmp	.+20     	; 0x6e4
        }
      else {
          CC1000ControlM_gCurrentParameters[0x9] = (8 << 4) | (3 << 2);
     6d0:	8c e8       	ldi	r24, 0x8C	; 140
     6d2:	80 93 c4 02 	sts	0x02C4, r24
          CC1000ControlM_gCurrentParameters[0x1d] = (15 << 4) | (3 << 0);
     6d6:	83 ef       	ldi	r24, 0xF3	; 243
     6d8:	80 93 d8 02 	sts	0x02D8, r24
          CC1000ControlM_gCurrentParameters[0xa] = ((1 << 5) | (2 << 3)) | (
     6dc:	82 e3       	ldi	r24, 0x32	; 50
     6de:	80 93 c5 02 	sts	0x02C5, r24
          1 << 1);
          CC1000ControlM_gCurrentParameters[0x12] = 2 << 4;
     6e2:	80 e2       	ldi	r24, 0x20	; 32
     6e4:	80 93 cd 02 	sts	0x02CD, r24
        }
      CC1000ControlM_gCurrentParameters[0xc] = RefDiv << 3;
     6e8:	2d 89       	ldd	r18, Y+21	; 0x15
     6ea:	22 0f       	add	r18, r18
     6ec:	22 0f       	add	r18, r18
     6ee:	22 0f       	add	r18, r18
     6f0:	20 93 c7 02 	sts	0x02C7, r18
    }
  CC1000ControlM_gCurrentChannel = ActualChannel;
     6f4:	8d 81       	ldd	r24, Y+5	; 0x05
     6f6:	9e 81       	ldd	r25, Y+6	; 0x06
     6f8:	af 81       	ldd	r26, Y+7	; 0x07
     6fa:	b8 85       	ldd	r27, Y+8	; 0x08
     6fc:	80 93 dc 02 	sts	0x02DC, r24
     700:	90 93 dd 02 	sts	0x02DD, r25
     704:	a0 93 de 02 	sts	0x02DE, r26
     708:	b0 93 df 02 	sts	0x02DF, r27
  return ActualChannel;
}
     70c:	bc 01       	movw	r22, r24
     70e:	cd 01       	movw	r24, r26
     710:	6e 96       	adiw	r28, 0x1e	; 30
     712:	0f b6       	in	r0, 0x3f	; 63
     714:	f8 94       	cli
     716:	de bf       	out	0x3e, r29	; 62
     718:	0f be       	out	0x3f, r0	; 63
     71a:	cd bf       	out	0x3d, r28	; 61
     71c:	df 91       	pop	r29
     71e:	cf 91       	pop	r28
     720:	1f 91       	pop	r17
     722:	0f 91       	pop	r16
     724:	ff 90       	pop	r15
     726:	ef 90       	pop	r14
     728:	df 90       	pop	r13
     72a:	cf 90       	pop	r12
     72c:	bf 90       	pop	r11
     72e:	af 90       	pop	r10
     730:	9f 90       	pop	r9
     732:	8f 90       	pop	r8
     734:	7f 90       	pop	r7
     736:	6f 90       	pop	r6
     738:	5f 90       	pop	r5
     73a:	4f 90       	pop	r4
     73c:	3f 90       	pop	r3
     73e:	2f 90       	pop	r2
     740:	08 95       	ret

00000742 <CC1000HPLInit>:

uint32_t CC1000ControlTuneManual(uint32_t DesiredFreq)
{
	uint32_t actualFreq;
	
	actualFreq = CC1000ControlComputeFreq(DesiredFreq);
	
	CC1000ControlCC1000SetFreq();
	
	return actualFreq;
}

void CC1000ControlCC1000SetModem(void)
{
	CC1000HPLWrite(0x0F, CC1000ControlM_gCurrentParameters[0x0f]);
	CC1000HPLWrite(0x10, CC1000ControlM_gCurrentParameters[0x10]);
	CC1000HPLWrite(0x11, CC1000ControlM_gCurrentParameters[0x11]);
	return;
}

result_t CC1000HPLInit(void)
{
	OSH_MAKE_CC_CHP_OUT_INPUT();
     742:	0e 94 77 05 	call	0xaee
	OSH_MAKE_CC_PALE_OUTPUT();
     746:	0e 94 65 05 	call	0xaca
	OSH_MAKE_CC_PCLK_OUTPUT();
     74a:	0e 94 61 05 	call	0xac2
	OSH_MAKE_CC_PDATA_OUTPUT();
     74e:	0e 94 63 05 	call	0xac6
	OSH_SET_CC_PALE_PIN();
     752:	0e 94 b4 05 	call	0xb68
	OSH_SET_CC_PDATA_PIN();
     756:	0e 94 b2 05 	call	0xb64
	OSH_SET_CC_PCLK_PIN();
     75a:	0e 94 b0 05 	call	0xb60
	return SUCCESS;
}
     75e:	81 e0       	ldi	r24, 0x01	; 1
     760:	90 e0       	ldi	r25, 0x00	; 0
     762:	08 95       	ret

00000764 <CC1000HPLWrite>:

result_t CC1000ControlStdControlInit(void)
{
	CC1000HPLInit();
	CC1000HPLWrite(0x00, (((
		1 << 5) | (1 << 4)) | (
		1 << 3)) | (1 << 1));
	CC1000HPLWrite(0x00, ((((
		1 << 5) | (1 << 4)) | (
		1 << 3)) | (1 << 1)) | (
		1 << 0));
	OSH_uwait(2000);
	
	//  CC1000ControlM_gCurrentParameters[0xb] = (8 << 4) | (0 << 0);
	CC1000ControlM_gCurrentParameters[0xb] = POWERLEVEL;   //调整功率
	CC1000HPLWrite(0x0B, CC1000ControlM_gCurrentParameters[0xb]);
	
	CC1000ControlM_gCurrentParameters[0xd] = 9 << 4;
	CC1000HPLWrite(4, CC1000ControlM_gCurrentParameters[0xd]);
	
	CC1000ControlM_gCurrentParameters[0xf] = 0;
	
	CC1000ControlM_gCurrentParameters[0x10] = (((3 << 5) | (1 << 3)) | (
		3 << 1)) | (1 << 0);
	
	CC1000ControlM_gCurrentParameters[0x11] = ((5 << 4) | (1 << 2)) | (
		1 << 0);
	
	CC1000ControlCC1000SetModem();
	
	CC1000ControlM_gCurrentParameters[0x13] = 1 << 0;
	CC1000HPLWrite(0x13, CC1000ControlM_gCurrentParameters[0x13]);
	
	CC1000ControlM_gCurrentParameters[0x1e] = TRUE;
	
	CC1000ControlTuneManual(433300000);
	
	return SUCCESS;
}


result_t CC1000ControlBIASOn(void)
{
	CC1000HPLWrite(0x00, (((
		1 << 5) | (1 << 4)) | (
		1 << 3)) | (
		1 << 0));
	
	OSH_uwait(200);
	return SUCCESS;
}

result_t CC1000ControlStdControlStart(void)
{
	
	CC1000HPLWrite(0x00, ((((
		1 << 5) | (1 << 4)) | (
		1 << 3)) | (1 << 1)) | (
		1 << 0));
	
	OSH_uwait(2000);
	return SUCCESS;
}

result_t CC1000ControlTxMode(void)
{
	CC1000HPLWrite(0x00, (((
		1 << 7) | (1 << 6)) | (1 << 5)) | (
		1 << 0));
	
	CC1000HPLWrite(0x09, CC1000ControlM_gCurrentParameters[29]);
	OSH_uwait(250);
	CC1000HPLWrite(0x0B, CC1000ControlM_gCurrentParameters[0xb]);
	OSH_uwait(20);
	return SUCCESS;
}

result_t CC1000ControlRxMode(void)
{
	CC1000HPLWrite(0x00, (
		1 << 4) | (1 << 0));
	
	CC1000HPLWrite(0x09, CC1000ControlM_gCurrentParameters[0x09]);
	CC1000HPLWrite(0x0B, 0x00);
	OSH_uwait(250);
	return SUCCESS;
}

result_t CC1000ControlStdControlStop(void)
{
	CC1000HPLWrite(0x0B, 0x00);
	CC1000HPLWrite(0x00, (((((
		1 << 5) | (1 << 4)) | (
		1 << 3)) | (1 << 2)) | (1 << 1)) | (
		1 << 0));
	
	return SUCCESS;

⌨️ 快捷键说明

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