??? 06/25/09 12:42 Read: times |
#166453 - printf only can output value from 256 to 32767 correctly Responding to: ???'s previous message |
Hi,
I have tried to send the data (unsigned char) to HyperTerminal by using printf as mentioned in previous posts. printf("Data 1:%un",255); //Output result to UART printf("Data 2:%un",32768); //Output result to UART printf("Data 3:%un",32000); //Output result to UART I found out that if I send the data value in between: a. 256 to 32767, I will get correct result on the PC's terminal. b. 255 and less than, I will get garbage on the terminal (e.g. if 255, get 65535, or if 254 get 512) c. 32768 and more than, I get 0 on the terminal. Anyone can have any idea, please advice? Thanks. Note that I am using Keil uVsion3. |