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

📄 rf_blink_led.lss

📁 基于无线传感器网络的CC2420收发芯片初始化源代码
💻 LSS
📖 第 1 页 / 共 3 页
字号:

rf_blink_led.elf:     file format elf32-avr

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .data         00000000  00800100  00000924  000009b8  2**0
                  CONTENTS, ALLOC, LOAD, DATA
  1 .text         00000924  00000000  00000000  00000094  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  2 .bss          00000103  00800100  00800100  000009b8  2**0
                  ALLOC
  3 .noinit       00000000  00800203  00800203  000009b8  2**0
                  CONTENTS
  4 .eeprom       00000000  00810000  00810000  000009b8  2**0
                  CONTENTS
  5 .stab         000018fc  00000000  00000000  000009b8  2**2
                  CONTENTS, READONLY, DEBUGGING
  6 .stabstr      00000eab  00000000  00000000  000022b4  2**0
                  CONTENTS, READONLY, DEBUGGING
Disassembly of section .text:

00000000 <__vectors>:
   0:	0c 94 46 00 	jmp	0x8c
   4:	0c 94 2b 03 	jmp	0x656
   8:	0c 94 63 00 	jmp	0xc6
   c:	0c 94 63 00 	jmp	0xc6
  10:	0c 94 63 00 	jmp	0xc6
  14:	0c 94 63 00 	jmp	0xc6
  18:	0c 94 63 00 	jmp	0xc6
  1c:	0c 94 63 00 	jmp	0xc6
  20:	0c 94 63 00 	jmp	0xc6
  24:	0c 94 63 00 	jmp	0xc6
  28:	0c 94 63 00 	jmp	0xc6
  2c:	0c 94 63 00 	jmp	0xc6
  30:	0c 94 63 00 	jmp	0xc6
  34:	0c 94 63 00 	jmp	0xc6
  38:	0c 94 63 00 	jmp	0xc6
  3c:	0c 94 63 00 	jmp	0xc6
  40:	0c 94 63 00 	jmp	0xc6
  44:	0c 94 63 00 	jmp	0xc6
  48:	0c 94 63 00 	jmp	0xc6
  4c:	0c 94 63 00 	jmp	0xc6
  50:	0c 94 63 00 	jmp	0xc6
  54:	0c 94 63 00 	jmp	0xc6
  58:	0c 94 63 00 	jmp	0xc6
  5c:	0c 94 63 00 	jmp	0xc6
  60:	0c 94 63 00 	jmp	0xc6
  64:	0c 94 63 00 	jmp	0xc6
  68:	0c 94 63 00 	jmp	0xc6
  6c:	0c 94 63 00 	jmp	0xc6
  70:	0c 94 63 00 	jmp	0xc6
  74:	0c 94 63 00 	jmp	0xc6
  78:	0c 94 63 00 	jmp	0xc6
  7c:	0c 94 63 00 	jmp	0xc6
  80:	0c 94 63 00 	jmp	0xc6
  84:	0c 94 63 00 	jmp	0xc6
  88:	0c 94 63 00 	jmp	0xc6

0000008c <__ctors_end>:
  8c:	11 24       	eor	r1, r1
  8e:	1f be       	out	0x3f, r1	; 63
  90:	cf ef       	ldi	r28, 0xFF	; 255
  92:	d0 e1       	ldi	r29, 0x10	; 16
  94:	de bf       	out	0x3e, r29	; 62
  96:	cd bf       	out	0x3d, r28	; 61

00000098 <__do_copy_data>:
  98:	11 e0       	ldi	r17, 0x01	; 1
  9a:	a0 e0       	ldi	r26, 0x00	; 0
  9c:	b1 e0       	ldi	r27, 0x01	; 1
  9e:	e4 e2       	ldi	r30, 0x24	; 36
  a0:	f9 e0       	ldi	r31, 0x09	; 9
  a2:	00 e0       	ldi	r16, 0x00	; 0
  a4:	0b bf       	out	0x3b, r16	; 59
  a6:	02 c0       	rjmp	.+4      	; 0xac

000000a8 <.__do_copy_data_loop>:
  a8:	07 90       	elpm	r0, Z+
  aa:	0d 92       	st	X+, r0

000000ac <.__do_copy_data_start>:
  ac:	a0 30       	cpi	r26, 0x00	; 0
  ae:	b1 07       	cpc	r27, r17
  b0:	d9 f7       	brne	.-10     	; 0xa8

