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

📄 main.lss

📁 458通讯
💻 LSS
📖 第 1 页 / 共 5 页
字号:
 512:	1c 92       	st	X, r1
							}
			                goto begin;
 514:	ce ce       	rjmp	.-612    	; 0x2b2 <main+0x56>
			                break;
		    case  NO_ERR:   message_storage(adu.RxADUBuffPtr,mb_infor.EQUIPMENT_NOW,adu.ADULength);    //                   //存储帧
 516:	40 91 a1 00 	lds	r20, 0x00A1
 51a:	60 91 98 00 	lds	r22, 0x0098
 51e:	80 91 9d 00 	lds	r24, 0x009D
 522:	90 91 9e 00 	lds	r25, 0x009E
 526:	73 d2       	rcall	.+1254   	; 0xa0e <message_storage>
			                if(++mb_infor.EQUIPMENT_NOW  > MAX_EQU_NUM)                            //设备查询过来一遍?
 528:	80 91 98 00 	lds	r24, 0x0098
 52c:	8f 5f       	subi	r24, 0xFF	; 255
 52e:	80 93 98 00 	sts	0x0098, r24
 532:	84 30       	cpi	r24, 0x04	; 4
 534:	08 f4       	brcc	.+2      	; 0x538 <__stack+0xd9>
 536:	bd ce       	rjmp	.-646    	; 0x2b2 <main+0x56>
				            mb_infor.EQUIPMENT_NOW = 0;                                             //设备编号从0开始
 538:	10 92 98 00 	sts	0x0098, r1
			                goto begin;
 53c:	ba ce       	rjmp	.-652    	; 0x2b2 <main+0x56>

0000053e <comInit>:
//========================================================
void comInit(void)                           
{
	//UCSRB=0x98;
	UCSRB = 
 53e:	88 e1       	ldi	r24, 0x18	; 24
 540:	8a b9       	out	0x0a, r24	; 10
	(1<<RXEN)/*接收使能*/|(1<<TXEN)/*发送使能*/;
	UBRRL=25;//25;//25; // baud=9600 UBRR=CK/(baud*16) -1 for 脉冲
 542:	89 e1       	ldi	r24, 0x19	; 25
 544:	89 b9       	out	0x09, r24	; 9
 546:	08 95       	ret

00000548 <USART_Transmit>:
}
void USART_Transmit( unsigned char usrdata )
{  
	while (!( UCSRA & (1<<UDRE)) );
 548:	5d 9b       	sbis	0x0b, 5	; 11
 54a:	fe cf       	rjmp	.-4      	; 0x548 <USART_Transmit>
	UDR = usrdata;
 54c:	8c b9       	out	0x0c, r24	; 12
 54e:	08 95       	ret

00000550 <delay_us>:
}

//========================================================
//   发送一个字符串
//========================================================
void t_485(unsigned char *s)
{
	set_485_enable();
	while(*s!='\n')
	{
	    USART_Transmit(*s++);
	}
	//*****************//
	delay_us(1350);              //等末尾的停止位发送完
	//*****************//
	clr_485_disable();
}
//========================================================
//   485接收一个字符函数
//========================================================
uchar r_485(void)
{
//    clr_485_disable();
    uchar num;
	while(!(UCSRA & (1<<RXC)));
	delay_us(50);
	num = UDR;
	return num;
}
//========================================================
//  接收中断响应禁止
//========================================================
inline void CLOSE_USART1_ReINTERRUPT(void)
{
    UCSRB &= ~(1<<RXCIE);                    //
}

inline void OPEN_USART1_ReINTERRUPT(void)
{
    UCSRB |= (1<<RXCIE);                     //接收中断响应使能
}
//=========================================================

