HI : if I use these codes the "printf" don't work: { SCON = 0x50; TMOD |= 0x22; TCON = 0x40; TH1 = 0xFD; //TI = 1; printf(" thank you"); } BUT if I set TI to hight(TI = 1) ,the printf work fine ! why?
Hello HE Keil's default implimentation of printf calls putchar. putchar() as can be seen from putchar.c source waits for TI to go high prior to transmitting the first character. So as long as your using Keil's putchar function, you are going to need to set TI during initilization or before calling printf. Phil
/* * putchar (mini version): outputs charcter only */ char putchar (char c) { while (!TI); TI = 0; return (SBUF = c); }