基于AT89C51单片机GPS定位系统单车骑行数据采集系统设计

基于AT89C51单片机GPS定位系统单车骑行数据采集系统设计

基于AT89C51单片机GPS定位系统单车骑行数据采集系统设计

  • 适用:本科,大专,自考
  • 更新时间2024年
  • 原价: ¥299
  • 活动价: ¥200 (活动截止日期:2024-05-01)
  • (到期后自动恢复原价)
基于AT89C51单片机GPS定位系统单车骑行数据采集系统设计

基于AT89C51单片机GPS定位系统单车骑行数据采集系统设计

摘要:骑单车作为一项环保的运动,它不产生二氧化碳,在骑行的过程中对骑行者的身心也会有益处,是现代社会一种可以被称为首选的有氧运动。而其作为辅助工具的单车数据采集系统也成长迅速,功能由刚开始的展示骑行的公里数,到时间和骑行速度的显示,到后来还能显示出当时的温度、骑行者的地理位置等。该论文中的单车骑行数据采集程序使用了AT89C51单片机为根基,以此基础上用霍尔传感装置来测量实时速度,用DS18B20来得到实时的温度,地理位置由GPS定位系统来得到。本论文叙述了单车骑行数据采集系统设计的软件设计和其硬件电路。软件部分使用的比较基础的C语言进行了编程。

关键词:AT89C51单片机,霍尔传感器,温度(DS18B20),速度,GPS定位系统。

Design of bicycle cycling data collection system

Abstract: Bicycling as an environmentally friendly sport, it does not produce emissions pollution. It will be beneficial to the cyclist's body and mind in the process of riding. It is a kind of aerobic exercise that can be called the first choice in modern society. The bicycle data acquisition system, which is an auxiliary tool, has also grown rapidly. The function is displayed from the number of kilometers that have just been displayed, to the display of time and riding speed, and it can later show the current temperature and the occupant’s geographical location. Wait. This thesis mainly elaborates the design of a bicycle riding data acquisition system based on 51 single-chip microcomputers. The system is centered on the AT89C51 microcontroller, the speed is detected by the Hall sensor, the temperature is obtained with the temperature chip (DS18B20), and the geographical position is obtained by the GPS positioning system. This dissertation describes the software design and its hardware circuit for the bicycle riding data acquisition system design. The hardware part consists of the AT89C51 microcontroller's minimum system, setting and startup circuit, Hall sensor, GPS positioning system, temperature sensor, and LED digital tube display. The software part uses C language for programming.

Keywords: AT89C51 microcontroller; Hall sensor;Temperature (DS18B20);Speed; GPS positioning system.

目录

第一章  绪论 3

1.1  课题研究的目的和意义 3

1.2  课题的研究内容 3

第二章  总体设计方案 4

2.1  系统方案 4

2.2  单片机介绍 5

2.3  GPS定位系统介绍 6

2.4  温度传感器介绍 7

2.5  测速传感器介绍 8

2.6  显示器介绍 8

第三章  硬件设计 9

3.1 单片机模块硬件设计 9

3.1.1  复位电路介绍 10

3.2 霍尔传感器硬件设计 11

3.2.1  霍尔效应的介绍 11

3.2.2  霍尔传感器的应用 12

3.2.3  霍尔传感器的测量原理 13

3.3 温度传感器DS18B20硬件设计 15

3.3.1  DS18B20的测量原理 16

3.4 GPS定位系统 17

3.5 显示模块 19

3.5.1  LCD引脚及引脚说明 19

3.5.2  LCD硬件的连接 19

第四章  软件设计 20

4.1  主程序设计 20

4.2  测速程序设计思路 20

4.3  显示程序设计思路 21

结论 24

参考文献 25

致谢 25

源代码 27

第一章  绪论

1.1  课题研究的目的和意义

