230
}
void MPL115A1_get_data(float *pres, float *temp)
{
unsigned int hb = 0;
unsigned int lb = 0;
signed long Padc = 0;
signed long Tadc = 0;
MPL115A1_write(conv_cmd, 0);
MPL115A1_get_bytes(&hb, &lb, PRESH);
Padc = (((hb << 8) + lb) >> 6);
MPL115A1_get_bytes(&hb, &lb, TEMPH);
Tadc = (((hb << 8) + lb) >> 6);
*pres = ( coefficients.A0 + (( coefficients.B1 + ( coefficients.C12 * Tadc)) *
Padc) + ( coefficients.B2 * Tadc));
*pres = (((*pres * 65.0) / 1023.0) + 50.0);
*temp = (30.0 + ((Tadc - 472) / (-5.35)));
}
main.c
#include <msp430.h>
#include "delay.h"
#include "HW_SPI.h"
#include "SW_I2C.h"
#include "PCF8574.h"
#include "lcd.h"
#include "MPL115A1.h"
const unsigned char symbol[8] =
{
0x00, 0x06, 0x09, 0x09, 0x06, 0x00, 0x00, 0x00
};
void GPIO_graceInit(void);
void BCSplus_graceInit(void);
void USCI_A0_graceInit(void);
void System_graceInit(void);
void WDTplus_graceInit(void);
void lcd_symbol(void);
void print_C(unsigned char x_pos, unsigned char y_pos, signed int value);
void print_I(unsigned char x_pos, unsigned char y_pos, signed long value);
void print_D(unsigned char x_pos, unsigned char y_pos, signed int value, unsigned
char points);
void print_F(unsigned char x_pos, unsigned char y_pos, float value, unsigned char
points);
void main(void)