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.

serial transmission through LPC2138

Status
Not open for further replies.

hardik_297p

Newbie level 3
Newbie level 3
Joined
Apr 9, 2013
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,296
i am doing serial communication between ARM(lp2138) and Matlab,
so for that I first i trying to sent data on terminal, but i am not getting proper data on terminal
(here i am getting 0xF8 while i transmitting 0x41)

please kindly help me.


Code:
/*keil programm for transmitting data*/

#include <LPC213x.H>

int main(void)  {              

  PINSEL0 = 0x00050000;                  /* Enable RxD1 and TxD1              */
  U1LCR = 0x83;                          /* 8 bits, no Parity, 1 Stop bit     */
   U1DLL =71;
  U1DLM=0;
  U1FDR=131;                            /* 9600 Baud Rate @ 15MHz Clock  */
 U1LCR = 0x03;

 while (!(U1LSR & 0x60));
   U1THR=0x41;       /* transmitting 'a' */
i attached My proteus screenshot here

} proteus.png
 
Last edited by a moderator:

lpc2138 @12 MHz crystal

Code:
VPBDIV=4;
PINSEL0 = 0x00050000;    // Enable UART1
U1LCR=0X80;      //DLAB 1
U1DLM=0X0;	   //DLM 0X0  			   //9600 no parity 1 stop bit 8bit 
U1DLL=0X61;    //DLL 0X61
U1LCR=0X03;	   //DLAB 0X3


U1THR=0x41;											 
while (!(U1LSR & 0x20));
 
Thx for replay....ur code works.but still i am in confuse that by baudrate calculation formulae we get U1DLL=97(0x61) by 15Mhz. for 12Mhz it may be 78.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top