世界性的污染让环保成为全球都在重视的问题。环保目前已经成为了地球上所有人要负担起来的责任,机动车尤其是汽车的污染对现在的生态系统的毁坏已经众所周知。在我们国家,由于人口众多,又因为社会各界人士对环保理念的越加重视,社会人士对单车的选择是越来越多,单车骑起来又轻便、轻松,在工作闲暇之中,成为闲暇时刻运动的运动器材,远距离的单车骑行又让单车成为了人们强生健体的重要运动器材。

 因此,更好的了解运动,尤其是自行车运动员对自身运动的了解,他们这时候就需要一种能够测量数据记录,记录实时运动,并进行分析的一种系统,以此实时对自己的训练计划进行改变。最好这样的系统还能测量出温度,湿度,地理位置等外部因素来让数据更加有依据性科学性,使运动员或普通运动者在单车骑行中获得最好的运动效果。如今市场中像这样的单车采集的装备可以说是鱼龙混杂,但其中大部分产品测量精度低,不直观,耗电量多,功能过于简单,有时候为了有完整的运动数据需要花费很多钱来购买仪器,往往会达到事倍功半的窘境。 因此本文介绍的单车骑行数据采集系统是一款具有齐全的功能,使用的能耗又低,能够精确的显示总公里数、实时温度、实时速度、实时地理位置等多功能的单片机系统。

 1.2  课题的研究内容

本论文主要利用了霍尔传感器(Hall Sensor),AT89C51等部件(下文会详述)设计一个可以用LCD显示实时速度、实时地理位置、实时温湿度的一个数据采集系统。本文该数据采集系统的电路原理、各个模块的设计思路、方案的可实施性的论证以及各个硬件中组件的详细介绍等内容,硬件部分和软件部分是该论文主要需要着重探讨的地方。

本论文一开始概述了该系统的总体设计思路,把硬件中将要使用的传感器单片机做出了详细的解释,然后是这些传感器与89C51单片机的硬件部分的设计,紧接着就是对硬件部分相应的软件设计,包含了显示的程序设计,处理数据方面的程序设计,最后对在设计过程中遇到的问题及情况有一个总结,对出现的问题进行了分析与改进。

本论文详细介绍了采集系统的功能、需要达到的目标效果和完成该系统的所需要的硬件系统和软件程序,并将两部分的设计思路叙述出来,为该系统的可实施性有了一定的科学解释与依据。

参考文献

[1] 佘新平. 数字电子技术[第二版][M]. 华中科技大学出版社, 2009-8

[2] 童诗白, 华成英. 模拟电子技术基础[第四版][M]. 高等教育出版社, 2001.1

[3] 韦建英, 徐安静. 模拟电子技术基础[M]. 华中科技大学出版社, 2010-8 

[4] 宋受俊. 基于单片机的电机运动控制系统设计[J]. 机电产品开发与创新, 2006, 25(23): 56-58

[5] 樊尚春. 传感器技术及应用[M]. 北京航空航天大学出版社, 2004-8

[6] 李华. 单片机通用接口技术[M]. 北京: 北京航空航天大学出版社, 1999

[7] 潘永雄. 新编单片机原理与应用[M]. 西安: 西安电子科技大学出版社, 2003

[8] 楼然苗. 51系列单片机设计实例[M]. 北京航空航天大学出版社, 2003-03

[9] 陈享成, 耿长青. 基于单片机的LCD显示终端设计[J]. 电力自动化设备, 2007, 14 (9):14-16

[10] 胡汉才. 单片机原理及接口技术[M]. 北京: 清华大学出版社, 1999 

[11] 陈伯时. 电力拖动自动控制系统[M]. 北京: 机械工业出版社, 2003: 103-107

[12] 陈兴文, 刘燕. 单片机应用系统硬件调试技巧[J]. 中国测控网, 2009-3 (23): 23-25

[13] 何立民. 单片机高级教程-应用与设计[M]. 北京航空航天大学出版社, 2007-1

[14] 邵显涛. DS18B20集成温度传感器原理及其应用[J]. 电子测试, 2008-2 (12): 40-42

[15] 徐爱钧. 单片机原理实用教程基于Proteus虚拟仿真[M]. 北京: 电子工业出版社, 2009

[16] 李学礼. 基于Proteus的8051单片机实例教程[M]. 北京: 电子工业出版社, 2008

源代码

#include<reg51.h>

#define uint unsigned int

#define uchar unsigned char

#define ulong unsigned long

sbit P0_7=P0^7;     

sbit P1_0=P1^0;      

sbit P1_1=P1^1;     

sbit P1_2=P1^2;

sbit P1_4=P1^4;

sbit P1_5=P1^5;

sbit P1_6=P1^6;

sbit P1_7=P1^7;

sbit DQ=P3^6;

uchar temp[8];   

