• 大小: 5.83MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-10-12
  • 语言: 其他
  • 标签: STM32  GPRS  GPS  

资源简介

IAR能编译通过运行的完整的STM32平台的GPS定位追踪器源码,原理图等。

资源截图

代码片段和文件信息

#include “stm32f10x_lib.h“
#include “string.h“
#include “my32x.h“
#include “ini.h“
#include “myusart.h“
#include “mym10.h“

Gps_Info_TypeDef Gps_Info;

vu8 GPSmode_Worke_Flag = FALSE;
vu8 GSMmode_Worke_Flag = FALSE;
vu8 GPSmode_Sleep_Count = 0;
vu8 GSMmode_Sleep_Count = 0;
vu8 Timer_10ms_Count = 0;
vu8 Timer_1Sec_Flag = FALSE;
vu16 SysTick_Count = 0;
vu8 LED1_Flash_Flag = FALSE;
vu8 LED1_Flash_Count = 0;

void main(void)
{
  #ifdef DEBUG
    debug();
  #endif
    
  Init_Clock();
  System_Init();
  EXTI_Configuration();
  NVIC_Configuration();
  NVIC_RESETPRIMASK();//打开总中断
  
  GPS_Pow_OFF;
  LED1_ON;
  LED2_OFF;
  
  while(1)
  {
    //GPS
    if(GPSmode_Worke_Flag)
    {
      GPS_Pow_ON;
      myUsartGPS_GPIO_Cmd(ENABLE);
      if(myUsartGPS.Event_Flag)
      {
        myUsartGPS.Event_Flag = FALSE;
        myUsartGPS_Event();
      }  
    }
    else
    {
      GPS_Pow_OFF;
      myUsartGPS_GPIO_Cmd(DISABLE);
      GPSmode_Sleep_Count = 0;
    }
    //SMS
    if(GSMmode_Worke_Flag)
    {
      if(Phone_Num_Flag && SMS_Buf_Flag)
      {
        Phone_Num_Flag = FALSE;
        SMS_Buf_Flag = FALSE;
        
        SMS_SendGSM();
      }
      Disposal_ReceiveGSM();
    }
    //1s Event
    if(Timer_1Sec_Flag)
    {
      Timer_1Sec_Flag = FALSE;
      
      M10_LOOP();
      
      if(GPSmode_Worke_Flag)
      {
        if(GPSmode_Sleep_Count++ > 90)
        {
          GPSmode_Worke_Flag = FALSE;
          memset((u8 *)Device_Info.SMS_Buf0128);
          strncpy((char *)Device_Info.SMS_Buf(const char *)“No GPS Signal.\0“14);
          SMS_Buf_Flag = TRUE;
        }
      }
      if((GPSmode_Worke_Flag==FALSE) && GSMmode_Worke_Flag && (SendSMS_Flag==FALSE))
      {
        if(GSMmode_Sleep_Count++ > 90) // Mode Sleep
        {
          GSMmode_Sleep_Count = 0;
          DTR_Hi;
          Init_Gpio_Stop();
          PWR_EnterSTOPMode(PWR_Regulator_LowPowerPWR_STOPEntry_WFI);
          myUsartGSM_GPIO_Cmd(ENABLE);
          Init_Gpio();
          while(RCC_GetFlagStatus(RCC_FLAG_HSIRDY) == RESET);
          DTR_Lo;
        }
      }
      else  
      {
        GSMmode_Sleep_Count = 0;
      }
      if(Read_ExtPow == Bit_SET)  LED2_ON;  else  LED2_OFF;
    }
  }
}


#ifdef  DEBUG
/*******************************************************************************
* Function Name  : assert_failed
* Description    : Reports the name of the source file and the source line number
*                  where the assert_param error has occurred.
* Input          : - file: pointer to the source file name
*                  - line: assert_param error line source number
* Output         : None
* Return         : None
*******************************************************************************/
void assert_failed(u8* file u32 line)

  /* User can add his own implementation to report the file name and line number
     ex: printf(“

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2011-04-02 23:57  Tracker_V2.03\
     目录           0  2016-03-13 18:30  Tracker_V2.03\app程序V2.03\
     目录           0  2011-04-05 16:55  Tracker_V2.03\app程序V2.03\app\
     文件        1851  2011-04-02 13:56  Tracker_V2.03\app程序V2.03\app\ini.h
     文件       15409  2011-04-04 21:16  Tracker_V2.03\app程序V2.03\app\main.c
     文件        3490  2011-04-01 22:07  Tracker_V2.03\app程序V2.03\app\my32x.c
     文件         445  2011-04-02 22:48  Tracker_V2.03\app程序V2.03\app\my32x.h
     文件        6162  2011-04-02 18:09  Tracker_V2.03\app程序V2.03\app\mym10.c
     文件        1469  2011-04-02 16:07  Tracker_V2.03\app程序V2.03\app\mym10.h
     文件       14623  2011-04-02 22:21  Tracker_V2.03\app程序V2.03\app\myusart.c
     文件        3925  2011-04-02 22:47  Tracker_V2.03\app程序V2.03\app\myusart.h
     目录           0  2011-04-04 21:18  Tracker_V2.03\app程序V2.03\Debug\
     目录           0  2016-03-13 19:03  Tracker_V2.03\app程序V2.03\Debug\Exe\
     文件       29187  2016-03-13 19:03  Tracker_V2.03\app程序V2.03\Debug\Exe\Gzq.hex
     文件      182448  2016-03-13 19:03  Tracker_V2.03\app程序V2.03\Debug\Exe\Gzq.out
     文件       10063  2011-04-05 16:32  Tracker_V2.03\app程序V2.03\Debug\Exe\Gzq.sim
     文件       10063  2011-04-05 16:32  Tracker_V2.03\app程序V2.03\Debug\Exe\Gzq.sim._1
     目录           0  2011-04-04 21:18  Tracker_V2.03\app程序V2.03\Debug\List\
     目录           0  2016-03-13 19:03  Tracker_V2.03\app程序V2.03\Debug\Obj\
     文件        2264  2011-04-05 16:55  Tracker_V2.03\app程序V2.03\Debug\Obj\cortexm3_macro.o
     文件          23  2016-03-13 18:30  Tracker_V2.03\app程序V2.03\Debug\Obj\Gzq.pbd
     文件          23  2016-03-13 18:30  Tracker_V2.03\app程序V2.03\Debug\Obj\Gzq.pbd.browse
     文件       46738  2016-03-13 19:03  Tracker_V2.03\app程序V2.03\Debug\Obj\main.o
     文件          38  2016-03-13 18:30  Tracker_V2.03\app程序V2.03\Debug\Obj\main.pbi
     文件       10448  2016-03-13 18:30  Tracker_V2.03\app程序V2.03\Debug\Obj\main.pbi.cout
     文件       19382  2016-03-13 19:03  Tracker_V2.03\app程序V2.03\Debug\Obj\my32x.o
     文件          38  2016-03-13 18:30  Tracker_V2.03\app程序V2.03\Debug\Obj\my32x.pbi
     文件       10449  2016-03-13 18:30  Tracker_V2.03\app程序V2.03\Debug\Obj\my32x.pbi.cout
     文件       37036  2016-03-13 19:03  Tracker_V2.03\app程序V2.03\Debug\Obj\mym10.o
     文件          38  2016-03-13 18:30  Tracker_V2.03\app程序V2.03\Debug\Obj\mym10.pbi
     文件       10449  2016-03-13 18:30  Tracker_V2.03\app程序V2.03\Debug\Obj\mym10.pbi.cout
............此处省略122个文件信息

评论

共有 条评论