This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

printf() in Keil C166

Hello,

I want to transmit data over serial port with printf() and meet a strange thing.

Code 1:

unsigned char buf1[] = {0xAA, 0x52, 0xCC, 0x33, 0xC3, 0x3C, '\0'};
printf("%s", buf1);


Data will NOT be transmitted.

Code 2:

unsigned char buf1[] = {0xAA, 0x52, 0xCC, 0x33, 0xC3, 0x3C, '\0'};
ASC0_vSendData(0x12);
printf("%s", buf1);

void ASC0_vSendData(uword uwData)
{
  ASC0_TBIC_IR = 0;        //  reset transmit buffer interrupt request
  ASC0_TBUF    = uwData;   //  load transmit buffer register
}


Data will be transmitted successfully (0x12, 0xAA, 0x52, 0xCC, 0x33, 0xC3, 0x3C). I just can't understand why ASC0_vSendData() has to be called before printf(). Can anybody help me?

Thanks
Senmeis