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

📄 main.c

📁 通过车载终端采集GPS数据
💻 C
字号:
#include "typedef.h"
#include "nf_drv.h"
#include "mcuInit.h"
#include "uart1.h"
#include "display.h"
#include "struct_def.h"
#include <string.h>
#include "gps.h"
#include "led.h"
#include "keyboard.h"
#include "菜单.h"
#include "gps_collect.h"
#include "16c554.h"
#include "stdio.h"
extern Uchar volatile xdata D12_Y1;
extern idata Uchar D16CS;//D12_Y1的寄存器
extern GPS_LINE_INFO gps_8line[8];
extern unsigned char cur_direction;

//0:主界面;1:菜单界面;11:线路选择界面;13:删除信息;14:上传至电脑
extern unsigned char cur_menu_status;
extern unsigned char gps_OK;
extern unsigned int timegps;
extern Uchar volatile xdata D12_Y5;
extern idata Uchar D18CS;//D12_Y5的寄存器
unsigned char station_key=0;
unsigned char  corner_key=0;
void delayMs(unsigned int timeMs)
{
    unsigned int i, ms;
    for(ms=0; ms<timeMs; ms++)
        for(i=0; i<319; i++); 

}
void main()
{
	unsigned char key,light;
    ROMCON = 0xf;
    P4CONA = 0;
    P4CONB = 0;
    P4 = 0xf;
    /****************/
    nf_init();
    D16CS |= 0x70;
    D12_Y1 = D16CS; 
    init_77e532();    
	delayMs(200);
    mcu_init();
    uart1_init();
   
    IP = 0x14;
    EA = 1;     /*允许中断*/
	delayMs(200);
    D18CS = 0x03;
    D12_Y5 = D18CS;
    tl16c554_init();
	sysinit();
	gps_OK=0;
	lcd_init();
	menu_main();
	cur_menu_status=0;
    while (1)
    {
        led_process();
		if(gps_process())
		{
			timegps=0;
			gps_OK=1;
			menu_main();
		}
		else if(timegps>200&&gps_OK==1)
		{
			station_key=0;
			corner_key=0;
			gps_OK=0;
			timegps=0;
			menu_main();
		}
		key=get_key();
		switch(key)
		{
			
			case KEY_CODE_NUM1:	  	//存站点
				station_key=1;
			//	menu_main();
				cur_menu_status=0;
			
			break;

			case KEY_CODE_NUM2:		//存拐弯点
				corner_key=1;
			//	menu_main();
				cur_menu_status=0;
			
			break;

			case KEY_CODE_NUM6:		//上下行切换
				if(cur_direction==24)
				{
					cur_direction=25;
				}
				else if(cur_direction==25)
				{
					cur_direction=24;
				}

				menu_main();
				cur_menu_status=0;
			
			break;

			case KEY_CODE_MENU:	  	//进入菜单界面
				cur_menu_status=1;
				main_process();	 //菜单界面处理函数
				menu_main();
				cur_menu_status=0;
			break;

			case KEY_CODE_FUNC:	  	//@键开关背光

			  	if(light)
				{
				   	light=!light;
					D16CS &= 0xbf;
				   	D12_Y1 = D16CS;
				}
				else
				{
				   	light=!light;
				    D16CS |= 0x70;
				    D12_Y1 = D16CS; 
				}
			
            
			break;

			case KEY_CODE_ESC:
			case KEY_CODE_ENTER:
				menu_main();
				cur_menu_status=0;
			break;

			default:
			break;

		}
    }
   
}

⌨️ 快捷键说明

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