?? ggamnq.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 + -