MICROCONTROLLER AND EMBEDDED SYSTEMS LABORATORY Part B
Program 9 Display “Hello World” message using Internal UART. #include<lpc21xx.h> void Uart0Init(void) //initialize serial interface { PINSEL0=0X00000005; // enable RXD0 (P0.1) & TXD0 (P0.0) U0LCR = 0X83; // 8 bits, no parity, 1 stop bit U0DLL = 97; // 9600 Baud rate @ 15MHz PCLK U0LCR = 0X03; // DLAB = 0 } void Uart0PutCh(unsigned char ch) //write char to serial port { U0THR = ch; // Transmission hold register while(!(U0LSR & 0x20)); //checking whether the Char is completely transmitted, // TX= 0 or 1 // if tx bit =1 , complete transmission of a char to PC has been done } void uart_print(char *a) { int i; for(i=0;a[i]!='\0';i++) Uart0PutCh(a[i]); //one char at a time is transmitted using this function } int main() { Uart0Init(); // function call to initialize LPC2148 uart_print("Hello World"); // function call to transmit the data to PC } Program explanation and Demo: UART Program 10 Interface and Control a DC Motor. //#define MOTOR 0x00000060...