main.c
来自「Hitex LPC2100 insider guide source code」· C语言 代码 · 共 61 行
C
61 行
#include <LPC21xx.H>
#include <stdio.h>
void UART0 (void);
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; //Set the VLSI Peripheral bus to Divide by 2
UART0 (); //Initilise the UART
while(1)
{
printf("Hello from the LPC2129 \n"); //Call the prinfF function
}
}
void UART0 (void)
{
PINSEL0 = 0x05; // Select TxD and RxD on pin connect block
U0LCR = 0x80; //Enable programming of divisor latches
U0DLL = 0x60; //Program the divisor latch for 19200 baud
U0DLM = 0x00;
U0LCR = 0x33; //Program the line control 8\N\1
U0FCR = 0x4F; //enable the FIFO's
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?