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

📄 uart3.c

📁 ADuC系列芯片的源代码事例
💻 C
字号:
/*********************************************************************

 Author        : ADI - Apps            www.analog.com/MicroConverter

 Date          : Sept. 2005

 File          : UART3.c

 Hardware      : Applicable to ADuC702x rev H or I silicon
                 Currently targetting ADuC7026.

 Description   : This code demonstrates basic UART functionality.
				 The baudrate is calculated with the following formula:
 
					DL = HCLK										   
						_______										   
						Baudrate * 2 *16							   
                                          																   
***********************************************************************/

#include <ADuC7026.h>
#include"stdio.h" 	

void delay(int);

int main (void)  {

	// Setup tx & rx pins on P1.0 and P1.1
	GP1CON = 0x011;
   	// Start setting up UART at 9600bps
   	COMCON0 = 0x080;				// Setting DLAB
   	COMDIV0 = 0x088;				// Setting DIV0 and DIV1 to DL calculated
   	COMDIV1 = 0x000;
   	COMCON0 = 0x007;				// Clearing DLAB

	GP4DAT = 0x04000000;			// P4.2 configured as an output. LED is turned on
  	printf ("Hello World\n");       // printf function call   

while (1)
	{
	GP4DAT ^= 0x00040000;		// Complement P4.2
	delay(200000);
	}				
}

void delay (int length)
{
	while (length >=0)
    	length--;
}

⌨️ 快捷键说明

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