??? 01/16/08 19:30 Read: times |
#149596 - I am sorry about formatting Responding to: ???'s previous message |
I am sorry i forgot to add tags, here is the code with tags. ES and EA are there because i started working on interrupt driven code but as that was not working i strip down the code.#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(); //Initialize UART 0 ES = 1; EA = 1; ua_outchar(0x61); // PrintString("Hello World\n"); while(1); } |
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 |