void init_uart(void) { // C/T2 = 0 (Interne Frequenz benutzen) SCON = 0x50; // 0x50; // Mode 1 (8-bit xmit, no stop bit etc, enable reception) RCLK = 1; // Use Timer 2 as Reference TCLK = 1; // Use Timer 2 as Reference // Calculated with formula: 65536 - (OszFreq / ( IIf(Cycles=6,16,32) * Baud Rate)) -- OszFreq = 18432000, Cycles=12 // 2400 Baud ==> FF10 // 9600 Baud ==> FFC4 // RCAP2L = 0x10; // RCAP2H = 0xFF; RCAP2L = 0xC4; RCAP2H = 0xFF; TR2 = 1; // Timer 2 run ES = 1; // Enable serial interrupt EA = 1; // Enable general interrupts }