Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] lpc2148 uart problem

Status
Not open for further replies.

aswathymohan

Member level 4
Member level 4
Joined
Nov 11, 2012
Messages
68
Helped
5
Reputation
10
Reaction score
5
Trophy points
1,288
Visit site
Activity points
1,727
hi i wrote a uart program in keil.But it gives no simulation results on proteus.Can anyone help me pl...
Code:
 #include "LPC214x.H"    // LPC2148 MPU Register
#include <stdio.h>                                 // For Used Function printf

/* pototype  section */
void init_serial0 (void);                            // Initil UART-0
                                    // ADC Result Volt
int main(void)
{ 
  init_serial0();                                    // Initial UART0 = 9600,N,8,1
  printf("Input Voltage 0-3.3V to P0.6 For Test\n");       // Call prinff Function
  // xxxx xxxx xxxx xxxx xx11 xxxx xxxx xxxx
}
void init_serial0 (void) 
{
  PINSEL0 &= 0xFFFFFFF0;                           // Reset P0.0,P0.1 Pin Config
  PINSEL0 |= 0x00000001;                           // Select P0.0 = TxD(UART0)
  PINSEL0 |= 0x00000004;                           // Select P0.1 = RxD(UART0)

  U0LCR &= 0xFC;                                 // Reset Word Select(1:0)
  U0LCR |= 0x03;                                 // Data Bit = 8 Bit
  U0LCR &= 0xFB;                                 // Stop Bit = 1 Bit
  U0LCR &= 0xF7;                                 // Parity = Disable
  U0LCR &= 0xBF;                                 // Disable Break Control
  U0LCR |= 0x80;                                 // Enable Programming of Divisor Latches

  // U0DLM:U0DLL = 60.00 MHz / [16 x Baud]
  //             = 60.00 MHz / [16 x 9600]
  //             = 390.6 = 391 = 0187H
  U0DLM = 0x01;                                    // Program Divisor Latch(391) for 9600 Baud
  U0DLL = 0x87;

  U0LCR &= 0x7F;                                 // Disable Programming of Divisor Latches

  U0FCR |= 0x01;                                 // FIF0 Enable
  U0FCR |= 0x02;                                 // RX FIFO Reset
  U0FCR |= 0x04;                                 // TX FIFO Reset
  U0FCR &= 0x3F;                     
}
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top