LPCOpen Platform  v1.03
LPCOpen Platform for NXP LPC Microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
LPC8xx UART example

Detailed Description

Example description
The UART example demonstrates the transfer of data using the UART module. The data transfer will happen in a loop from UART0 to UART1 to UART0. The UART0 will operate in polling mode, while UART1 will work in interrupt mode. The data transmitted will be checked with data recived to verify the data transfer operation. If the data transfer is succesful, the RED LED on the board�will be turned on

Special connection requirements
Connect pins on the LPC812 XPresso board :
TX0 (P_0.4) (pin 5 on J7) -> RX1 (P_0.14) (pin 5 on J6)
TX1 (P_0.13) (pin 8 on J6) -> RX0 (P_0.0) (pin 4 on J7)

Build procedures:
LPC8xx example quickstart for IAR EWARM
LPC8xx example quickstart for Keil uVision4
LPC8xx example quickstart for Code Red Xpresso

Supported boards and board setup:
NXP Xpresso LPC812 board

Submitting LPCOpen issues:
Community support for LPCOpen

Macros

#define BUFFER_SIZE   0xF
 
#define UART_TEST_DEFAULT_BAUDRATE   115200
 
#define UART_TEST_REPEAT_NUMBER   0xF
 

Functions

static void bufferInit (uint8_t seed)
 
static void bufferCheck ()
 
static void App_UART_Init (LPC_USART_T *pUART)
 
void UART1_IRQHandler (void)
 Handle interrupt from UART.
 
int main (void)
 Application main function.
 

Variables

static uint8_t TxBuf0 [BUFFER_SIZE]
 
static uint8_t RxBuf1 [BUFFER_SIZE]
 
static uint8_t RxBuf0 [BUFFER_SIZE]
 
static uint32_t RxBufCnt1 = 0
 
static uint32_t TxBufCnt1 = 0
 
static volatile bool receiveCompleted = true
 
static volatile bool sendCompleted = true
 

Macro Definition Documentation

#define BUFFER_SIZE   0xF

Definition at line 66 of file uart.c.

#define UART_TEST_DEFAULT_BAUDRATE   115200

Definition at line 67 of file uart.c.

#define UART_TEST_REPEAT_NUMBER   0xF

Definition at line 68 of file uart.c.

Function Documentation

static void App_UART_Init ( LPC_USART_T pUART)
static

Definition at line 111 of file uart.c.

static void bufferCheck ( )
static

Definition at line 98 of file uart.c.

static void bufferInit ( uint8_t  seed)
static

Definition at line 87 of file uart.c.

int main ( void  )

Application main function.

Main program body.

Returns
Does not return
Note
This function will not return

defined(CHIP_LPC175X_6X)

Definition at line 167 of file uart.c.

void UART1_IRQHandler ( void  )

Handle interrupt from UART.

Returns
Nothing

Definition at line 127 of file uart.c.

Variable Documentation

volatile bool receiveCompleted = true
static

Definition at line 75 of file uart.c.

uint8_t RxBuf0[BUFFER_SIZE]
static

Definition at line 72 of file uart.c.

uint8_t RxBuf1[BUFFER_SIZE]
static

Definition at line 71 of file uart.c.

uint32_t RxBufCnt1 = 0
static

Definition at line 73 of file uart.c.

volatile bool sendCompleted = true
static

Definition at line 76 of file uart.c.

uint8_t TxBuf0[BUFFER_SIZE]
static

Definition at line 70 of file uart.c.

uint32_t TxBufCnt1 = 0
static

Definition at line 74 of file uart.c.