uchar num[8];     

uchar v_temp[3];

uint fu=0;

ulong cont;

ulong cl=96;

uchar n,m,num1,num2,num3,num4,num5,num6,t;

uchar v,vtime,hc,vtime1;

uchar table[]={

0x3f,0x06,0x5b,0x4f,0x66,

0x6d,0x7d,0x07,0x7f,0x6f,0x40};

uchar wei[]={

0xfe,0xfd,0xfb,0xf7,

0xef,0xdf,0xbf,0x7f};

void int01_t01();

//-----------距离函数-----------

void S_display();

void s_cunchu();

void dongtai();

//-----------时间函数-----------

void time0_cunchu();        

void T_display();

//-----------温度函数-----------

void Inint_ds18b20(void);

readonechar(void);              

void writeonechar(uchar dat);

readtemperature(void);

void displly(uint temp);

//-----------速度函数-----------

void v_hc();

void v_display();

//---------车轮设置函数---------

void cl_sz();

//-----------通用函数-----------

void delay1(uint z);     

void delay(uint i);

//------------主程序----------//

void main()

{

int01_t01();

while(P1_5==0)

{

cl_sz();

cont=cl;

s_cunchu();

S_display();

}

while(P1_5==1)

{

if(P1_4==0)

{

s_cunchu();

time0_cunchu();

if(P1_0==0) S_display();

if(P1_1==0) T_display();

if(P1_2==0) v_display();

if(P1_3==0) displly(readtemperature());

}

if(P1_4!=0) return;

}

}

//-----------------INT0和T0初始化-------------------

void int01_t01()

