C Code - Philips AN10369 Application Note

Uart/spi/i2c code examples
Table of Contents

Advertisement

Philips Semiconductors
This value needs to be entered into the U0DLL register as shown below.

2.2 C Code

/* Include header file depending upon device been used */
#include"LPC2....h"
void Initialize(void);
/* Macro Definitions */
#define TEMT
#define LINE_FEED
#define CARRIAGE_RET
/************************* MAIN *************************/
int main()
/*************** System Initialization ***************/
void Initialize()
Application note
(1<<6)
0xA
0xD
{
int i;
char c[]="Philips LPC";
Initialize()
/* Print forever */
while(1)
{
i=0;
/* Keep Transmitting until Null character('\0') is reached */
while(c[i])
{
U0THR=c[i];
i++;
}
U0THR=LINE_FEED;
U0THR=CARRAIGE_RET;
/* Wait till U0THR and U0TSR are both empty */
while(!(U0LSR & TEMT)){}
}
}
{
/* Initialize Pin Select Block for Tx and Rx */
PINSEL0=0x5;
/* Enable FIFO's and reset them */
U0FCR=0x7;
/* Set DLAB and word length set to 8bits */
U0LCR=0x83;
Rev. 01 — 06 April 2005
Philips ARM LPC microcontroller family
© Koninklijke Philips Electronics N.V. 2005. All rights reserved.
AN10369
4 of 17

Advertisement

Table of Contents
loading

Table of Contents