//=========================================================
inline void OPEN_WaitResponsionClk(void)
{
	TCNT0 = 0x00;                             //从00-ff
    TCCR0 = 0b00000100;                       //256分频
	TIMSK |= (1<<TOIE0);                     //使能T0中断   4M晶振,每隔0.01632s中断一次
}
//================================================================
inline void CLOSE_WaitResponsionClk(void)
{
    TIMSK &= ~(1<<TOIE0);
	TCCR0 &= 0b11111000;
}
//================================================================
inline void CLOSE_TIMER1(void)
{
    TIMSK &= ~(1<<TOIE1);                    //禁止T1溢出中断
    TCCR1B &= 0b11111000;                     //0 0 0 无时钟源 (T/C 停止)
}
//================================================================
inline void OPEN_TIMER1(void)
{
    TCCR1B = 0b00000001;     //无分频
    TCNT1 = 0xf70c;          //4M时0.5个字符-0.000573s产生一个中断
	TIMSK |= (1<<TOIE1);    //使能T1溢出中断  
}
//================================================================
//                      us级延时   
//================================================================
void delay_us(int time)
{
    do
	time--;
 550:	01 97       	sbiw	r24, 0x01	; 1
 552:	82 30       	cpi	r24, 0x02	; 2
 554:	91 05       	cpc	r25, r1
 556:	e4 f7       	brge	.-8      	; 0x550 <delay_us>
 558:	08 95       	ret

0000055a <t_485>:
 55a:	cf 93       	push	r28
 55c:	df 93       	push	r29
 55e:	ec 01       	movw	r28, r24
 560:	94 9a       	sbi	0x12, 4	; 18
 562:	88 81       	ld	r24, Y
 564:	8a 30       	cpi	r24, 0x0A	; 10
 566:	19 f0       	breq	.+6      	; 0x56e <t_485+0x14>
 568:	89 91       	ld	r24, Y+
 56a:	ee df       	rcall	.-36     	; 0x548 <USART_Transmit>
 56c:	fa cf       	rjmp	.-12     	; 0x562 <t_485+0x8>
 56e:	86 e4       	ldi	r24, 0x46	; 70
 570:	95 e0       	ldi	r25, 0x05	; 5
 572:	ee df       	rcall	.-36     	; 0x550 <delay_us>
 574:	94 98       	cbi	0x12, 4	; 18
 576:	df 91       	pop	r29
 578:	cf 91       	pop	r28
 57a:	08 95       	ret

0000057c <r_485>:
 57c:	5f 9b       	sbis	0x0b, 7	; 11
 57e:	fe cf       	rjmp	.-4      	; 0x57c <r_485>
 580:	82 e3       	ldi	r24, 0x32	; 50
 582:	90 e0       	ldi	r25, 0x00	; 0
 584:	e5 df       	rcall	.-54     	; 0x550 <delay_us>
 586:	8c b1       	in	r24, 0x0c	; 12
 588:	99 27       	eor	r25, r25
 58a:	08 95       	ret

0000058c <CLOSE_USART1_ReINTERRUPT>:
 58c:	57 98       	cbi	0x0a, 7	; 10
 58e:	08 95       	ret

00000590 <OPEN_USART1_ReINTERRUPT>:
 590:	57 9a       	sbi	0x0a, 7	; 10
 592:	08 95       	ret

00000594 <OPEN_WaitResponsionClk>:
 594:	12 be       	out	0x32, r1	; 50
 596:	84 e0       	ldi	r24, 0x04	; 4
 598:	83 bf       	out	0x33, r24	; 51
 59a:	89 b7       	in	r24, 0x39	; 57
 59c:	81 60       	ori	r24, 0x01	; 1
 59e:	89 bf       	out	0x39, r24	; 57
 5a0:	08 95       	ret

000005a2 <CLOSE_WaitResponsionClk>:
 5a2:	89 b7       	in	r24, 0x39	; 57
 5a4:	8e 7f       	andi	r24, 0xFE	; 254
 5a6:	89 bf       	out	0x39, r24	; 57
 5a8:	83 b7       	in	r24, 0x33	; 51
 5aa:	88 7f       	andi	r24, 0xF8	; 248
 5ac:	83 bf       	out	0x33, r24	; 51
 5ae:	08 95       	ret

000005b0 <CLOSE_TIMER1>:
 5b0:	89 b7       	in	r24, 0x39	; 57
 5b2:	8b 7f       	andi	r24, 0xFB	; 251
 5b4:	89 bf       	out	0x39, r24	; 57
 5b6:	8e b5       	in	r24, 0x2e	; 46
 5b8:	88 7f       	andi	r24, 0xF8	; 248
 5ba:	8e bd       	out	0x2e, r24	; 46
 5bc:	08 95       	ret

000005be <OPEN_TIMER1>:
 5be:	81 e0       	ldi	r24, 0x01	; 1
 5c0:	8e bd       	out	0x2e, r24	; 46
 5c2:	8c e0       	ldi	r24, 0x0C	; 12
 5c4:	97 ef       	ldi	r25, 0xF7	; 247
 5c6:	9d bd       	out	0x2d, r25	; 45
 5c8:	8c bd       	out	0x2c, r24	; 44
 5ca:	89 b7       	in	r24, 0x39	; 57
 5cc:	84 60       	ori	r24, 0x04	; 4
 5ce:	89 bf       	out	0x39, r24	; 57
 5d0:	08 95       	ret

000005d2 <delay_ms>:
    while(time>1);
}
//================================================================
//                      ms级延时
//================================================================
void delay_ms(unsigned int time)
{
 5d2:	cf 93       	push	r28
 5d4:	df 93       	push	r29
 5d6:	ec 01       	movw	r28, r24
    while(time!=0)
	{
	    delay_us(1000);
		time--;
 5d8:	89 2b       	or	r24, r25
 5da:	29 f0       	breq	.+10     	; 0x5e6 <delay_ms+0x14>
 5dc:	88 ee       	ldi	r24, 0xE8	; 232
 5de:	93 e0       	ldi	r25, 0x03	; 3
 5e0:	b7 df       	rcall	.-146    	; 0x550 <delay_us>
 5e2:	21 97       	sbiw	r28, 0x01	; 1
 5e4:	d9 f7       	brne	.-10     	; 0x5dc <delay_ms+0xa>
 5e6:	df 91       	pop	r29
 5e8:	cf 91       	pop	r28
 5ea:	08 95       	ret

000005ec <__vector_8>:
//==========================================================================
// 定时计数器1溢出中断函数
//==========================================================================
ISR(SIG_OVERFLOW1)
{
 5ec:	1f 92       	push	r1
 5ee:	0f 92       	push	r0
 5f0:	0f b6       	in	r0, 0x3f	; 63
 5f2:	0f 92       	push	r0
 5f4:	11 24       	eor	r1, r1
 5f6:	2f 93       	push	r18
 5f8:	3f 93       	push	r19
 5fa:	4f 93       	push	r20
 5fc:	5f 93       	push	r21
 5fe:	6f 93       	push	r22
 600:	7f 93       	push	r23
 602:	8f 93       	push	r24
 604:	9f 93       	push	r25
 606:	af 93       	push	r26
 608:	bf 93       	push	r27
 60a:	ef 93       	push	r30
 60c:	ff 93       	push	r31
    TCNT1 = 0xf70c;          //4M时0.5个字符-0.000573s产生一个中断
 60e:	8c e0       	ldi	r24, 0x0C	; 12
 610:	97 ef       	ldi	r25, 0xF7	; 247
 612:	9d bd       	out	0x2d, r25	; 45
 614:	8c bd       	out	0x2c, r24	; 44
    mb_infor.TO_times ++;
 616:	80 91 9b 00 	lds	r24, 0x009B
 61a:	8f 5f       	subi	r24, 0xFF	; 255
 61c:	80 93 9b 00 	sts	0x009B, r24
	if(mb_infor.TO_times == 3)mb_infor.T15_OUT = TRUE;    //1.5ms延时到
 620:	83 30       	cpi	r24, 0x03	; 3
 622:	19 f4       	brne	.+6      	; 0x62a <__vector_8+0x3e>
 624:	81 e0       	ldi	r24, 0x01	; 1
 626:	80 93 99 00 	sts	0x0099, r24
	if(mb_infor.TO_times == 7)
 62a:	80 91 9b 00 	lds	r24, 0x009B
 62e:	87 30       	cpi	r24, 0x07	; 7
 630:	21 f4       	brne	.+8      	; 0x63a <__vector_8+0x4e>
	{
		mb_infor.T35_OUT = TRUE;    //3.5ms延时到
 632:	81 e0       	ldi	r24, 0x01	; 1
 634:	80 93 9a 00 	sts	0x009A, r24
		CLOSE_TIMER1();                                        //关定时器
 638:	bb df       	rcall	.-138    	; 0x5b0 <CLOSE_TIMER1>
 63a:	ff 91       	pop	r31
 63c:	ef 91       	pop	r30
 63e:	bf 91       	pop	r27
 640:	af 91       	pop	r26
 642:	9f 91       	pop	r25
 644:	8f 91       	pop	r24
 646:	7f 91       	pop	r23
 648:	6f 91       	pop	r22
 64a:	5f 91       	pop	r21
 64c:	4f 91       	pop	r20
 64e:	3f 91       	pop	r19
 650:	2f 91       	pop	r18
 652:	0f 90       	pop	r0
 654:	0f be       	out	0x3f, r0	; 63
 656:	0f 90       	pop	r0
 658:	1f 90       	pop	r1
 65a:	18 95       	reti

0000065c <__vector_9>:
	}
}
//==========================================================================
// 定时计数器0溢出中断函数
//==========================================================================
ISR(SIG_OVERFLOW0)
{
 65c:	1f 92       	push	r1
 65e:	0f 92       	push	r0
 660:	0f b6       	in	r0, 0x3f	; 63
 662:	0f 92       	push	r0
 664:	11 24       	eor	r1, r1
 666:	2f 93       	push	r18
 668:	3f 93       	push	r19
 66a:	4f 93       	push	r20
 66c:	5f 93       	push	r21
 66e:	6f 93       	push	r22
 670:	7f 93       	push	r23
 672:	8f 93       	push	r24
 674:	9f 93       	push	r25
 676:	af 93       	push	r26
 678:	bf 93       	push	r27
 67a:	ef 93       	push	r30
 67c:	ff 93       	push	r31
    WAIT_Time ++;
 67e:	80 91 94 00 	lds	r24, 0x0094
 682:	8f 5f       	subi	r24, 0xFF	; 255
 684:	80 93 94 00 	sts	0x0094, r24
    if(WAIT_Time >= MAX_WAIT_TIME)              
 688:	8c 35       	cpi	r24, 0x5C	; 92
 68a:	18 f0       	brcs	.+6      	; 0x692 <__vector_9+0x36>
	{
	    //WAIT_Time = MAX_WAIT_TIME;
		CLOSE_WaitResponsionClk();  //关T0中断

⌨️ 快捷键说明

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