??? 01/16/08 18:59 Read: times |
#149586 - Serial communication problem |
#include <stdio.h>
#include "P89LPC952.h" void Uart_Init(void) { P1M1 = 0xFE; // Configure P1.0 (TxD) as Output (UART0) BRGR0_0 = 0x70; // 9600 baud, 8 bit, no parity, 1 stop bit BRGR1_0 = 0x01; BRGCON_0 = 0x03; S0CON = 0x52; // initialize UART 0 } static void ua_outchar(unsigned char c) { while(!TI_0); S0BUF = c; TI_0 = 0; } void PrintString(const unsigned char *s) { while (*s) { if (*s == '\n') ua_outchar('\r'); ua_outchar(*s); s++; } } void main(void) { // SYSTEM CLOCK = 3.6864 MHz DIVM = 0x01; TRIM &= ~0x04; AUXR1 |= 0x80; Uart_Init(); ES = 1; EA = 1; ua_outchar(0x61); // PrintString("Hello World\n"); while(1); } above is the simple code i am using to print on to hyper terminal. Problem i am getting is if i send 0x61('a')(=97) it displays symbol of beta(=225), basically it is difference of 128 means my sign bit is set to one, it happens with all the characters, Other things to note is this code works fine when i use LPC952 microcontroller, but it gives me above error once i start working with LPC954( LPC952 with 16 kb flash, instead of 8 kb), am i missing something? Thanks, |
Topic | Author | Date |
Serial communication problem | 01/01/70 00:00 | |
have you heard of formatting and comments? | 01/01/70 00:00 | |
I am sorry about formatting | 01/01/70 00:00 | |
if you remove the ISR and leave EA in, the uC will | 01/01/70 00:00 | |
I removed ES = 1, still same result. | 01/01/70 00:00 | |
How to post source code | 01/01/70 00:00 | |
few more notes | 01/01/70 00:00 | |
timing? | 01/01/70 00:00 | |
Andy, read my post | 01/01/70 00:00 | |
I did!![]() | 01/01/70 00:00 | |
why are you screwing with the trim? | 01/01/70 00:00 | |
Thanks everyone its was trim register | 01/01/70 00:00 | |
Hello, World | 01/01/70 00:00 |