找回密碼
 立即注冊(cè)

QQ登錄

只需一步,快速開始

搜索
查看: 1871|回復(fù): 1
收起左側(cè)

單片機(jī)+MPX4115+LTC1297的數(shù)字氣壓測(cè)量?jī)x程序Proteus仿真圖

[復(fù)制鏈接]
ID:1027797 發(fā)表于 2022-6-16 08:28 | 顯示全部樓層 |閱讀模式
仿真原理圖如下(proteus仿真工程文件可到本帖附件中下載)
51hei.gif
a18f05d9a421f4aee59a5e326dddac66.png
單片機(jī)main程序
#include <intrins.h>
#include <reg51.h>
#include <stdlib.h>
#include "HDM32GS12.h"
#include "ReadADC.h"

#define uchar unsigned char
#define uint  unsigned int
#define port P0

/*參數(shù)的定義*/
double adc;

double qiya;
long qiya_1;
double haiba;
long haiba_1;
int ge_q,ge_h;
int shi_q,shi_h;
int bai_q,bai_h;
int qian_h;
int shu1_q;
int shu2_q;
/*延時(shí)*/
void delay(uchar z)   
{
     int x;
     for(x=z;x>0;x--);
}
        
void main()
{

        lcdini();//初始化
        clrscr();//清屏
        
while(1)
{
                adc=ReadADC();//ADC值獲取
          qiya=(adc+345.618)/36.855;//氣壓
          haiba=9002.2-89.245*qiya;//海拔
          if(haiba<0){haiba=0;}
          haiba_1=haiba;//取整
          qiya_1=qiya*100;//左移2位取整
          /*海拔的顯示*/
//          qian_h=haiba_1/1000;
//                bai_h=haiba_1/100%10;
//          shi_h=haiba_1/10%10;
//          ge_h=haiba_1/1%10;
                /*ADC的顯示*/
                qian_h=(int)adc/1000;
                bai_h=(int)adc/100%10;
          shi_h=(int)adc/10%10;
          ge_h=(int)adc/1%10;
         /*氣壓的顯示*/
                bai_q=qiya_1/10000%10;
          shi_q=qiya_1/1000%10;
          ge_q=qiya_1/100%10;
                shu1_q=qiya_1/10%10;
                shu2_q=qiya_1%10;
         
               
                /*顯示函數(shù)*/
          Draw_wordh(0,0,0,16);
          Draw_wordh(1,16,0,16);
          Draw_wordh(2,32,0,16);
          Draw_wordh(10,48,2,8);
                Draw_wordh(bai_q,56,2,8);
          Draw_wordh(shi_q,64,2,8);
          Draw_wordh(ge_q,72,2,8);
          Draw_wordh(11,80,2,8);
                Draw_wordh(shu1_q,88,2,8);
                Draw_wordh(shu2_q,96,2,8);
               
                Draw_wordh(3,0,3,16);
          Draw_wordh(4,16,3,16);
                Draw_wordh(10,32,1,8);
          Draw_wordh(qian_h,40,1,8);
                Draw_wordh(bai_h,48,1,8);
                Draw_wordh(shi_h,56,1,8);
          Draw_wordh(ge_h,64,1,8);

         
          Draw_wordx(0,0,0,16);
          Draw_wordx(1,16,0,16);
          Draw_wordx(2,32,0,16);
          Draw_wordx(10,48,2,8);
          Draw_wordx(bai_q,56,2,8);
          Draw_wordx(shi_q,64,2,8);
          Draw_wordx(ge_q,72,2,8);
                Draw_wordx(11,80,2,8);
                Draw_wordx(shu1_q,88,2,8);
                Draw_wordx(shu2_q,96,2,8);

    Draw_wordx(3,0,3,16);
          Draw_wordx(4,16,3,16);
                Draw_wordx(10,32,1,8);
                Draw_wordx(qian_h,40,1,8);
                Draw_wordx(bai_h,48,1,8);
                Draw_wordx(shi_h,56,1,8);
          Draw_wordx(ge_h,64,1,8);

        }
}

51hei.png

Keil代碼與Proteus8.8仿真下載: 仿真和程序.7z (107.26 KB, 下載次數(shù): 39)

評(píng)分

參與人數(shù) 1黑幣 +50 收起 理由
admin + 50 共享資料的黑幣獎(jiǎng)勵(lì)!

查看全部評(píng)分

回復(fù)

使用道具 舉報(bào)

ID:496636 發(fā)表于 2022-6-16 19:45 | 顯示全部樓層
一般的大氣壓在101千帕左右,海拔越高,氣壓越低,我這地區(qū)海拔只有99到100千帕左右,海拔100不到,這幾天下雨天,悶, 一般在101千帕左右。115千帕有點(diǎn)高啊
回復(fù)

使用道具 舉報(bào)

本版積分規(guī)則

小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機(jī)教程網(wǎng)

快速回復(fù) 返回頂部 返回列表