Hi all, i'm trying to set the serial communication up with the Timer 2 (TR2) as baudrate generator . and 19200 Baud. I don't have any errors or warnings. I can't print nothing to the serial UART window.
Copi of my Code:
#include <REG668.H> #include <stdio.h> void Main(void){ // Init off UART EC = 0x01; // PCA(Program CounterArray) InterruptEnable. EA = 0x01; // Global disable bit. If EA = 0, all interrupts are disabled. If EA = 1, each interrupt can be individually enabled or disabled by setting or clearing its enable bit. T2CON = 0x30; // 0b00110000 // set timer 2 til baudrate generator. RCAP2H = 0xff; RCAP2L = 0xd9; TR2 = 0x01; // Start/stop control for Timer 2. A logic 1 starts the timer. saættes = 1 her og ikke i T2CON. S0CON = 0x50; // (Enhanced UART) UART0 mode 1, 8-bit, reception enable ( 0x50=80 Dec =01010000 binary) betyder at SM1=1 & REN=1 Resten er deafault 0 i S0CON registret se fig 32 i data blad. ES0 = 0x01; while (1) { P1 ^= 0x01; /* Toggle P1.0 each time we print */ printf ("Hello World\n"); /* Print "Hello World" */ } }
You didn't specify a chip, so people who are going to answer have to look at your include file to take a guess.
Have you done the normal verification of serial data? Did you get anything on the TX pin? What baudrate did you get?
What baudrate did you get?
ANY question re comunication that do not state the clock speed can not be answered.
Erik