{

num1=num2=num3=num4=num5=num6=t=0;

TMOD=0x11;

TH0=(65536-50000)/256;

  TL0=(65536-50000)%256;

TH1=(65536-50000)/256;

  TL1=(65536-50000)%256;

EA=1;         

ET1=1;

  ET0=1;

EX1=1;

EX0=1;   

IT1=1;  

IT0=1;

TR1=0;

TR0=1;          

//----------------INT0中断服务子程序----------

void int0() interrupt 0

{cont+=cl;}

//-----------------time0中断服务程序----------

void time0() interrupt 1

{

TH0=(65536-50000)/256;

  TL0=(65536-50000)%256;

t++;

}

//-----------------INT1中断服务程序-----------

void int1() interrupt 2

{

v++;

if(v==4){EX1=0;TR1=0;}

else TR1=1;

}

//-----------------time1中断服务程序----------

void t1() interrupt 3 

{

vtime++;

TH1=(65536-50000)/256;

  TL1=(65536-50000)%256;

if(vtime==20){vtime=0;vtime1++;}

}

//**********行程程序**********//

//-----------------距离显示程序---------------

void S_display()

{

if(temp[7]!=0){m=8;dongtai();}

else

{if(temp[6]!=0){m=7;dongtai();}

else

{if(temp[5]!=0){m=6;dongtai();}

else

{if(temp[4]!=0){m=5;dongtai();}

else

{if(temp[3]!=0){m=4;dongtai();}

else{m=3;dongtai();}

}}}}

}

//-----------------行程存储程序----------------   

void s_cunchu()

{

temp[7]=(cont%100000000)/10000000;

temp[6]=(cont%10000000)/1000000;

temp[5]=(cont%1000000)/100000;

temp[4]=(cont%100000)/10000;

temp[3]=(cont%10000)/1000;

temp[2]=(cont%1000)/100;

temp[1]=(cont%100)/10;

temp[0]=(cont%10)/1;

}

//-----------------行程动态显示子程序----------

void dongtai()

{

for(n=0;n<m;n++)

{

P0=table[temp[n]];

if(n==2) P0=table[temp[n]]+0x80;

if(n==5) P0=table[temp[n]]+0x80;

P2=wei[n];

delay1(1);

P2=0xff;

}

}

//************时间程序**************//

//---------------时间存储函数-----------------

void time0_cunchu()

{

if(t==20){t=0;num1++;

if(num1==10){num1=0;num2++;

if(num2==6){num2=0;num3++;

if(num3==10){num3=0;num4++;}}}}

num[0]=num1;

num[1]=num2;

num[2]=10;

num[3]=num3;

num[4]=num4;

num[5]=10;

num[6]=num5;

num[7]=num6;

}

//-----------------显示函数------------------- 

void T_display()

{

  uchar yw;

for(yw=0;yw<8;yw++)

{

if(P1_1==0)

{

P2=wei[yw];         

  P0=table[num[yw]];

delay1(1);

}

else{P2=0xff;yw=8;}  

}

}

//************速度程序**************//  

//---------------速度缓存程序-----------------

void v_hc()

{

v_temp[2]=hc%1000/100;

v_temp[1]=hc%100/10;

v_temp[0]=hc%10;

}

//---------------速度显示函数-----------------

void v_display()

{

if(v==4)

{

v=0;

EX1=0;

TR1=0;

hc=cl*3/(vtime1+vtime*50/1000);

v_hc();

vtime=0;

vtime1=0;

EX1=1;

}

P2=0xfb;

P0=table[v_temp[2]]+0x80;

delay1(1);

P2=0xfd;

P0=table[v_temp[1]];

delay1(1);

P2=0xfe;

P0=table[v_temp[0]];

delay1(1);

}

//************温度程序**************// 

//--------------DS18B20初始化-----------------

void Inint_ds18b20(void)

{

uchar x=0;

DQ=1;

delay(8);

DQ=0;

delay(80);

DQ=1;

delay(14);

x=DQ;

delay(20);

}

//---------------读一字节DS18B20--------------

readonechar(void)

{

uchar i=0,dat=0;

for(i=8;i>0;i--)

{

DQ=0;

dat=dat>>1;

DQ=1;

if(DQ==1){dat=dat|0x80;}

delay(4);

}

return dat;

}

//---------------写一字节DS18B20--------------

void writeonechar(uchar dat)

{

uchar i=0;

for(i=8;i>0;i--)

{

DQ=0;

DQ=dat&0x01;

delay(5);

DQ=1;

dat=dat>>1;

}

delay(4);

}

//---------------读DS18B20温度值--------------

readtemperature(void)

{

float tt=0;

uint t=0;

uchar a=0,b=0;

Inint_ds18b20();

writeonechar(0xcc);

writeonechar(0x44);

Inint_ds18b20();

writeonechar(0xcc);

writeonechar(0xbe);

a=readonechar();

b=readonechar();                

t=(b<<8|a);     

if(t>2047)

{fu=t;t=~t;t+=1;}

tt=t*0.0625;            

                               

                               

t=tt*10+0.5;            

                               

                               

return t;

}

//-------通过数码管显示DS18B20温度值----------

void displly(uint temp)

{

uchar tp1,tp2,tp3,tp4;

tp1=temp/1000;

tp2=temp%1000/100;  

tp3=temp%100/10;

tp4=temp%10;

if(tp1==0)

if(fu>2047)

{P2=0xf7;P0=0x40;delay1(1);}

else

{P2=0xff;delay1(1);}

else

{

P2=0xf7;

P0=table[tp1];

delay1(1);

}

if((tp1|tp2)==0){P2=0xff;delay1(1);}

else

{

P2=0xfb;

P0=table[tp2];

delay1(1);

}

P2=0xfd;

P0=(table[tp3]+0x80);

delay1(1); 

P2=0xfe;

P0=table[tp4];

delay1(1);  

//***********车轮设置函数*************//

void cl_sz()

{

if(P1_6==0)

{

s_cunchu();

S_display();

delay1(80);

if(P1_6==0) cl++;

}

if(P1_7==0)

{

s_cunchu();

S_display();

delay1(80);

if(P1_7==0) 

if(cl!=0) cl--;

}

//***********延时子程序*************//

//-----------------显示延时函数

void delay1(uint z)

{

uchar j;

while(z--)

{for(j=0;j<125;j++);}

}

//-----------------精确延时函数

void delay(uint i)

{

while(i--);

}


  • 关键词 AT89C51 单片机 GPS 定位 单车骑 ( 车骑 ) 数据采集
  • 上一篇:基于51单片机的固态物料在线监测系统设计
  • 下一篇:基于单片机及GPRS模块交警违章监控数据传输采集监测系统设计
  • 暂无购买记录

    暂时没有评论

    真实

    多重认证,精挑细选的优质资源 优质老师。

    安全

    诚实交易,诚信为本。

    保密

    所有交易信息,都为您保密。

    专业

    10年专业经验,10年来帮助无数学子。