📄 main.c
字号:
#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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -