⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ggamnq.txt

📁 MNEA-0183格式输出的GGA模拟代码
💻 TXT
字号:
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <dos.h>
#include <graphics.h>
#include <math.h>
#include <string.h>
#include <process.h>
#include <time.h>
#define 	COM1	0x3F8
#define 	EO1	0x20
#define 	IER	1
#define 	IIR	2
#define 	LCR	3
#define 	MCR	4
#define 	LSR	5
#define 	MSR 	6
void  init serial_com1(int brdl)
{      int tmp;
       outportb(COM1+IER,0x00);
       outportb(COM1+LCR,0x80);
       outportb(COM1,brdl);
       outportb(COM1+IER,0x00);
       outportb(COM1+MCR,0x09);
       outportb(COM1+LCR,0x03);
       outportb(COM1+IER,0x01);
       tmp=inportb(0x21);
       tmp&=0xEF;
       outportb(0x21,tmp);
       enable();
}
void main()
{     int i,k,want_exit,decpnt;
       unsigned char ggabuff[100],gsvbuff[100];
       double lat,lon;
       char kch,*out;
       int driver,mode;
       driver=DETECT;
       mode=0;
       init serial_com1(24); /*波特率9600*/
       want_exit=0;
       kch=' ';
       lat=2137.25123534;
       lon=10819.74223573;
       printg("Please input datalenth:")
       scanf("%d",&decpnt);
star: strcpy(ggabuff,"$GPGGA,080000,");
       gevt(lat,decpnt+4,out);
       streat(ggabuff,out);
       streat(ggabuff,",N,");
       gevt(lon,decpnt+5,out);
       streat(ggabuff,",E,2,,,,,");
       i=strlen(ggabuff);
       ggabuff[i+1]-0x0D;
       ggabuff[i+2]-0x0A;
       delay(1000);
       for(k=0;k<i-3;k++)
       {	outportb(COM1,ggabuff[k]);
	delay(400);
 	printf("%c",ggabuff[k]);
       }
       strcpy(gsvbuff,"$GPCSV,1,1,4,01,45,000,46,06,30,090,45,13,40,180,47,24,36,30,270,48");
       i=strlen(gsvbuff);
       gsvbuff[i][1]=0x0D;
       gsvbuff[i][2]=0x0A;
       for(k=0;k<i+3;k++)
       {	outportb(COM1,gsvbuff[k]);
	delay(100);
 	printf("%c",gsvbuff[k]);
       }
       goto star;

end: restorecrtmode();
       outportb(COM1+IER,0x00);
       gotoxy(1,23);
       printf("All done.\r\n");
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -