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

📄 main.c

📁 RS232 GPS模块BR-355接收和解析gps数据的例子
💻 C
字号:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "gps.h"
#include "2410addr.h"
#include "2410lib.h"
#include <string.h>
#include <stdarg.h>
#include "def.h"

void rpt_packet(TSIPPKT *rpt,char *obuf);
void tsip_input_proc(TSIPPKT *rpt,char inbyte);
void gps_output(void);


void xmain(void)
{
    char newbyte;
   
    ChangeClockDivider(1,1);            // 1:2:4
    ChangeMPllValue(0xa1,0x3,0x1);      // FCLK=202.8MHz
    Port_Init();
    
    Uart_Select(1);
    Uart_Init(0,9600);
    
    Uart_Printf("GEC2410 GPS test beginning\n");
   GPS_win();   
   while(1)
   {
    newbyte=Uart_GetKey();      //UART1 receive data
                           
         tsip_input_proc(&gRpt,newbyte);             //analyse
         if(gRpt.status==TSIP_PARSED_FULL)           //receive complete
         {
            rpt_packet(&gRpt,outbuf);                //output reports

            gps_output();

            gRpt.status=TSIP_PARSED_EMPTY;           //prepare for next
         }
   }   
}



void Gps_Output(void)
{

	Uart_Printf("\nthe latitude is %c",Pos.latdir);
	Pos.lat[10] = 0;
	Uart_Printf("\n%d",Pos.lat);	
	Uart_Printf("\nthe longitude is %c",Pos.londir);
	
	
	Pos.lon[10] = 0;	
	drawascii168(120,100,tempstr,rgb(255,255,0));
	
	fillrectangle(172,84,258,105,rgb(0,0,255));
	drawascii168(175,100,Pos.lon,rgb(255,255,0));
	
	sprintf(tempstr,"%c",Pos.altdir);
	
}

void gps_output(void)
{

	char tempstr[5];
	;	
	
	sprintf(tempstr,"%c",Pos.londir);
	
	Pos.lon[10] = 0;	
	drawascii168(120,100,tempstr,rgb(255,255,0));
	
	fillrectangle(172,84,258,105,rgb(0,0,255));
	drawascii168(175,100,Pos.lon,rgb(255,255,0));
	
	sprintf(tempstr,"%c",Pos.altdir);
	
}

⌨️ 快捷键说明

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