??? 06/26/09 00:55 Read: times |
#166468 - Re: RTFM Responding to: ???'s previous message |
Try casting the constant to unsigned int. Code: //Declaration: xdata unsigned int data1=1; xdata unsigned int data2=1550; xdata unsigned int data3=15550; //Configure UART void serial_init(void) { T3CON = 0x83; //configure timer 3... T3FD = 0x12; //...for 9600 baud SCON = 0x50; TI=1; //Initialise to send } //Output to UART: printf("DATA 1:%un",data1); //Output result to UART printf("DATA 2:%un",data2); //Output result to UART printf("DATA 3:%un",data3); //Output result to UART //Note: the end of line command "%un" on above codes does not appear correctly when I post the message. Output on HyperTerminal: DATA 1:53925 DATA 2:53926 DATA 3:30127 ;-------------------------------------- Very strange result if I use "unsigned int" data instead of constant. |