📄 main.c
字号:
//========================================================
// The information contained herein is the exclusive property of
// Sunnnorth Technology Co. And shall not be distributed, reproduced,
// or disclosed in whole in part without prior written permission.
// (C) COPYRIGHT 2003 SUNNORTH TECHNOLOGY CO.
// ALL RIGHTS RESERVED
// The entire notice above must be reproduced on all authorized copies.
//========================================================
//========================================================
// 工程名称: GPS_061A
// 功能描述: 通过GPS模块接收到的信息,显示时间,经纬度及在地图上定位当前位置.
// 涉及的库: CMacro1016.lib
// clib.lib
// 组成文件: main.c
// china.c china.h DataOSfortLCD.asm SPLC501Driver_IO.asm
// gps.c gps.h picture.c picture.h Key.c Key.h
// Queue.c uart.c
//
// 硬件连接: GPS 61板
// 电源------------电源
// 地------------地
// TX------------IOB7
// RX------------IOB10
// R4------------IOB8
//
// SPLC501 61板
// LCD D0~D7 --- 接IOA8~IOA15
// LCD EP ---- 接IOB6
// LCD RWP ---- 接IOB5
// LCD A0 ---- 接IOB4
// LCD /CS1 ---- 接IOB9 或接地也可
// IO高电平:3.3V
// 维护记录: 2007-08-9 v1.0
//
//========================================================
//========================================================
// 文件名称: main.c
// 功能描述: GPS定位
// 维护记录: 2007-08-9 v1.0
//========================================================
#include "spce061a.h"
#include "UART.h"
#include "gps.h"
#include "china.h"
#include "Key.h"
#include "./c501/SPLC501User.h"
#include "picture.h"
#define SIZE 16
//========================================================
// 语法格式: int CPU_Init(void)
// 实现功能: 初始化CPU时钟49MHz
// 参数: 无
// 返回值: 0
//========================================================
int Init_CPU()
{
*P_SystemClock = C_Fosc_49M | C_Fosc; // 设置系统时钟与CPU时钟全为49MHz
*P_INT_Ctrl_New = *P_INT_Ctrl_New | C_IRQ5_2Hz | C_IRQ5_4Hz ; // 打开2Hz中断用于滚动显示信息.
return 0;
}
//========================================================
// 语法格式: void Open_IRQ_2Hz()
// 实现功能: 打开2Hz中断
// 参数: 无
// 返回值: 无
//========================================================
void Open_IRQ_2Hz()
{
*P_INT_Ctrl_New |= C_IRQ5_2Hz ; // 打开2Hz中断用于滚动显示信息.
}
//========================================================
// 语法格式: void Close_IRQ_2Hz()
// 实现功能: 关闭2Hz中断
// 参数: 无
// 返回值: 无
//========================================================
void Close_IRQ_2Hz()
{
*P_INT_Ctrl_New &= ~ C_IRQ5_2Hz ; // 打开2Hz中断用于滚动显示信息.
}
//========================================================
// 语法格式: int main(void)
// 实现功能: GPS定位
// 参数: 无
// 返回值: 无
//========================================================
int main()
{
int Key;
unsigned int i;
Init_CPU();
Init_Key();
Init_UART();
Init_GPS();
LCD501_Init(5);
LCD501_ClrScreen(0);
LCD501_SetPaintMode(PAINT_COVER);
for(i = 0xff;i > 0;i --) // 凌阳科技DEMO, 仅供演示
{
*P_Watchdog_Clear=1;
LCD501_Bitmap(1 * SIZE, 1 * SIZE,encoding_23); // 演
LCD501_Bitmap(2 * SIZE, 1 * SIZE,encoding_24); // 示
LCD501_Bitmap(3 * SIZE, 1 * SIZE,encoding_25); // 程
LCD501_Bitmap(4 * SIZE, 1 * SIZE,encoding_26); // 序
LCD501_Bitmap(5 * SIZE, 1 * SIZE,encoding_27); // 严
LCD501_Bitmap(6 * SIZE, 1 * SIZE,encoding_28); // 禁
LCD501_Bitmap(1 * SIZE, 2 * SIZE,encoding_29); // 用
LCD501_Bitmap(2 * SIZE, 2 * SIZE,encoding_2a); // 于
LCD501_Bitmap(3 * SIZE, 2 * SIZE,encoding_2b); // 毕
LCD501_Bitmap(4 * SIZE, 2 * SIZE,encoding_2c); // 业
LCD501_Bitmap(5 * SIZE, 2 * SIZE,encoding_2d); // 设
LCD501_Bitmap(6 * SIZE, 2 * SIZE,encoding_2e); // 计
}
LCD501_ClrScreen(0);
while(1)
{
*P_Watchdog_Clear = 1;
LCD501_Bitmap(2 * SIZE, 1 * SIZE,encoding_10); // 凌
LCD501_Bitmap(3 * SIZE, 1 * SIZE,encoding_11); // 阳
LCD501_Bitmap(4 * SIZE, 1 * SIZE,encoding_12); // 科
LCD501_Bitmap(5 * SIZE, 1 * SIZE,encoding_13); // 技
LCD501_Bitmap(0.5 * SIZE, 2 * SIZE,encoding_14); // G
LCD501_Bitmap(1.5 * SIZE, 2 * SIZE,encoding_15); // P
LCD501_Bitmap(2.5 * SIZE, 2 * SIZE,encoding_16); // S
LCD501_Bitmap(3.5 * SIZE, 2 * SIZE,encoding_17); // 定
LCD501_Bitmap(4.5 * SIZE, 2 * SIZE,encoding_18); // 位
LCD501_Bitmap(5.5 * SIZE, 2 * SIZE,encoding_19); // 系
LCD501_Bitmap(6.5 * SIZE, 2 * SIZE,encoding_1a); // 统
Key=Key_GetValue();
switch(Key)
{
case C_KEY1 :
Close_IRQ_2Hz(); // 关闭2Hz中断,在显示地图时并不显示流动信息.
Show_Map();
Open_IRQ_2Hz();
break;
case C_KEY2:
Show_Num();
break;
case C_KEY3:
Show_Time();
break;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -