Professional Documents
Culture Documents
LAB 2: Using UART of LPC2148 for serial reception and transmission from/to
computer
Objective: Write a program to display string on hyper terminal and receive back
character.
Part List:
Educational practice board for ARM7 LPC2148
All in One General Purpose Board (ASK25)
+9V Power supply
USB A to B type cable
20 pin flat cable
PC
Eclipse IDE
Flash Magic Utility
Hardware Connection:
Connect USB cable between PL3 connector of EPBARM7 and PC.
Included Files:
____________________________________________________________________________
Edutech Learning Solutions Pvt. Ltd. info@edutechlearning.com
Laboratory workbook for Advanced Microprocessors (As per Pune University Syllabus)
Program Listing:
#include "lpc214x.h"
/* Function Declaration */
void Init_Uart0(unsigned long BaudRate);
void Uart0_Tx(char Data);
void Uart0_String(char *Data);
char Uart0_Rx(void);
/* Main Program */
int main(void)
{
char rdata;
Init_Uart0(9600); // UART0
initialized with Baudrate=9600
Uart0_Tx('A'); //
Transmit single character using UART0
Uart0_String(" UART0 Demo Program \n\r");// Transmit String
using UART0
Uart0_String(" \n\r"); // Transmit
String using UART0
Uart0_String(" Type any Character on HyperTerminal or
Teraterm \n\r");// Transmit String using UART0
while(1)
{
rdata = Uart0_Rx(); //
Receive character from UART0 input from HyperTerminal or Teraterm
Uart0_Tx(rdata); // Transmit
the same character received from HyperTerminal or Teraterm
}
}
/******************************************************************
*********
UART0 Functions
*******************************************************************
***********/
/** This Program initialize the UART0 **/
void Init_Uart0(unsigned long BaudRate)
{
unsigned int CountVal;
VPBDIV = 0X01;
// to choose pclk=cclk
____________________________________________________________________________
Edutech Learning Solutions Pvt. Ltd. info@edutechlearning.com
Laboratory workbook for Advanced Microprocessors (As per Pune University Syllabus)
Result:
String would be displayed on hyper terminal and character would be received from key board.
____________________________________________________________________________
Edutech Learning Solutions Pvt. Ltd. info@edutechlearning.com