ARM Development Board-LPC2129
/*
* Project name:
ARM Development Board-LPC2129
* Copyright
(c) Researchdesignlab.com
* Description:
* Test configuration:
MCU: LPC2129
Dev.Board: LPC2129 mini
Oscillator: 12 MHz
Software: Keil uVision4
*/
#include <LPC21xx.H> /* LPC21xx definitions */
#define CR 0x0D
void init_serial (void) { /* Initialize Serial Interface */
PINSEL0 = 0x00050000; /* Enable RxD1 and TxD1 */
U1LCR = 0x83; /* 8 bits, no Parity, 1 Stop bit */
U1DLL = 97; /* 9600 Baud Rate @ 15MHz VPB Clock */
U1LCR = 0x03; /* DLAB = 0 */
}
/* implementation of putchar (also used by printf function to output data) */
void sendchar (int ch) { /* Write character to Serial Port */
U1THR=ch;
while(!(U1LSR&0X20));
}
int getkey (void) { /* Read character from Serial Port */
while (!(U1LSR & 0x01));
return (U1RBR);
}
void TRANSMIT_UART1(unsigned char *P)
{ /* Write string to Serial Port */
while(*P){
U1THR=*P;
while(!(U1LSR&0X20));
P++;}
}
void Delay()
{
unsigned int X=1000000;
while(X--);
}
int main()
{
init_serial();
Delay();
Delay();
TRANSMIT_UART1("Researchdesignlab.com");
sendchar(10);
sendchar(13);
while(1)
{
sendchar(getkey());
}
}