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

📄 test.lss

📁 这是一个UCOS的AVR移植程序
💻 LSS
📖 第 1 页 / 共 5 页
字号:
     420:	e2 5c       	subi	r30, 0xC2	; 194
     422:	fd 4f       	sbci	r31, 0xFD	; 253
     424:	20 91 9c 00 	lds	r18, 0x009C
     428:	20 83       	st	Z, r18
     42a:	01 96       	adiw	r24, 0x01	; 1
     42c:	90 93 37 02 	sts	0x0237, r25
     430:	80 93 36 02 	sts	0x0236, r24
	TCNT2 = 195;
     434:	83 ec       	ldi	r24, 0xC3	; 195
     436:	84 bd       	out	0x24, r24	; 36
	TCCR2 =  (1 << CS22);//256分频
     438:	84 e0       	ldi	r24, 0x04	; 4
     43a:	85 bd       	out	0x25, r24	; 37

	OSIntExit();
     43c:	0e 94 21 04 	call	0x842
	PopRS();
     440:	0f 91       	pop	r16
     442:	0f bf       	out	0x3f, r16	; 63
     444:	ff 91       	pop	r31
     446:	ef 91       	pop	r30
     448:	df 91       	pop	r29
     44a:	cf 91       	pop	r28
     44c:	bf 91       	pop	r27
     44e:	af 91       	pop	r26
     450:	9f 91       	pop	r25
     452:	8f 91       	pop	r24
     454:	7f 91       	pop	r23
     456:	6f 91       	pop	r22
     458:	5f 91       	pop	r21
     45a:	4f 91       	pop	r20
     45c:	3f 91       	pop	r19
     45e:	2f 91       	pop	r18
     460:	1f 91       	pop	r17
     462:	0f 91       	pop	r16
     464:	ff 90       	pop	r15
     466:	ef 90       	pop	r14
     468:	df 90       	pop	r13
     46a:	cf 90       	pop	r12
     46c:	bf 90       	pop	r11
     46e:	af 90       	pop	r10
     470:	9f 90       	pop	r9
     472:	8f 90       	pop	r8
     474:	7f 90       	pop	r7
     476:	6f 90       	pop	r6
     478:	5f 90       	pop	r5
     47a:	4f 90       	pop	r4
     47c:	3f 90       	pop	r3
     47e:	2f 90       	pop	r2
     480:	1f 90       	pop	r1
     482:	0f 90       	pop	r0
     484:	08 95       	ret

00000486 <__vector_10>:
}

