📄 test2.c
字号:
#include "COM.H"
#define PackLength 58
unsigned char time[]="112233";
union unionSend
{
unsigned char Sendstring[PackLength];
struct structSend
{
unsigned short int head;// 帧头0xff 2
float Lat;// 纬度 4
float Lgt;// 4
float Hlg;// 高度 4
float Yaw;// 4
float Pitch;// 4
float Roll;// 4
float wx;//x角速度 4
float wy;// 4
float wz;// 4
float wax;// x角加速度 4
float way;// 4
float waz;// 4
unsigned char GPStime[6];// 时间hhmmss // 6
unsigned int CheckValue;// 两字节校验 // 2
}s1;
}Sendunion;
void GiveValue(void)
{
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;
memcpy(Sendunion.s1.GPStime,time, 6*sizeof(char));
Sendunion.s1.CheckValue=CRC16(Sendunion.Sendstring,PackLength-2);
}
void main(void)
{
unsigned char key=0;
clrscr();
GiveValue();
gotoxy(70,25); printf("Quit !");
outportb(0x20,0x20); //clear interrupt ask
OpenCOM(COM2, BAUD_115200, PARITY_NO|STOP_BIT1|DATA_BIT8, INT_MSK_TX|INT_MSK_RX);
while (key!='Q'&&key!='q')
{
if (kbhit())
key=getch();
if(!com2TXBusy)
{
// delay(1) ;
StartSend(COM2, Sendunion.Sendstring,58);
gotoxy(10,14);
printf("TXnum:%d",com2TX);
// delay(1);
// delay(1);
}
}
CloseCOM(COM2);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -