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

📄 main.lss

📁 the code connect Atmega 32 uC to 1 module Bluetooth ARF32
💻 LSS
📖 第 1 页 / 共 5 页
字号:
 41a:	80 e0       	ldi	r24, 0x00	; 0
 41c:	90 e0       	ldi	r25, 0x00	; 0
		Send_Byte_To_UART(local_port);
		Send_Byte_To_UART(data_length);
		Send_Byte_To_UART(0x00);
		
		for(int i=0;i<data_length;i++)			//Du lieu can gui
 41e:	70 e0       	ldi	r23, 0x00	; 0
 420:	08 c0       	rjmp	.+16     	; 0x432 <Send_Data_To_Remote+0x5e>
			Send_Byte_To_UART(data[i]);
 422:	fa 01       	movw	r30, r20
 424:	e8 0f       	add	r30, r24
 426:	f9 1f       	adc	r31, r25
 428:	e0 81       	ld	r30, Z
/*----Gui 1 byte du lieu qua cong USART----*/
/*--------------------------------------------*/
void Send_Byte_To_UART(char data )
	{
		/*Doi cho den khi UDRE=1,san sang de truyen du lieu	*/
	   while ( !( UCSRA & (1<<UDRE)) );
 42a:	5d 9b       	sbis	0x0b, 5	; 11
 42c:	fe cf       	rjmp	.-4      	; 0x42a <Send_Data_To_Remote+0x56>
	   
	   /*Dua du lieu ra cong USART*/
   	    UDR=data;
 42e:	ec b9       	out	0x0c, r30	; 12
		Send_Byte_To_UART(0x64+data_length);	//Check Sum
		Send_Byte_To_UART(local_port);
		Send_Byte_To_UART(data_length);
		Send_Byte_To_UART(0x00);
		
		for(int i=0;i<data_length;i++)			//Du lieu can gui
 430:	01 96       	adiw	r24, 0x01	; 1
 432:	86 17       	cp	r24, r22
 434:	97 07       	cpc	r25, r23
 436:	ac f3       	brlt	.-22     	; 0x422 <Send_Data_To_Remote+0x4e>
/*----Gui 1 byte du lieu qua cong USART----*/
/*--------------------------------------------*/
void Send_Byte_To_UART(char data )
	{
		/*Doi cho den khi UDRE=1,san sang de truyen du lieu	*/
	   while ( !( UCSRA & (1<<UDRE)) );
 438:	5d 9b       	sbis	0x0b, 5	; 11
 43a:	fe cf       	rjmp	.-4      	; 0x438 <Send_Data_To_Remote+0x64>
	   
	   /*Dua du lieu ra cong USART*/
   	    UDR=data;
 43c:	83 e0       	ldi	r24, 0x03	; 3
 43e:	8c b9       	out	0x0c, r24	; 12
			Send_Byte_To_UART(data[i]);
		Send_Byte_To_UART(ETX);					//End
	}
 440:	08 95       	ret

00000442 <Release_Link>:
//-----------------------------------------------------------------------------------------------
/*---Ham Release Link--*/
void Release_Link(unsigned char local_port)
	{
 442:	98 2f       	mov	r25, r24
/*----Gui 1 byte du lieu qua cong USART----*/
/*--------------------------------------------*/
void Send_Byte_To_UART(char data )
	{
		/*Doi cho den khi UDRE=1,san sang de truyen du lieu	*/
	   while ( !( UCSRA & (1<<UDRE)) );
 444:	5d 9b       	sbis	0x0b, 5	; 11
 446:	fe cf       	rjmp	.-4      	; 0x444 <Release_Link+0x2>
	   
	   /*Dua du lieu ra cong USART*/
   	    UDR=data;
 448:	82 e0       	ldi	r24, 0x02	; 2
 44a:	8c b9       	out	0x0c, r24	; 12
/*----Gui 1 byte du lieu qua cong USART----*/
/*--------------------------------------------*/
void Send_Byte_To_UART(char data )
	{
		/*Doi cho den khi UDRE=1,san sang de truyen du lieu	*/
	   while ( !( UCSRA & (1<<UDRE)) );
 44c:	5d 9b       	sbis	0x0b, 5	; 11
 44e:	fe cf       	rjmp	.-4      	; 0x44c <Release_Link+0xa>
	   
	   /*Dua du lieu ra cong USART*/
   	    UDR=data;
 450:	82 e5       	ldi	r24, 0x52	; 82
 452:	8c b9       	out	0x0c, r24	; 12
/*----Gui 1 byte du lieu qua cong USART----*/
/*--------------------------------------------*/
void Send_Byte_To_UART(char data )
	{
		/*Doi cho den khi UDRE=1,san sang de truyen du lieu	*/
	   while ( !( UCSRA & (1<<UDRE)) );
 454:	5d 9b       	sbis	0x0b, 5	; 11
 456:	fe cf       	rjmp	.-4      	; 0x454 <Release_Link+0x12>
	   
	   /*Dua du lieu ra cong USART*/
   	    UDR=data;
 458:	8d e0       	ldi	r24, 0x0D	; 13
 45a:	8c b9       	out	0x0c, r24	; 12
/*----Gui 1 byte du lieu qua cong USART----*/
/*--------------------------------------------*/
void Send_Byte_To_UART(char data )
	{
		/*Doi cho den khi UDRE=1,san sang de truyen du lieu	*/
	   while ( !( UCSRA & (1<<UDRE)) );
 45c:	5d 9b       	sbis	0x0b, 5	; 11
 45e:	fe cf       	rjmp	.-4      	; 0x45c <Release_Link+0x1a>
	   
	   /*Dua du lieu ra cong USART*/
   	    UDR=data;
 460:	81 e0       	ldi	r24, 0x01	; 1
 462:	8c b9       	out	0x0c, r24	; 12
/*----Gui 1 byte du lieu qua cong USART----*/
/*--------------------------------------------*/
void Send_Byte_To_UART(char data )
	{
		/*Doi cho den khi UDRE=1,san sang de truyen du lieu	*/
	   while ( !( UCSRA & (1<<UDRE)) );
 464:	5d 9b       	sbis	0x0b, 5	; 11
 466:	fe cf       	rjmp	.-4      	; 0x464 <Release_Link+0x22>
	   
	   /*Dua du lieu ra cong USART*/
   	    UDR=data;
 468:	1c b8       	out	0x0c, r1	; 12
/*----Gui 1 byte du lieu qua cong USART----*/
/*--------------------------------------------*/
void Send_Byte_To_UART(char data )
	{
		/*Doi cho den khi UDRE=1,san sang de truyen du lieu	*/
	   while ( !( UCSRA & (1<<UDRE)) );
 46a:	5d 9b       	sbis	0x0b, 5	; 11
 46c:	fe cf       	rjmp	.-4      	; 0x46a <Release_Link+0x28>
	   
	   /*Dua du lieu ra cong USART*/
   	    UDR=data;
 46e:	80 e6       	ldi	r24, 0x60	; 96
 470:	8c b9       	out	0x0c, r24	; 12
/*----Gui 1 byte du lieu qua cong USART----*/
/*--------------------------------------------*/
void Send_Byte_To_UART(char data )
	{
		/*Doi cho den khi UDRE=1,san sang de truyen du lieu	*/
	   while ( !( UCSRA & (1<<UDRE)) );
 472:	5d 9b       	sbis	0x0b, 5	; 11
 474:	fe cf       	rjmp	.-4      	; 0x472 <Release_Link+0x30>
	   
	   /*Dua du lieu ra cong USART*/
   	    UDR=data;
 476:	9c b9       	out	0x0c, r25	; 12
/*----Gui 1 byte du lieu qua cong USART----*/
/*--------------------------------------------*/
void Send_Byte_To_UART(char data )
	{
		/*Doi cho den khi UDRE=1,san sang de truyen du lieu	*/
	   while ( !( UCSRA & (1<<UDRE)) );
 478:	5d 9b       	sbis	0x0b, 5	; 11
 47a:	fe cf       	rjmp	.-4      	; 0x478 <Release_Link+0x36>
	   
	   /*Dua du lieu ra cong USART*/
   	    UDR=data;
 47c:	83 e0       	ldi	r24, 0x03	; 3
 47e:	8c b9       	out	0x0c, r24	; 12
		Send_Byte_To_UART(0x01);				//Data length =0x0001
		Send_Byte_To_UART(0x00);
		Send_Byte_To_UART(0x60);				//Check sum
		Send_Byte_To_UART(local_port);			//Release Link at RFComm Port indicated by local_port
		Send_Byte_To_UART(ETX);
	}
 480:	08 95       	ret

00000482 <Release_Link_Confirm>:
	
//---------------------------------------------------------------------------------------	
/*---Ham Release Link Confirm---*/
unsigned char Release_Link_Confirm(void)
	{	
		if (Receive_Cmd[6]=ERROR_OK){return (TRUE);}
 482:	10 92 66 00 	sts	0x0066, r1
		else {return FALSE;}
	}
 486:	80 e0       	ldi	r24, 0x00	; 0
 488:	08 95       	ret

0000048a <Release_Link_Indication>:
//--------------------------------------------------------------------------------------
/*---Ham Release link indication---*/
unsigned char Release_Link_Indication(unsigned char *local_port)
	{
 48a:	fc 01       	movw	r30, r24
		*local_port=Receive_Cmd[7];
 48c:	80 91 67 00 	lds	r24, 0x0067
 490:	80 83       	st	Z, r24
 492:	90 e0       	ldi	r25, 0x00	; 0
 494:	80 91 66 00 	lds	r24, 0x0066
 498:	88 23       	and	r24, r24
 49a:	09 f4       	brne	.+2      	; 0x49e <Release_Link_Indication+0x14>
 49c:	91 e0       	ldi	r25, 0x01	; 1
		if(Receive_Cmd[6]==0x00) return TRUE;
		else return FALSE;
	}
 49e:	89 2f       	mov	r24, r25
 4a0:	08 95       	ret

000004a2 <main>:
		//mang Device dung de luu dia chi Bluetooth Addr va Device Class (IP)
		//struct addr_table Device[Device_Max];
		//Mang DataToSend dung de luu du lieu can gui toi Remote device
		
int main(void)
{	
 4a2:	ef 92       	push	r14
 4a4:	ff 92       	push	r15
 4a6:	0f 93       	push	r16
 4a8:	1f 93       	push	r17
 4aa:	df 93       	push	r29
 4ac:	cf 93       	push	r28
 4ae:	cd b7       	in	r28, 0x3d	; 61
 4b0:	de b7       	in	r29, 0x3e	; 62
 4b2:	2e 97       	sbiw	r28, 0x0e	; 14
 4b4:	0f b6       	in	r0, 0x3f	; 63
 4b6:	f8 94       	cli
 4b8:	de bf       	out	0x3e, r29	; 62
 4ba:	0f be       	out	0x3f, r0	; 63
 4bc:	cd bf       	out	0x3d, r28	; 61
	unsigned char i;
	//unsigned char local_port,remote_port;
	unsigned char usb_bd_addr[6],save_bd_addr[6];
	char DataToSend[4]={'T','e','s','t'};
 4be:	84 e5       	ldi	r24, 0x54	; 84
 4c0:	89 83       	std	Y+1, r24	; 0x01
 4c2:	95 e6       	ldi	r25, 0x65	; 101
 4c4:	9a 83       	std	Y+2, r25	; 0x02
 4c6:	83 e7       	ldi	r24, 0x73	; 115
 4c8:	8b 83       	std	Y+3, r24	; 0x03
 4ca:	84 e7       	ldi	r24, 0x74	; 116
 4cc:	8c 83       	std	Y+4, r24	; 0x04
	char Fuck[4]={'F','u','c','k'};
 4ce:	86 e4       	ldi	r24, 0x46	; 70
 4d0:	8d 83       	std	Y+5, r24	; 0x05
 4d2:	85 e7       	ldi	r24, 0x75	; 117
 4d4:	8e 83       	std	Y+6, r24	; 0x06
 4d6:	83 e6       	ldi	r24, 0x63	; 99
 4d8:	8f 83       	std	Y+7, r24	; 0x07
 4da:	8b e6       	ldi	r24, 0x6B	; 107
 4dc:	88 87       	std	Y+8, r24	; 0x08
	DDRD|=0x8C;	//set pin PD7(ALARM),PD2,PD3 as Output
 4de:	81 b3       	in	r24, 0x11	; 17
 4e0:	8c 68       	ori	r24, 0x8C	; 140
 4e2:	81 bb       	out	0x11, r24	; 17
	PORTD=0x00;
 4e4:	12 ba       	out	0x12, r1	; 18
	PORTD|=0x0C;	//set cac Pin PD2, PD3(RTS va CTS),tat ALARLM
 4e6:	82 b3       	in	r24, 0x12	; 18
 4e8:	8c 60       	ori	r24, 0x0C	; 12
 4ea:	82 bb       	out	0x12, r24	; 18
	
	//khai bao dia chi cua module bluetooth 1
	usb_bd_addr[0]=0x23;
 4ec:	83 e2       	ldi	r24, 0x23	; 35
 4ee:	89 87       	std	Y+9, r24	; 0x09
	usb_bd_addr[1]=0x3B;
 4f0:	8b e3       	ldi	r24, 0x3B	; 59
 4f2:	8a 87       	std	Y+10, r24	; 0x0a
	usb_bd_addr[2]=0x65;
 4f4:	9b 87       	std	Y+11, r25	; 0x0b
	usb_bd_addr[3]=0xE8;
 4f6:	88 ee       	ldi	r24, 0xE8	; 232
 4f8:	8c 87       	std	Y+12, r24	; 0x0c
	usb_bd_addr[4]=0x00;
 4fa:	1d 86       	std	Y+13, r1	; 0x0d
	usb_bd_addr[5]=0x10;
 4fc:	80 e1       	ldi	r24, 0x10	; 16
 4fe:	8e 87       	std	Y+14, r24	; 0x0e
/*********************************************/
/*----Chon Baudrate cho cong USART + set Frame: 8 data bit+ 1 Stop bit----*/
void UART_Init(unsigned int baud)
	{
		/* Set baud rate */
		UBRRH = (unsigned char)(baud>>8);
 500:	10 bc       	out	0x20, r1	; 32
		UBRRL = (unsigned char)baud;
 502:	87 e1       	ldi	r24, 0x17	; 23
 504:	89 b9       	out	0x09, r24	; 9
		
		/* Enable receiver and transmitter */
		UCSRB |= (1<<RXEN)|(1<<TXEN);
 506:	8a b1       	in	r24, 0x0a	; 10
 508:	88 61       	ori	r24, 0x18	; 24
 50a:	8a b9       	out	0x0a, r24	; 10
		
		/* Set frame format: 8data, 1stop bit */
		UCSRC |= (1<<URSEL)|(0<<USBS)|(3<<UCSZ0);
 50c:	80 b5       	in	r24, 0x20	; 32
 50e:	86 68       	ori	r24, 0x86	; 134
 510:	80 bd       	out	0x20, r24	; 32
	//----------------------------------------------------------------------------------------------------------------------------
	/*Thuc hien Reset module va kiem tra xem module co hoat dong khong, neu ko thi bat den ALARM*/
	 //for( i=0; i<TIME_OUT;i++)		/*---Truoc khi bat dau, Reset Module Blue---*/
	//   {
	//	_delay_ms(1000);		//Tre 1s
		Reset_Module();					//Reset
 512:	0e 94 5a 00 	call	0xb4	; 0xb4 <Reset_Module>
		//Dong thoi doi Confirm cua lenh Service Browse
		//SDAP_Disconnect();		//Ngat ket noi SDAP
		//Get_Data_From_Module(); //Doi Confirm tu Module
		//while(!SDAP_Disconnect_Confirm());	//Doi Confirm cua SDAP Disconnect
//	KETNOI:	
	Create_SPP_Link(usb_bd_addr,0x01,0x01);  //ket noi SPP voi usb Remote Device  qua cong 1
 516:	ce 01       	movw	r24, r28
 518:	09 96       	adiw	r24, 0x09	; 9
 51a:	61 e0       	ldi	r22, 0x01	; 1
 51c:	41 e0       	ldi	r20, 0x01	; 1
 51e:	0e 94 96 01 	call	0x32c	; 0x32c <Create_SPP_Link>
//		Get_Data_From_Module();		//Read Link Establish Indication
//		if(SPP_Link_Indication(save_bd_addr,&local_port,&remote_port)==FALSE)goto KETNOI;
	//-----------------------------------------------------------------------Send Data toi cac module----------------------------------------------------------------------	
	while(1)
	{
	Send_Data_To_Remote(1,4,DataToSend);
 522:	7e 01       	movw	r14, r28
 524:	08 94       	sec
 526:	e1 1c       	adc	r14, r1
 528:	f1 1c       	adc	r15, r1
	Send_Data_To_Remote(1,4,Fuck);
 52a:	8e 01       	movw	r16, r28
 52c:	0b 5f       	subi	r16, 0xFB	; 251
 52e:	1f 4f       	sbci	r17, 0xFF	; 255
//		Get_Data_From_Module();		//Read Link Establish Indication
//		if(SPP_Link_Indication(save_bd_addr,&local_port,&remote_port)==FALSE)goto KETNOI;
	//-----------------------------------------------------------------------Send Data toi cac module----------------------------------------------------------------------	
	while(1)
	{
	Send_Data_To_Remote(1,4,DataToSend);
 530:	81 e0       	ldi	r24, 0x01	; 1
 532:	64 e0       	ldi	r22, 0x04	; 4
 534:	a7 01       	movw	r20, r14
 536:	0e 94 ea 01 	call	0x3d4	; 0x3d4 <Send_Data_To_Remote>
	Send_Data_To_Remote(1,4,Fuck);
 53a:	81 e0       	ldi	r24, 0x01	; 1
 53c:	64 e0       	ldi	r22, 0x04	; 4
 53e:	a8 01       	movw	r20, r16
 540:	0e 94 ea 01 	call	0x3d4	; 0x3d4 <Send_Data_To_Remote>
 544:	f5 cf       	rjmp	.-22     	; 0x530 <main+0x8e>

00000546 <_exit>:
 546:	f8 94       	cli

00000548 <__stop_program>:
 548:	ff cf       	rjmp	.-2      	; 0x548 <__stop_program>

⌨️ 快捷键说明

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