串口显示出来的数总是不对就是printf那三句,应该怎么写?,帮忙分析一下[mw_shl_code=c,true]#include "led.h"
#include "delay.h"
#include "sys.h"
#include "usart.h"
#include "lcd.h"
#include "usart2.h"
#include "gps.h"
#include "string.h"
#include "key.h"
u8 USART1_TX_BUF[USART2_MAX_RECV_LEN]; //串口1,发送缓存区
nmea_msg gpsx; //GPS信息
__align(4) u8 dtbuf[50]; //打印缓存器
const u8*fixmode_tbl[4]={"Fail","Fail"," 2D "," 3D "}; //fix mode字符串
//显示GPS定位信息
void Gps_Msg_Show(void)
{
float tp;
POINT_COLOR=BLUE;
tp=gpsx.longitude;
sprintf((char *)dtbuf,"Longitude:%.5f %1c ",tp/=100000,gpsx.ewhemi); //得到经度字符串
LCD_ShowString(30,90,200,16,16,dtbuf);
printf("%d",*dtbuf);
tp=gpsx.latitude;
sprintf((char *)dtbuf,"Latitude:%.5f %1c ",tp/=100000,gpsx.nshemi); //得到纬度字符串
LCD_ShowString(30,110,200,16,16,dtbuf);
printf("%d",*dtbuf);
tp=gpsx.altitude;
sprintf((char *)dtbuf,"Altitude:%.1fm ",tp/=10); //得到高度字符串
LCD_ShowString(30,130,200,16,16,dtbuf);
printf("%d",*dtbuf);
tp=gpsx.speed;
sprintf((char *)dtbuf,"Speed:%.3fkm/h ",tp/=1000); //得到速度字符串
LCD_ShowString(30,150,200,16,16,dtbuf); [/mw_shl_code]
|