本文主要是介绍51单片机GPS+sim800c GSM定位短信LCD1602液晶显示 原理图+PCB+源码,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
目录
1、实物图
2、原理图
3、PCB编辑
4、程序
资料下载地址:51单片机GPS+sim800c GSM定位短信LCD1602液晶显示 原理图+PCB+源码
1、实物图
2、原理图
3、PCB
4、程序
#include "common.h"
#include "uart.h"
#include "gps.h"
#include "gsm.h"#include "lcd.h"#define GPS_STR_LEN 48uchar ess_inc;//char xdata GPS_SEND_STR[GPS_STR_LEN];sbit key = P1^3;
sbit key1 = P1^4;
sbit GPS_EN=P3^4;
sbit led1 = P3^3;
#define RMC_YES led1 = 0
#define RMC_NO led1 = 1GPS_INFO GPS; //GPS信息结构体bit GPS_rx_flag = 0;
bit GPS_Have_flag = 0;#define SEND_NUMBER "AT+CMGS=\"13420106297\"\r\n"char xdata send_data[37]="N: ',E: ',2000-00-00,00:00\r\n";
unsigned char send_len= 0;bit dis_flag = 1;
bit sendflag=0;/****************************************
显示时间
/****************************************/
void GPS_DispTime(void)
{uchar i = 0;uchar ch;char time[5];Int_To_Str(GPS.D.year,time);//年LCD1602_Set_AC(0, 1);i = 0;send_len = 18;while(time[i] != '\0'){ch = time[i++];LCD1602_write_data(ch);send_data[send_len++] = ch;}LCD1602_write_data('-');Int_To_Str(GPS.D.month,time);//月LCD1602_Set_AC(5, 1);i = 0;send_len = 23;while(time[i] != '\0'){ch = time[i++];LCD1602_write_data(ch);send_data[send_len++] = ch;}LCD1602_write_data('-');Int_To_Str(GPS.D.day,time);//日LCD1602_Set_AC(8, 1);i = 0;send_len = 26;while(time[i] != '\0'){ch = time[i++];LCD1602_write_data(ch);send_data[send_len++] = ch;}LCD1602_write_data(',');Int_To_Str(GPS.D.hour,time);//时LCD1602_Set_AC(11, 1);i = 0;send_len = 29;while(time[i] != '\0'){ch = time[i++];LCD1602_write_data(ch);send_data[send_len++] = ch;}LCD1602_write_data(':');Int_To_Str(GPS.D.minute,time);//分LCD1602_Set_AC(14, 1);i = 0;send_len = 32;while(time[i] != '\0'){ch = time[i++];LCD1602_write_data(ch);send_data[send_len++] = ch;}
}void GPS_DisplayOne(void)
{uchar len,ch, i;char info[10];ess_inc = 0;
// memset(GPS_SEND_STR, 0, GPS_STR_LEN);if (GPS.NS == 'N') //判断是北纬还是南纬{if(dis_flag)LCD1602_DisplayChar(0, 0, 'N');elseLCD1602_DisplayChar(0, 0, ' ');
// GPS_SEND_STR[ess_inc ++] = 'N';len = 0;Int_To_Str(GPS.latitude_Degree,info); //纬度LCD1602_Set_AC(1, 0);i = 0;send_len = 2;while(info[i] != '\0'){ch = info[i++];if(dis_flag)LCD1602_write_data(ch);elseLCD1602_write_data(' ');send_data[send_len++] = ch;
// GPS_SEND_STR[ess_inc ++] = ch;len ++;}send_data[send_len++] = 'd';if(dis_flag)LCD1602_write_data(0xDF);elseLCD1602_write_data(' ');
// GPS_SEND_STR[ess_inc ++] = 'd';len ++;Int_To_Str(GPS.latitude_Cent,info); //纬分i = 0;while(info[i] != '\0'){ch = info[i++];if(dis_flag)LCD1602_write_data(ch);elseLCD1602_write_data(' ');send_data[send_len++] = ch;
// GPS_SEND_STR[ess_inc ++] = ch;len ++;}if(dis_flag)LCD1602_write_data(0x27);elseLCD1602_write_data(' ');
// GPS_SEND_STR[ess_inc ++] = 'm';Int_To_Str(GPS.latitude_Second,info); //纬秒i = 0;while(info[i] != '\0'){ch = info[i++];
// GPS_SEND_STR[ess_inc ++] = ch;}
// GPS_SEND_STR[ess_inc ++] = 's';len ++;while(7 - len){len ++;LCD1602_write_data(' ');}}// GPS_SEND_STR[ess_inc] = ',';ess_inc += 1;if (GPS.EW == 'E') //判断是东经还是西经{if(dis_flag)LCD1602_DisplayChar(8, 0, 'E');elseLCD1602_write_data(' ');
// GPS_SEND_STR[ess_inc ++] = 'E';len = 0;Int_To_Str(GPS.longitude_Degree,info); //经度LCD1602_Set_AC(9, 0);i = 0;send_len = 11;while(info[i] != '\0'){ch = info[i++];if(dis_flag)LCD1602_write_data(ch);elseLCD1602_write_data(' ');send_data[send_len++] = ch;
// GPS_SEND_STR[ess_inc ++] = ch;len ++;}send_data[send_len++] = 'd';if(dis_flag)LCD1602_write_data(0xDF);elseLCD1602_write_data(' ');
// GPS_SEND_STR[ess_inc ++] = 'd';len ++;Int_To_Str(GPS.longitude_Cent,info); //经分i = 0;while(info[i] != '\0'){ch = info[i++];if(dis_flag)LCD1602_write_data(ch);elseLCD1602_write_data(' ');send_data[send_len++] = ch;
// GPS_SEND_STR[ess_inc ++] = ch;len ++;}if(dis_flag)LCD1602_write_data(0x27);elseLCD1602_write_data(' ');
// GPS_SEND_STR[ess_inc ++] = 'm';Int_To_Str(GPS.longitude_Second,info); //经秒i = 0;while(info[i] != '\0'){ch = info[i++];// GPS_SEND_STR[ess_inc ++] = ch;}
// GPS_SEND_STR[ess_inc ++] = 's';len ++;while(7 - len){len ++;LCD1602_write_data(' ');}}GPS_DispTime();// GPS_SEND_STR[ess_inc] = ' ';ess_inc += 1;if(sendflag==1){ sendflag = 0;gsm_send_englishmsg(SEND_NUMBER,send_data);//发送位置短信 delay_ms(1000);delay_ms(1000);LCD1602_DisplayString(0,0," SEND OK "); delay_ms(1000);LCD1602_DisplayString(0,0," "); }// GPS_DispSpeed(GPS.speed, 10, 1);// if (GPS.D.second == 0)
// {
// if (GPS_Have_flag)
// {
// gsm_send_englishmsg(phonenum,GPS_SEND_STR);//发送位置短信
// }
// else
// {
// //gsm_send_englishmsg(phonenum,"GPS No Signal");//发送短信
// }
// }
}void main(void)
{uchar error_num = 0;uint count = 0;GPS_EN = 0;GPS_rx_flag = 0;LCD1602_Initialize();//LCD1602显示屏初始化uart_init(UART_B9600);GPS_EN = 1;GPS_rx_flag = 1;BG = 0;LCD1602_DisplayString_Center(0,"GPS SCAN...");LCD1602_ClearLine(1);
这篇关于51单片机GPS+sim800c GSM定位短信LCD1602液晶显示 原理图+PCB+源码的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!