A period of time to do Bluetooth communication, single-chip computer serial port to send the total display garbled characters, the code is as follows:
Send a Byte
void sendbyte (unsigned char dat)
{
sbuf = dat;
while (! TI);
TI = 0;
}
Send a string
void Sendstr (unsigned char *s)
{
while (*s!= ')
{
Sendbyte (*s);
s++;
}
}
Call Sendstr in the main function ("Current data is:");
Observe the serial debugging assistant display is a bunch of garbled characters, however, the Chinese character to English characters or numbers after the display is normal, which indicates that the sending part of the program should be no problem, and then the forum finally found a solution-the compiler bug. If you are still a Keil2 or Keil3 user, do not doubt your own code, this is a vulnerability of the low version Keil compiler, using the revised version of the KEIL4 V9.05 compiled hex file can be resolved. The following is the download address of Keil 4v9.05, with the registration machine, I hope to meet the same problem of friends can be helpful.
Download Address:
1.http://download.csdn.net/detail/rtgchym/4156118
2.http://dl.dbank.com/c0lbyrebao