51 single chip GPS + sim800c GSM positioning SMS LCD1602 LCD display program

Publisher:SparklingRiverLatest update time:2020-02-15 Source: 51hei Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
sim800c+GPS chip is
a small design for practice, a little ugly. Attached is the program and the principle PCB diagram. It is
 

my first post, please forgive me if it is not good.

Button function: one button alarms, buzzer sounds, another button sends a text message to the specified mobile phone, the mobile phone number is written in the program.

The microcontroller source program is as follows:

#include "common.h"

#include "uart.h"

#include "gps.h"

#include "gsm.h"



#include "lcd.h"


#define GPS_STR_LEN 48


fly 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 = 1


GPS_INFO GPS; //GPS information structure


bit GPS_rx_flag = 0;

bit GPS_Have_flag = 0;


#define SEND_NUMBER "AT+CMGS="13420106297"rn"


char xdata send_data[37]="N:     ',E:     ',2000-00-00,00:00rn";

unsigned char send_len= 0;


bit dis_flag = 1;

bit sendflag=0;



/****************************************

display time

/****************************************/

void GPS_DispTime(void)

{

    fly i = 0;

    fly ch;

    char time[5];


          Int_To_Str(GPS.D.year,time);//年


    LCD1602_Set_AC(0, 1);

    i = 0;

          send_len = 18;

    while(time[i] != '')

    {

        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] != '')

    {

        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] != '')

    {

        ch = time[i++];


        LCD1602_write_data(ch);


                    send_data[send_len++] = ch;

    }

    LCD1602_write_data(',');

        

    Int_To_Str(GPS.D.hour,time);//time

    LCD1602_Set_AC(11, 1);

    i = 0;

          send_len = 29;

    while(time[i] != '')

    {

        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] != '')

    {

        ch = time[i++];


        LCD1602_write_data(ch);


                    send_data[send_len++] = ch;

    }

}



void GPS_DisplayOne(void)

{

    flying len,ch, i;

    char info[10];


    ess_inc = 0;

//    memset(GPS_SEND_STR, 0, GPS_STR_LEN);


    if (GPS.NS == 'N') //Judge whether it is north latitude or south latitude

    {

                          if(dis_flag)

        LCD1602_DisplayChar(0, 0, 'N');

                                else

                                LCD1602_DisplayChar(0, 0, ' ');

//        GPS_SEND_STR[ess_inc ++] = 'N';

        only = 0;

        Int_To_Str(GPS.latitude_Degree,info); //Latitude


        LCD1602_Set_AC(1, 0);

        i = 0;

                    send_len = 2;

        while(info[i] != '')

        {

            ch = info[i++];

                                          if(dis_flag)

            LCD1602_write_data(ch);

                                                else

                                    LCD1602_write_data(' ');

                              send_data[send_len++] = ch;

//            GPS_SEND_STR[ess_inc ++] = ch;

            only ++;

        }

                    send_data[send_len++] = 'd';

                                if(dis_flag)

        LCD1602_write_data(0xDF);

                                else

                                 LCD1602_write_data(' ');

//        GPS_SEND_STR[ess_inc ++] = 'd';


        only ++;

        Int_To_Str(GPS.latitude_Cent,info);  //纬分

        i = 0;

        while(info[i] != '')

        {

            ch = info[i++];

                                          if(dis_flag)

            LCD1602_write_data(ch);

                                                else

                                    LCD1602_write_data(' ');

                              send_data[send_len++] = ch;

//            GPS_SEND_STR[ess_inc ++] = ch;

            only ++;

        }

                                if(dis_flag)

        LCD1602_write_data(0x27);

                                else

                                    LCD1602_write_data(' ');

//        GPS_SEND_STR[ess_inc ++] = 'm';


        Int_To_Str(GPS.latitude_Second,info);  //纬秒

        i = 0;

        while(info[i] != '')

        {

            ch = info[i++];

//            GPS_SEND_STR[ess_inc ++] = ch;

        }

//        GPS_SEND_STR[ess_inc ++] = 's';


        only ++;

        while(7 - len)

        {

            only ++;

            LCD1602_write_data(' ');

        }


    }


//    GPS_SEND_STR[ess_inc] = ',';

    ess_inc += 1;


    if (GPS.EW == 'E') //Judge whether it is east longitude or west longitude

    {

                          if(dis_flag)

        LCD1602_DisplayChar(8, 0, 'E');

                                else

                                    LCD1602_write_data(' ');

//        GPS_SEND_STR[ess_inc ++] = 'E';


        only = 0;

        Int_To_Str(GPS.longitude_Degree,info); //Longitude

        LCD1602_Set_AC(9, 0);

        i = 0;

                    send_len = 11;

        while(info[i] != '')

        {

            ch = info[i++];

                                          if(dis_flag)

            LCD1602_write_data(ch);

                                                else

                                    LCD1602_write_data(' ');

                              send_data[send_len++] = ch;

//            GPS_SEND_STR[ess_inc ++] = ch;

            only ++;

        }

                    send_data[send_len++] = 'd';

                                if(dis_flag)

        LCD1602_write_data(0xDF);

                                else

                                    LCD1602_write_data(' ');

//        GPS_SEND_STR[ess_inc ++] = 'd';


        only ++;


        Int_To_Str(GPS.longitude_Cent,info); //Longitude cents

        i = 0;

        while(info[i] != '')

        {

            ch = info[i++];

                                          if(dis_flag)

            LCD1602_write_data(ch);

                                                else

                                    LCD1602_write_data(' ');

                              send_data[send_len++] = ch;

//            GPS_SEND_STR[ess_inc ++] = ch;

            only ++;

        }

                                if(dis_flag)

        LCD1602_write_data(0x27);

                                else

                                 LCD1602_write_data(' ');

//        GPS_SEND_STR[ess_inc ++] = 'm';


        Int_To_Str(GPS.longitude_Second,info); //Longitude seconds

        i = 0;

        while(info[i] != '')

        {

            ch = info[i++];


//            GPS_SEND_STR[ess_inc ++] = ch;

        }

//        GPS_SEND_STR[ess_inc ++] = 's';


        only ++;

        while(7 - len)

        {

            only ++;

            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);//Send location SMS                                

                                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); //Send location SMS

//        }

//        else

//        {

// //gsm_send_englishmsg(phonenum,"GPS No Signal");//Send SMS

//        }

//    }

}


