📄 text2.bak
字号:
#include "COM.H"
union unionSend
{
unsigned char Sendstring[56];
struct structSend
{
unsigned int head;//两字节头
float Lat;//纬度
float Lgt;
float Hlg;//高度
float Yaw;
float Pitch;
float Roll;
float wx;//x角速度
float wy;
float wz;
float wax;//x角加速度
float way;
float waz;
long int GPStime;//时间hhmmss
unsigned int CheckValue;//两字节校验
}s1;
}Sendunion;
int ReceiveDone=0;
long int com1Count=0;
long int com1Rx_len =0;
void main(void)
{
unsigned char key=0;
Sendunion.s1.head=0xffff;
Sendunion.s1.Lat=33.0;
Sendunion.s1.Lgt=108.0;
Sendunion.s1.Hlg=393.0;
Sendunion.s1.Yaw=150.0;
Sendunion.s1.Pitch=0.1;
Sendunion.s1.Roll=2;
Sendunion.s1.wx=1.5;
Sendunion.s1.wy=1.5;
Sendunion.s1.wz=1.5;
Sendunion.s1.wax=1.5;
Sendunion.s1.way=1.5;
Sendunion.s1.waz=1.5;
Sendunion.s1.GPStime=112233;
Sendunion.s1.CheckValue=CRC16(Sendunion.Sendstring,54);
clrscr();
gotoxy(70,25); printf("Quit !");
OpenCOM(COM2, BAUD_115200,
PARITY_NO|STOP_BIT1|DATA_BIT8, INT_MSK_TX|INT_MSK_RX);//open com2
while (key!='Q'&&key!='q')
{
if (kbhit())
key=getch();
if(!com2TXBusy)
{
StartSend(COM2, Sendunion.Sendstring,56);
gotoxy(10,8);
printf("Checkvalue:%u",Sendunion.s1.CheckValue);
gotoxy(10,12);
printf("GPS_Time:%ld",Sendunion.s1.GPStime);
gotoxy(10,14);
printf("POS:%10.6f %10.6f %10.6f",Sendunion.s1.Lat,Sendunion.s1.Lgt,Sendunion.s1.Hlg);
gotoxy(10,16);
printf("ATT:%10.6f %10.6f %10.6f",Sendunion.s1.Yaw,Sendunion.s1.Pitch,Sendunion.s1.Roll);
gotoxy(10,18);
printf("W:%10.6f %10.6f %10.6f",Sendunion.s1.wx,Sendunion.s1.wy,Sendunion.s1.wz);
gotoxy(10,20);
printf("Wa:%10.6f %10.6f %10.6f",Sendunion.s1.wax,Sendunion.s1.way,Sendunion.s1.waz);
gotoxy(40,22);
printf("TXnum:%d",com1TX);
}
}
CloseCOM(COM2);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -