main.c

来自「Hitex LPC2100 insider guide source code」· C语言 代码 · 共 61 行

C
61
字号


#include <LPC210x.H> 
#include <stdio.h>

void UART0 (void);

unsigned char string[] = {"hello world \n"};
unsigned char i;

int main(void)
{


PLLCFG = 0x03;				// Set multiplier and divider of PLL
PLLCON = 0x01;				// Enable the PLL

PLLFEED = 0xAA;				// Update PLL registers
PLLFEED = 0x55;

while (!(PLLSTAT & 0x400)) 	// test Lock bit
{
PLLFEED = 0xAA;				// not sure if this is necessary
PLLFEED = 0x55;
}
PLLCON = 0x03;				// Connect the PLL

PLLFEED = 0xAA;				//Update PLL registers
PLLFEED = 0x55;

VPBDIV = 0x02;

UART0 ();

while(1)
{
printf("Hello World \n");

}

}

void UART0 (void)
{
PINSEL0 = 0x05; 		// Select TxD and RxD on pin connect block
UART0_LCR = 0x80;		//Enable programming of divisor latches

UART0_DLL = 0x60;		//Program the divisor latch for 19200 baud
UART0_DLM = 0x00;

UART0_LCR = 0x33;		//Program the line control 8\N\1
UART0_FCR = 0x4F;		//enable the FIFO's
			//enable interrupt
}






⌨️ 快捷键说明

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