Hi Samuel
You may have got it going by now but here is some info.
I used an LPC925 which I believe is similar as far as the UART is concerned. I
set the txd pin to be quasi-bi (push/pull would probably work as well) I think
you may have an error in your th1 reload value. I calculate 232 or E8h for
SMOD1=1 and 244 or F4h for SDOD1=0. I used the 925 user's manual for this, its
got lots of info.
Here's an initialisation I've used (in assembler) successfully up to 230.4k
baud.
anl p1m1,#11111110b ; p1.0 (TXD) quasi bi
mov scon,#50h ; set up serial port in mode 1
orl pcon,#80h ; set smod for max baud rate
mov tmod,#20h ; timer 1 mode 2 (8 bit auto reload)
mov th1,#232 ; reload value for 9600 with 7.373 MHz clk
setb tr1 ; start timer 1 running
I hope this is of some help.
Regards Jon
--- In lpc900_users@yahoogroups.com, "SR" <emddjava@...> wrote:
>
> Hi
>
> I am using LPC938, I am trying to get the UART's baudrate to 9600 but nothing
seems to work..I the following code and all I see on hyperterm is just various
ASCII characters.
>
> EA = 0;
> TR1 = 0; /* stop timer 1 */
> ET1 = 0; /* disable timer 1 interrupt */
>
> TH1 = 0xFC; //(unsigned char) (256 - (clock / (16L * 12L * baudrate)));
>
> PCON |= 0x80; /* 0x80=SMOD: set serial baudrate doubler */
>
> TMOD &= ~0xF0; /* clear timer 1 mode bits */
> TMOD |= 0x20; /* put timer 1 into MODE 2 */
> SCON = 0x50;
>
> TR1 = 1; /* start timer 1 */
>
>
> INT_ENABLE;
>
>
> EA = 1;
>
> Samuel
>