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
"then you can not use any of the 'C' string handling functions!"
Note that this is standard, 'C' textbook stuff - nothing specific to Keil or the C166 or embedded...