//定时器2中断,判断串口接收完成
UCOSISR(SIG_OVERFLOW2)
{
	PushRS();
     486:	0f 92       	push	r0
     488:	1f 92       	push	r1
     48a:	2f 92       	push	r2
     48c:	3f 92       	push	r3
     48e:	4f 92       	push	r4
     490:	5f 92       	push	r5
     492:	6f 92       	push	r6
     494:	7f 92       	push	r7
     496:	8f 92       	push	r8
     498:	9f 92       	push	r9
     49a:	af 92       	push	r10
     49c:	bf 92       	push	r11
     49e:	cf 92       	push	r12
     4a0:	df 92       	push	r13
     4a2:	ef 92       	push	r14
     4a4:	ff 92       	push	r15
     4a6:	0f 93       	push	r16
     4a8:	1f 93       	push	r17
     4aa:	2f 93       	push	r18
     4ac:	3f 93       	push	r19
     4ae:	4f 93       	push	r20
     4b0:	5f 93       	push	r21
     4b2:	6f 93       	push	r22
     4b4:	7f 93       	push	r23
     4b6:	8f 93       	push	r24
     4b8:	9f 93       	push	r25
     4ba:	af 93       	push	r26
     4bc:	bf 93       	push	r27
     4be:	cf 93       	push	r28
     4c0:	df 93       	push	r29
     4c2:	ef 93       	push	r30
     4c4:	ff 93       	push	r31
     4c6:	0f b7       	in	r16, 0x3f	; 63
     4c8:	00 68       	ori	r16, 0x80	; 128
     4ca:	0f 93       	push	r16
	OSIntEnter();
     4cc:	0e 94 14 04 	call	0x828
	if (OSIntNesting > 0)
     4d0:	80 91 81 04 	lds	r24, 0x0481
     4d4:	88 23       	and	r24, r24
     4d6:	41 f0       	breq	.+16     	; 0x4e8
	OSTCBCur->OSTCBStkPtr = (OS_STK *)SP;
     4d8:	e0 91 82 04 	lds	r30, 0x0482
     4dc:	f0 91 83 04 	lds	r31, 0x0483
     4e0:	8d b7       	in	r24, 0x3d	; 61
     4e2:	9e b7       	in	r25, 0x3e	; 62
     4e4:	80 83       	st	Z, r24
     4e6:	91 83       	std	Z+1, r25	; 0x01
	
	TCCR2 = 0;//关闭定时器
     4e8:	15 bc       	out	0x25, r1	; 37
	OSSemPost(UartRxSem);
     4ea:	80 91 e2 03 	lds	r24, 0x03E2
     4ee:	90 91 e3 03 	lds	r25, 0x03E3
     4f2:	0e 94 11 08 	call	0x1022
	
	OSIntExit();
     4f6:	0e 94 21 04 	call	0x842
	PopRS();
     4fa:	0f 91       	pop	r16
     4fc:	0f bf       	out	0x3f, r16	; 63
     4fe:	ff 91       	pop	r31
     500:	ef 91       	pop	r30
     502:	df 91       	pop	r29
     504:	cf 91       	pop	r28
     506:	bf 91       	pop	r27
     508:	af 91       	pop	r26
     50a:	9f 91       	pop	r25
     50c:	8f 91       	pop	r24
     50e:	7f 91       	pop	r23
     510:	6f 91       	pop	r22
     512:	5f 91       	pop	r21
     514:	4f 91       	pop	r20
     516:	3f 91       	pop	r19
     518:	2f 91       	pop	r18
     51a:	1f 91       	pop	r17
     51c:	0f 91       	pop	r16
     51e:	ff 90       	pop	r15
     520:	ef 90       	pop	r14
     522:	df 90       	pop	r13
     524:	cf 90       	pop	r12
     526:	bf 90       	pop	r11
     528:	af 90       	pop	r10
     52a:	9f 90       	pop	r9
     52c:	8f 90       	pop	r8
     52e:	7f 90       	pop	r7
     530:	6f 90       	pop	r6
     532:	5f 90       	pop	r5
     534:	4f 90       	pop	r4
     536:	3f 90       	pop	r3
     538:	2f 90       	pop	r2
     53a:	1f 90       	pop	r1
     53c:	0f 90       	pop	r0
     53e:	08 95       	ret

00000540 <writeChar>:
/*************************DS1302******************************************/

/* 字节写 */   //把一个字节写进1302
void writeChar(unsigned char data)
{
     540:	97 e0       	ldi	r25, 0x07	; 7
	unsigned char i;

	for (i = 0; i < 8; i++)
	{
		CLR_TIMER_SCLK;
     542:	c3 98       	cbi	0x18, 3	; 24
		asm volatile ("nop	\n\t" ::);
     544:	00 00       	nop
		
		CLR_TIMER_IO;
     546:	c4 98       	cbi	0x18, 4	; 24
		if (data & 0x01)
     548:	80 fd       	sbrc	r24, 0
		{
			SET_TIMER_IO;//如果输入的第i位为1,则IO口置为1,否则为0
     54a:	c4 9a       	sbi	0x18, 4	; 24
		}
		asm volatile ("nop	\n\t" ::);
     54c:	00 00       	nop
		
		SET_TIMER_SCLK;
     54e:	c3 9a       	sbi	0x18, 3	; 24
		asm volatile ("nop	\n\t" ::);
     550:	00 00       	nop
		data >>= 1;
     552:	86 95       	lsr	r24
     554:	91 50       	subi	r25, 0x01	; 1
     556:	97 ff       	sbrs	r25, 7
     558:	f4 cf       	rjmp	.-24     	; 0x542
     55a:	08 95       	ret

0000055c <readChar>:
	}
}

/* 字节读 */
unsigned char readChar(void)
{
	unsigned char i;
	unsigned char retVal = 0;
     55c:	80 e0       	ldi	r24, 0x00	; 0
	
	DDRB &= ~(1<<DDB4);//PB4设为输入上拉 读IO时,PB4设为输入
     55e:	bc 98       	cbi	0x17, 4	; 23
	PORTB |= (1<<PORTB4);
     560:	c4 9a       	sbi	0x18, 4	; 24
     562:	27 e0       	ldi	r18, 0x07	; 7
	
	for (i = 0; i < 8; i++)
	{
		CLR_TIMER_SCLK;
     564:	c3 98       	cbi	0x18, 3	; 24
		asm volatile ("nop	\n\t" ::);
     566:	00 00       	nop
		
		retVal >>= 1;
     568:	86 95       	lsr	r24
		if (PINB & 0x10)						// (PINB & (1<<PORTB4))
     56a:	b4 99       	sbic	0x16, 4	; 22
		{
			retVal |= 0x80;//PB4为0则retval的第i位为0,为1则第i位为1
     56c:	80 68       	ori	r24, 0x80	; 128
		}
		asm volatile ("nop	\n\t" ::);
     56e:	00 00       	nop
		
		SET_TIMER_SCLK;
     570:	c3 9a       	sbi	0x18, 3	; 24
		asm volatile ("nop	\n\t" ::);
     572:	00 00       	nop
     574:	21 50       	subi	r18, 0x01	; 1
     576:	27 ff       	sbrs	r18, 7
     578:	f5 cf       	rjmp	.-22     	; 0x564
	}
	
	DDRB |= (1<<DDB4);//PB4输出为1  IO口输出1
     57a:	bc 9a       	sbi	0x17, 4	; 23
	PORTB |= (1<<PORTB4);
     57c:	c4 9a       	sbi	0x18, 4	; 24
	
	return retVal;
}
     57e:	99 27       	eor	r25, r25
     580:	08 95       	ret

00000582 <setChipReg>:

// 寄存器设置  感觉是用来校准时间的,也用来设置时间
void setChipReg(unsigned char addr,unsigned char data)
{
     582:	1f 93       	push	r17
     584:	16 2f       	mov	r17, r22
	CLR_TIMER_SCLK;
     586:	c3 98       	cbi	0x18, 3	; 24
	asm volatile ("nop	\n\t" ::);	
     588:	00 00       	nop
	SET_TIMER_REST;
     58a:	c5 9a       	sbi	0x18, 5	; 24
	asm volatile ("nop	\n\t" ::);
     58c:	00 00       	nop

	writeChar(addr);//地址中有控制命令
     58e:	0e 94 a0 02 	call	0x540
	writeChar(data);
     592:	81 2f       	mov	r24, r17
     594:	0e 94 a0 02 	call	0x540
	
	CLR_TIMER_SCLK;
     598:	c3 98       	cbi	0x18, 3	; 24
	asm volatile ("nop	\n\t" ::);
     59a:	00 00       	nop
	CLR_TIMER_REST;
     59c:	c5 98       	cbi	0x18, 5	; 24
	asm volatile ("nop	\n\t" ::);
     59e:	00 00       	nop
     5a0:	1f 91       	pop	r17
     5a2:	08 95       	ret

000005a4 <getChipReg>:
}

/* 寄存器读取 */
unsigned char getChipReg(unsigned char addr)
{
	unsigned char retVal;
	
	CLR_TIMER_SCLK;
     5a4:	c3 98       	cbi	0x18, 3	; 24
	asm volatile ("nop	\n\t" ::);	
     5a6:	00 00       	nop
	SET_TIMER_REST;
     5a8:	c5 9a       	sbi	0x18, 5	; 24
	asm volatile ("nop	\n\t" ::);
     5aa:	00 00       	nop
	
	writeChar(addr);
     5ac:	0e 94 a0 02 	call	0x540
	retVal = readChar();
     5b0:	0e 94 ae 02 	call	0x55c

	CLR_TIMER_SCLK;
     5b4:	c3 98       	cbi	0x18, 3	; 24
	asm volatile ("nop	\n\t" ::);
     5b6:	00 00       	nop
	CLR_TIMER_REST;
     5b8:	c5 98       	cbi	0x18, 5	; 24
	asm volatile ("nop	\n\t" ::);
     5ba:	00 00       	nop
	
	return retVal;
}
     5bc:	99 27       	eor	r25, r25
     5be:	08 95       	ret

000005c0 <chipWriteProtect>:


// 写保护控制
void chipWriteProtect(unsigned char condition)
{
     5c0:	68 2f       	mov	r22, r24
	if (!condition)//condition为0将写保护关闭,为1打开
     5c2:	81 11       	cpse	r24, r1
	{
		setChipReg(0x8E,0x00);//将写保护关闭
	}
	else
	{
		setChipReg(0x8E,0x80);//将写保护打开
     5c4:	60 e8       	ldi	r22, 0x80	; 128
     5c6:	8e e8       	ldi	r24, 0x8E	; 142
     5c8:	0e 94 c1 02 	call	0x582
     5cc:	08 95       	ret
     5ce:	08 95       	ret

000005d0 <chipClockStart>:
	}
}


// 启动计时
void chipClockStart(unsigned char condition)
{
     5d0:	1f 93       	push	r17
     5d2:	cf 93       	push	r28
     5d4:	18 2f       	mov	r17, r24
	unsigned char tmpChar;
	unsigned char tmpPB = PORTB & 0x18;//取PB3,PB4,为了操作完能恢复
     5d6:	c8 b3       	in	r28, 0x18	; 24
     5d8:	c8 71       	andi	r28, 0x18	; 24
	setChipReg(0x8E,0x00);//将写保护关了
     5da:	60 e0       	ldi	r22, 0x00	; 0
     5dc:	8e e8       	ldi	r24, 0x8E	; 142
     5de:	0e 94 c1 02 	call	0x582

	tmpChar = getChipReg(0x81);//读sec寄存器的值,用来判断时钟是否打开
     5e2:	81 e8       	ldi	r24, 0x81	; 129
     5e4:	0e 94 d2 02 	call	0x5a4
     5e8:	68 2f       	mov	r22, r24
	if (tmpChar & 0x80)//如果sec寄存器的第7位为1,说明时钟关闭
     5ea:	87 ff       	sbrs	r24, 7
     5ec:	09 c0       	rjmp	.+18     	; 0x600
	{
		if (condition)//condition为1,打开时钟
     5ee:	11 23       	and	r17, r17
     5f0:	69 f0       	breq	.+26     	; 0x60c
		{
			setChipReg(0x80,(tmpChar&0x7F));//打开时钟
     5f2:	6f 77       	andi	r22, 0x7F	; 127
     5f4:	80 e8       	ldi	r24, 0x80	; 128
     5f6:	0e 94 c1 02 	call	0x582
			setChipReg(0x90,CHARGE_ON_2_3);	// Just For This Routine
     5fa:	6b ea       	ldi	r22, 0xAB	; 171
     5fc:	80 e9       	ldi	r24, 0x90	; 144
     5fe:	04 c0       	rjmp	.+8      	; 0x608
		}
	}
	else//时钟本来就打开
	{
		if (!condition)//condition为0,关掉时钟
     600:	11 23       	and	r17, r17
     602:	21 f4       	brne	.+8      	; 0x60c
		{
			setChipReg(0x80,(tmpChar|0x80));//关掉时钟
     604:	60 68       	ori	r22, 0x80	; 128
     606:	80 e8       	ldi	r24, 0x80	; 128
     608:	0e 94 c1 02 	call	0x582
		}
	}
	setChipReg(0x8E,0x80);//写保护打开
     60c:	60 e8       	ldi	r22, 0x80	; 128
     60e:	8e e8       	ldi	r24, 0x8E	; 142
     610:	0e 94 c1 02 	call	0x582
	tmpChar = PORTB & 0xE7;//这两行主要是还原PORTB口的值

⌨️ 快捷键说明

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