000000b2 <__do_clear_bss>:
  b2:	12 e0       	ldi	r17, 0x02	; 2
  b4:	a0 e0       	ldi	r26, 0x00	; 0
  b6:	b1 e0       	ldi	r27, 0x01	; 1
  b8:	01 c0       	rjmp	.+2      	; 0xbc

000000ba <.do_clear_bss_loop>:
  ba:	1d 92       	st	X+, r1

000000bc <.do_clear_bss_start>:
  bc:	a3 30       	cpi	r26, 0x03	; 3
  be:	b1 07       	cpc	r27, r17
  c0:	e1 f7       	brne	.-8      	; 0xba
  c2:	0c 94 7b 00 	jmp	0xf6

000000c6 <__bad_interrupt>:
  c6:	0c 94 00 00 	jmp	0x0

000000ca <basicRfReceivePacket>:
//     BASIC_RF_RX_INFO*
//			The pointer to the next BASIC_RF_RX_INFO structure to be used by the FIFOP ISR. If there is
//			only one buffer, then return pRRI.
//-------------------------------------------------------------------------------------------------------
BASIC_RF_RX_INFO* basicRfReceivePacket(BASIC_RF_RX_INFO *pRRI) {
  ca:	0f 93       	push	r16
  cc:	1f 93       	push	r17
  ce:	cf 93       	push	r28
  d0:	df 93       	push	r29
  d2:	8c 01       	movw	r16, r24

    // Adjust the led brightness
    PWM0_SET_DUTY_CYCLE(pRRI->pPayload[0]);
  d4:	ec 01       	movw	r28, r24
  d6:	ee 81       	ldd	r30, Y+6	; 0x06
  d8:	ff 81       	ldd	r31, Y+7	; 0x07
  da:	80 81       	ld	r24, Z
  dc:	81 bf       	out	0x31, r24	; 49

    // Blink the green LED
    SET_GLED();
  de:	c7 9a       	sbi	0x18, 7	; 24
    halWait(10000);
  e0:	80 e1       	ldi	r24, 0x10	; 16
  e2:	97 e2       	ldi	r25, 0x27	; 39
  e4:	0e 94 12 01 	call	0x224
    CLR_GLED();
  e8:	c7 98       	cbi	0x18, 7	; 24

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

} // basicRfReceivePacket
  ea:	c8 01       	movw	r24, r16
  ec:	df 91       	pop	r29
  ee:	cf 91       	pop	r28
  f0:	1f 91       	pop	r17
  f2:	0f 91       	pop	r16
  f4:	08 95       	ret

000000f6 <main>:




