标签:void include nbsp end 数据类型转换 sprint float char clu
示例程序:
#include <stdio.h>
.
.
void UART_send_byte(char dat);
void UART_send_string(unsigned char *buf);
.
unsigned char TX_Buf[10];
sprintf(TX_Buf,"D%f",Distance);
UART_send_string(TX_Buf);
Delay_ms(500);
/*
* UART 发送一字节
*/
void UART_send_byte(char dat)
{
SBUF = dat;
while (TI == 0);
TI = 0;
}
/*
* UART 发送字符串
*/
void UART_send_string(unsigned char *buf)
{
while (*buf != ‘\0‘){
UART_send_byte(*buf++);
}
}
标签:void include nbsp end 数据类型转换 sprint float char clu
原文地址:http://www.cnblogs.com/MAQI/p/7442233.html