void main(void)

{

    fly error_num = 0;

                uint count = 0;


    GPS_EN = 0;

    GPS_rx_flag = 0;

    LCD1602_Initialize(); //LCD1602 display initialization

    uart_init(UART_B9600);

    GPS_EN = 1;

    GPS_rx_flag = 1;

                BG = 0;

    LCD1602_DisplayString_Center(0,"GPS SCAN...");

    LCD1602_ClearLine(1);


    while(1)

    {

        if (rev_stop) //If a line is received

        {

            if (GPS_RMC_Parse(RX1_Buffer, &GPS)) //解析GPRMC

            {

                RMC_YES;

                GPS_DisplayOne(); //Display the first page of GPS information

                error_number = 0;

                gps_flag = 0;

                rev_stop  = 0;

                GPS_Have_flag = 1;

……………………




Reference address:51 single chip GPS + sim800c GSM positioning SMS LCD1602 LCD display program

Previous article:Simple game Proteus simulation program based on LCD12864 and 51 single chip microcomputer
Next article:Ultra-small wireless transceiver module LT8920 configuration ideas + microcontroller transmission and reception program

Recommended ReadingLatest update time:2024-11-16 17:58

Application of GPS global positioning technology in medical monitoring equipment
Abstract This paper discusses the application of GPS global positioning technology in medical monitoring and prepares a GPS medical monitoring positioning device. The device is mainly composed of a single-chip control module and a GPS receiving module. It has the advantages of high accuracy, good stability, strong
[Industrial Control]
Application of GPS global positioning technology in medical monitoring equipment
Application of geomagnetic sensor V2XE in GPS system design
1 Introduction V2XE is a new 2-axis compass and geomagnetic field sensor with integrated microprocessor as control and interface. V2XE uses the 3V working power supply commonly used in new systems. It has the advantages of low power consumption, small size, strong anti-noise ability under various conditions, and large
[Microcontroller]
Application of geomagnetic sensor V2XE in GPS system design
UCF receives $4.5 million from U.S. Army research lab to develop GPS-independent smart navigation system
According to foreign media reports, the U.S. Army Research Lab (ARL) has invested $4.5 million in the University of Central Florida (UCF) to develop a computer vision-based intelligent navigation system for use when GPS is unavailable or interfered with. The system will support the navigation of ground vehicles by u
[Automotive Electronics]
UCF receives $4.5 million from U.S. Army research lab to develop GPS-independent smart navigation system
Apple's latest patent: Using machine learning models to correct GPS data for accurate navigation
While GPS (Global Positioning System) is a widely used geolocation technology that helps humans navigate when driving, it is not always accurate. Map applications such as Apple Maps sometimes show users the wrong location for a variety of reasons. Such reasons include trees or mountains causing GPS signal interfe
[Automotive Electronics]
Apple's latest patent: Using machine learning models to correct GPS data for accurate navigation
Research on the Accuracy Verification of Digital Traffic Maps Using GPS Vehicle Trajectory
The vehicle positioning information collected by the Global Positioning System (GPS) records the vehicle's position data at different times more accurately. This paper uses data collection and image refinement processing methods to extract road curves with relatively accurate positions, providing a basis fo
[Automotive Electronics]
Research on the Accuracy Verification of Digital Traffic Maps Using GPS Vehicle Trajectory
How to Reduce GPS Testing Costs
Seemingly overnight, GPS has evolved from a single application device in cars to a handheld device application and now part of a multimode handheld device, or even embedded in a laptop? GPS-enabled devices are expected to be a $30 billion market within four years, implying that many devices will come out of high-vol
[Test Measurement]
How to Reduce GPS Testing Costs
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号