//-------------------------------------------------------------------------------------------------------
//	void main (void)
//
//	DESCRIPTION:
//		Startup routine and main loop
//-------------------------------------------------------------------------------------------------------
void main (void) {
  f6:	cf ef       	ldi	r28, 0xFF	; 255
  f8:	d0 e1       	ldi	r29, 0x10	; 16
  fa:	de bf       	out	0x3e, r29	; 62
  fc:	cd bf       	out	0x3d, r28	; 61
    UINT16 ledDutyCycle, dimmerDifference;
    UINT8 n;

    // Initalize ports for communication with CC2420 and other peripheral units
    PORT_INIT();
  fe:	80 b5       	in	r24, 0x20	; 32
 100:	84 60       	ori	r24, 0x04	; 4
 102:	80 bd       	out	0x20, r24	; 32
 104:	87 ef       	ldi	r24, 0xF7	; 247
 106:	87 bb       	out	0x17, r24	; 23
 108:	87 e4       	ldi	r24, 0x47	; 71
 10a:	88 bb       	out	0x18, r24	; 24
 10c:	80 e2       	ldi	r24, 0x20	; 32
 10e:	81 bb       	out	0x11, r24	; 17
 110:	80 ea       	ldi	r24, 0xA0	; 160
 112:	82 bb       	out	0x12, r24	; 18
 114:	88 e1       	ldi	r24, 0x18	; 24
 116:	82 b9       	out	0x02, r24	; 2
 118:	13 b8       	out	0x03, r1	; 3
    SPI_INIT();
 11a:	80 e5       	ldi	r24, 0x50	; 80
 11c:	8d b9       	out	0x0d, r24	; 13
 11e:	81 e0       	ldi	r24, 0x01	; 1
 120:	8e b9       	out	0x0e, r24	; 14

    // Initialize PWM0 with a period of CLK/1024
    PWM0_INIT(TIMER_CLK_DIV1024);
 122:	11 be       	out	0x31, r1	; 49
 124:	80 e7       	ldi	r24, 0x70	; 112
 126:	83 bf       	out	0x33, r24	; 51
 128:	83 b7       	in	r24, 0x33	; 51
 12a:	88 7f       	andi	r24, 0xF8	; 248
 12c:	85 60       	ori	r24, 0x05	; 5
 12e:	83 bf       	out	0x33, r24	; 51

    // Initialize and enable the ADC for reading the pot meter
    ADC_INIT();
 130:	83 e2       	ldi	r24, 0x23	; 35
 132:	86 b9       	out	0x06, r24	; 6
 134:	80 e4       	ldi	r24, 0x40	; 64
 136:	87 b9       	out	0x07, r24	; 7
    ADC_SET_CHANNEL(ADC_INPUT_0_POT_METER);
 138:	87 b1       	in	r24, 0x07	; 7
 13a:	80 7e       	andi	r24, 0xE0	; 224
 13c:	87 b9       	out	0x07, r24	; 7
	ADC_ENABLE();
 13e:	37 9a       	sbi	0x06, 7	; 6

    // Wait for the user to select node address, and initialize for basic RF operation
    while (TRUE) {
		if (JOYSTICK_CENTER_PRESSED()) {
 140:	0a 9b       	sbis	0x01, 2	; 1
 142:	0c c0       	rjmp	.+24     	; 0x15c
			basicRfInit(&rfRxInfo, 26, 0x2420, 0x1234);
 144:	24 e3       	ldi	r18, 0x34	; 52
 146:	32 e1       	ldi	r19, 0x12	; 18
 148:	40 e2       	ldi	r20, 0x20	; 32
 14a:	54 e2       	ldi	r21, 0x24	; 36
 14c:	6a e1       	ldi	r22, 0x1A	; 26
 14e:	80 e0       	ldi	r24, 0x00	; 0
 150:	91 e0       	ldi	r25, 0x01	; 1
 152:	0e 94 42 01 	call	0x284
			rfTxInfo.destAddr = 0x5678;
 156:	88 e7       	ldi	r24, 0x78	; 120
 158:	96 e5       	ldi	r25, 0x56	; 86
 15a:	13 c0       	rjmp	.+38     	; 0x182
			break;
		} else if (JOYSTICK_UP_PRESSED() || JOYSTICK_DOWN_PRESSED() || JOYSTICK_LEFT_PRESSED() || JOYSTICK_RIGHT_PRESSED()) {
 15c:	08 99       	sbic	0x01, 0	; 1
 15e:	06 c0       	rjmp	.+12     	; 0x16c
 160:	02 99       	sbic	0x00, 2	; 0
 162:	04 c0       	rjmp	.+8      	; 0x16c
 164:	01 99       	sbic	0x00, 1	; 0
 166:	02 c0       	rjmp	.+4      	; 0x16c
 168:	09 9b       	sbis	0x01, 1	; 1
 16a:	ea cf       	rjmp	.-44     	; 0x140
			basicRfInit(&rfRxInfo, 26, 0x2420, 0x5678);
 16c:	28 e7       	ldi	r18, 0x78	; 120
 16e:	36 e5       	ldi	r19, 0x56	; 86
 170:	40 e2       	ldi	r20, 0x20	; 32
 172:	54 e2       	ldi	r21, 0x24	; 36
 174:	6a e1       	ldi	r22, 0x1A	; 26
 176:	80 e0       	ldi	r24, 0x00	; 0
 178:	91 e0       	ldi	r25, 0x01	; 1
 17a:	0e 94 42 01 	call	0x284
			rfTxInfo.destAddr = 0x1234;
 17e:	84 e3       	ldi	r24, 0x34	; 52
 180:	92 e1       	ldi	r25, 0x12	; 18
 182:	90 93 81 01 	sts	0x0181, r25
 186:	80 93 80 01 	sts	0x0180, r24
			break;
		}
	}

    // Initalize common protocol parameters
    rfTxInfo.length = 10;
 18a:	8a e0       	ldi	r24, 0x0A	; 10
 18c:	80 93 82 01 	sts	0x0182, r24
    rfTxInfo.ackRequest = TRUE;
 190:	81 e0       	ldi	r24, 0x01	; 1
 192:	80 93 85 01 	sts	0x0185, r24
    rfTxInfo.pPayload = pTxBuffer;
 196:	26 e8       	ldi	r18, 0x86	; 134
 198:	31 e0       	ldi	r19, 0x01	; 1
 19a:	30 93 84 01 	sts	0x0184, r19
 19e:	20 93 83 01 	sts	0x0183, r18
    rfRxInfo.pPayload = pRxBuffer;
 1a2:	8a e0       	ldi	r24, 0x0A	; 10
 1a4:	91 e0       	ldi	r25, 0x01	; 1
 1a6:	90 93 07 01 	sts	0x0107, r25
 1aa:	80 93 06 01 	sts	0x0106, r24

    for (n = 0; n < 10; n++) {
 1ae:	80 e0       	ldi	r24, 0x00	; 0
 1b0:	f9 01       	movw	r30, r18
        pTxBuffer[n] = n;
 1b2:	81 93       	st	Z+, r24
 1b4:	8f 5f       	subi	r24, 0xFF	; 255
 1b6:	8a 30       	cpi	r24, 0x0A	; 10
 1b8:	e0 f3       	brcs	.-8      	; 0x1b2
    }

    // Turn on RX mode
    basicRfReceiveOn();
 1ba:	0e 94 0c 03 	call	0x618

	// The main loop:
	while (TRUE) {

        // Sample the pot meter value
        ADC_SAMPLE_SINGLE();
 1be:	36 9a       	sbi	0x06, 6	; 6
 1c0:	34 9b       	sbis	0x06, 4	; 6
 1c2:	fe cf       	rjmp	.-4      	; 0x1c0
        ADC_GET_SAMPLE_8(ledDutyCycle);
 1c4:	84 b1       	in	r24, 0x04	; 4
 1c6:	86 95       	lsr	r24
 1c8:	86 95       	lsr	r24
 1ca:	48 2f       	mov	r20, r24
 1cc:	55 27       	eor	r21, r21
 1ce:	85 b1       	in	r24, 0x05	; 5
 1d0:	99 27       	eor	r25, r25
 1d2:	87 fd       	sbrc	r24, 7
 1d4:	90 95       	com	r25
 1d6:	26 e0       	ldi	r18, 0x06	; 6
 1d8:	88 0f       	add	r24, r24
 1da:	99 1f       	adc	r25, r25
 1dc:	2a 95       	dec	r18
 1de:	e1 f7       	brne	.-8      	; 0x1d8
 1e0:	48 2b       	or	r20, r24
 1e2:	59 2b       	or	r21, r25

		// If the dimmer value has changed by more than 1, then transmit the new value automatically
		// Transmit also when the S2 button is pressed
		dimmerDifference = (ledDutyCycle & 0xFF) - pTxBuffer[0];
 1e4:	ca 01       	movw	r24, r20
 1e6:	90 70       	andi	r25, 0x00	; 0
 1e8:	20 91 86 01 	lds	r18, 0x0186
 1ec:	82 1b       	sub	r24, r18
 1ee:	91 09       	sbc	r25, r1
		if ((ABS(dimmerDifference) > 2) || (JOYSTICK_CENTER_PRESSED())) {
 1f0:	03 97       	sbiw	r24, 0x03	; 3
 1f2:	10 f4       	brcc	.+4      	; 0x1f8
 1f4:	0a 9b       	sbis	0x01, 2	; 1
 1f6:	e3 cf       	rjmp	.-58     	; 0x1be
		    pTxBuffer[0] = ledDutyCycle;
 1f8:	40 93 86 01 	sts	0x0186, r20
    		if (basicRfSendPacket(&rfTxInfo)) {
 1fc:	8e e7       	ldi	r24, 0x7E	; 126
 1fe:	91 e0       	ldi	r25, 0x01	; 1
 200:	0e 94 03 02 	call	0x406
 204:	88 23       	and	r24, r24
 206:	39 f0       	breq	.+14     	; 0x216

    		    // OK -> Blink the yellow LED
			    SET_YLED();
 208:	1c 9a       	sbi	0x03, 4	; 3
			    halWait(50000);
 20a:	80 e5       	ldi	r24, 0x50	; 80
 20c:	93 ec       	ldi	r25, 0xC3	; 195
 20e:	0e 94 12 01 	call	0x224
			    CLR_YLED();
 212:	1c 98       	cbi	0x03, 4	; 3
 214:	d4 cf       	rjmp	.-88     	; 0x1be
			} else {

			    // No acknowledgment received -> Blink the red LED
			    SET_RLED();
 216:	1b 9a       	sbi	0x03, 3	; 3
			    halWait(50000);
 218:	80 e5       	ldi	r24, 0x50	; 80
 21a:	93 ec       	ldi	r25, 0xC3	; 195
 21c:	0e 94 12 01 	call	0x224
			    CLR_RLED();
 220:	1b 98       	cbi	0x03, 3	; 3
 222:	cd cf       	rjmp	.-102    	; 0x1be

00000224 <halWait>:
	...
        NOP();
        NOP();
        NOP();
        NOP();
    } while (--timeout);
 22c:	01 97       	sbiw	r24, 0x01	; 1
 22e:	d1 f7       	brne	.-12     	; 0x224
 230:	08 95       	ret

00000232 <halRfSetChannel>:

} // halWait
 232:	28 2f       	mov	r18, r24
 234:	33 27       	eor	r19, r19
 236:	2b 50       	subi	r18, 0x0B	; 11
 238:	30 40       	sbci	r19, 0x00	; 0
 23a:	c9 01       	movw	r24, r18
 23c:	88 0f       	add	r24, r24
 23e:	99 1f       	adc	r25, r25
 240:	88 0f       	add	r24, r24
 242:	99 1f       	adc	r25, r25
 244:	28 0f       	add	r18, r24
 246:	39 1f       	adc	r19, r25
 248:	2b 59       	subi	r18, 0x9B	; 155
 24a:	3e 4b       	sbci	r19, 0xBE	; 190
 24c:	f8 94       	cli
 24e:	c0 98       	cbi	0x18, 0	; 24
 250:	88 e1       	ldi	r24, 0x18	; 24
 252:	8f b9       	out	0x0f, r24	; 15
 254:	77 9b       	sbis	0x0e, 7	; 14
 256:	fe cf       	rjmp	.-4      	; 0x254
 258:	83 2f       	mov	r24, r19
 25a:	99 27       	eor	r25, r25
 25c:	8f b9       	out	0x0f, r24	; 15
 25e:	77 9b       	sbis	0x0e, 7	; 14
 260:	fe cf       	rjmp	.-4      	; 0x25e
 262:	2f b9       	out	0x0f, r18	; 15
 264:	77 9b       	sbis	0x0e, 7	; 14
 266:	fe cf       	rjmp	.-4      	; 0x264
 268:	c0 9a       	sbi	0x18, 0	; 24
 26a:	78 94       	sei
 26c:	08 95       	ret

0000026e <halRfWaitForCrystalOscillator>:
    BYTE spiStatusByte;

    // Poll the SPI status byte until the crystal oscillator is stable
    do {
	    DISABLE_GLOBAL_INT();
 26e:	f8 94       	cli
	    FASTSPI_UPD_STATUS(spiStatusByte);
 270:	c0 98       	cbi	0x18, 0	; 24
 272:	1f b8       	out	0x0f, r1	; 15
 274:	77 9b       	sbis	0x0e, 7	; 14
 276:	fe cf       	rjmp	.-4      	; 0x274
 278:	8f b1       	in	r24, 0x0f	; 15
 27a:	c0 9a       	sbi	0x18, 0	; 24
	    ENABLE_GLOBAL_INT();
 27c:	78 94       	sei
    } while (!(spiStatusByte & (BM(CC2420_XOSC16M_STABLE))));
 27e:	86 ff       	sbrs	r24, 6
 280:	f6 cf       	rjmp	.-20     	; 0x26e
 282:	08 95       	ret

00000284 <basicRfInit>:
//          A pointer the BASIC_RF_RX_INFO data structure to be used during the first packet reception.
//			The structure can be switched upon packet reception.
//      UINT8 channel
//          The RF channel to be used (11 = 2405 MHz to 26 = 2480 MHz)
//      WORD panId
//          The personal area network identification number

⌨️ 快捷键说明

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