forked from SZV10X_Software/SZV103_FM33A0xxEV_SiZhu

周巍
2024-04-11 91ef77c00ed797b1048c5187f416e351e646a009
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
 
// /******************************************************************************
//  * Copyright (C) 2014-2015 HangZhou SiZhu Co.,LTD.
//  *
//  *-----------------------------------------------------------------------------
//  * File:                 pressure.c
//  * Description:        get pressure of now and display it on OLED code
//  * Author:              Lishoujian (867693272@qq.com)
//  * Date:                Jan 8, 2015
//  *****************************************************************************/
 
#include "pressure.h"
#include "adc.h"
#include "para.h"
#include "devicegpioinit.h"
#include "regdefine.h"
#include "ads1120.h"
float Get_pressure(float pre_vol);
 
 
#define    AD_REF_VOL                            3000
#define    AD_PRESSURE_CH                10
#define    AD_CNT                              40
/******************************************
 * func:    Get_pressure_volt
 * desc:    get average voltage from pressure sensor.
 * input:   none
 * output:  none
 * return:  average voltage:eg 1000 means voltage equal to 1.000v
 *****************************************/
float get_pressure(void)  
{
 
//    float    vol;
    float    tmp;
    
 
 
 
/*    vol = pressure_ad_value();//10 - channel  3300 - 3.3v vref
    if((vol  > 0.095)||(vol  < 0.001))
    {
        return    0;
    }
    else
    {
        vol = vol * 1000;
        tmp = Get_pressure(vol);
        
    }*/
    return tmp;
 
 
/******************************************
 * func:    Get_pressure
 * desc:    transform the voltage of sampling to pressure
 * input:   pre_vol - the voltage of sampling eg:(pre_vol max = 0.100v) 0.100v => 100 
 * output:  none
 * return:  bar - pressure of now:eg 160 means 16.0bar
 *****************************************/
 
float Get_kb_pressure(float pre_vol)
{ //pre_vol max <= 3300 
    float kpa;  
    
//    kpa = pre_vol*system_para_control_run_g.pressure_para_k + system_para_control_run_g.pressure_para_b;
    
  return kpa;
}