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

📄 uart1.i

📁 code keil for PC16552D
💻 I
字号:
#line 1 "UART1.C"
#line 1 "C:\\Keil\\ARM\\INC\\Philips\\LPC22xx.H"
 
 
 
 
 
 
 
 
 




 





 
#line 64 "C:\\Keil\\ARM\\INC\\Philips\\LPC22xx.H"

 




 
#line 103 "C:\\Keil\\ARM\\INC\\Philips\\LPC22xx.H"

 












 




 





 


 



 





 


 
#line 161 "C:\\Keil\\ARM\\INC\\Philips\\LPC22xx.H"

 
#line 179 "C:\\Keil\\ARM\\INC\\Philips\\LPC22xx.H"

 
#line 196 "C:\\Keil\\ARM\\INC\\Philips\\LPC22xx.H"

 
#line 211 "C:\\Keil\\ARM\\INC\\Philips\\LPC22xx.H"

 
#line 228 "C:\\Keil\\ARM\\INC\\Philips\\LPC22xx.H"

 
#line 237 "C:\\Keil\\ARM\\INC\\Philips\\LPC22xx.H"

 






 






 
#line 262 "C:\\Keil\\ARM\\INC\\Philips\\LPC22xx.H"

 
#line 290 "C:\\Keil\\ARM\\INC\\Philips\\LPC22xx.H"

 
#line 305 "C:\\Keil\\ARM\\INC\\Philips\\LPC22xx.H"

 
 


 
#line 319 "C:\\Keil\\ARM\\INC\\Philips\\LPC22xx.H"

 




 
#line 350 "C:\\Keil\\ARM\\INC\\Philips\\LPC22xx.H"

 
#line 376 "C:\\Keil\\ARM\\INC\\Philips\\LPC22xx.H"

 
#line 402 "C:\\Keil\\ARM\\INC\\Philips\\LPC22xx.H"

 
#line 428 "C:\\Keil\\ARM\\INC\\Philips\\LPC22xx.H"

 





#line 2 "UART1.C"







 
#line 23 "UART1.C"

 
#line 38 "UART1.C"


void uart4_init(unsigned int _baudrate);
void uart4_putc(char c);
void uart4_puts(char *p);
void uart3_init(unsigned int _baudrate);
void uart3_putc(char c);
void uart3_puts(char *p);
void uart0_init(unsigned int _baudrate);
void uart0_putc(char c);
void uart0_puts(char *p);







void uart4_init(unsigned int _baudrate)
{
    unsigned short u4dl;    
    u4dl = 11095300/(16*_baudrate);    
 	(*((volatile unsigned char *) 0x8100001C)) = 0x00000083;		
    (*((volatile unsigned char *) 0x81000000)) = u4dl & 0xFF;    
    (*((volatile unsigned char *) 0x81000004)) = (u4dl>>8);      
    (*((volatile unsigned char *) 0x8100001C)) = 0x00000003;		
}



void uart4_putc(char c)
{
	while(!((*((volatile unsigned char *) 0x81000014)) & 0x20)); 
	(*((volatile unsigned char *) 0x81000000)) = c;  
}



void uart4_puts(char *p)
{
	while(*p) 
	{
		uart4_putc(*p++);   
	}
}



void uart3_init(unsigned int _baudrate)
{
	unsigned short u3dl;
    u3dl = 11095300/(16*_baudrate); 

	(*((volatile unsigned char *) 0x8100009C)) = 0x00000083;		
    (*((volatile unsigned char *) 0x81000080)) = u3dl & 0xFF;    
    (*((volatile unsigned char *) 0x81000084)) = (u3dl>>8);      
    (*((volatile unsigned char *) 0x8100009C)) = 0x00000003;		
}



void uart3_putc(char c)
{
	while(!((*((volatile unsigned char *) 0x81000094)) & 0x20)); 
	(*((volatile unsigned char *) 0x81000080)) = c; 
	
}



void uart3_puts(char *p)
{
	while(*p) 
	{
		uart3_putc(*p++);  
	
	}
}
void uart0_init(unsigned int _baudrate)
{
	unsigned short u0dl;
    u0dl = 30000000/(16*_baudrate); 
    (*((volatile unsigned long *) 0xE002C000)) |= 0x00000005;	
	(*((volatile unsigned char *) 0xE000C00C)) = 0x00000083;		
    (*((volatile unsigned char *) 0xE000C000)) = u0dl & 0xFF;    
    (*((volatile unsigned char *) 0xE000C004)) = (u0dl>>8);      
    (*((volatile unsigned char *) 0xE000C00C)) = 0x00000003;		
}



void uart0_putc(char c)
{
	while(!((*((volatile unsigned char *) 0xE000C014)) & 0x20)); 
	(*((volatile unsigned char *) 0xE000C000)) = c; 
}



void uart0_puts(char *p)
{
	while(*p) 
	{
		uart0_putc(*p++);  
	}
}
int main(void)
{	 
	(*((volatile unsigned char *) 0xE01FC1A0)) = 0x03;
   	(*((volatile unsigned long *) 0xE002C014))=0x0E6149E4;

   	uart0_init(9600);							     
 	uart3_init(9600);	
	uart4_init(9600); 	
	
		{
		
		uart3_puts("Test UART3\r\n");	
		uart4_puts("Test UART4\r\n");	
		
		

 		}

 }

⌨️ 快捷键说明

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