There are no translations available.



Hallo,
anbei gibt es eine C-Bibliothek für den Bosch BMP085 Drucksensor für Atmel AVR Atmega Familie.
Die Bibliothek wurde mit dem AVR Studio (4.18 SP2) und mit dem WinAVR-20100110 Compiler erzeugt (Projektdatei enthalten).
Die Treiberroutinen unterstützen folgende Features:
- Oversampling settings 0,1,2 --> max. Genauigkeit (RMS noise typ. 4 Pa) (RMS noise typ. 0.3 m)
- Fehlercoderückgabe für jede TWI (I2C) Aktion.
- Temperaturausgabe
- Druckausgabe
- Höhenberechnung mittels barometrischer Höhenformel (siehe http://en.wikipedia.org/wiki/Atmospheric_pressure)
- UART und TWI Bibliothek werden mitgeliefert
Beispiel:
Dieses kleine Beispiel soll zeigen wie einfach die Bibliothek benutzt werden kann.
#include "atmega_bmp085_lib.h"
#include "uart.h"
//#########################################
//#########################################
//#########################################
// S T A R T M A I N P R O G R A M
int main(void)
{
//-----------------------------------------
// Allocate memory
//-----------------------------------------
int32_t temperature = 0;
int32_t pressure = 0;
int16_t BMP085_calibration_int16_t[8];
int16_t BMP085_calibration_uint16_t[3];
uint8_t error_code=0;
//-----------------------------------------
// Initialize Stuff
//-----------------------------------------
uart_init(); //Initialize UART0
_delay_ms(11);
i2cSetBitrate(1000); //Initialize TWI 1000kHz
BMP085_Calibration(BMP085_calibration_int16_t, BMP085_calibration_uint16_t,&error_code);////Initialize BMP085
//-----------------------------------------
// Do forever
//-----------------------------------------
printf("error code global init: %d \n",error_code);
while(1)
{
printf("------------------------\n");
printf("------------------------\n");
printf("------------------------\n");
bmp085Convert(BMP085_calibration_int16_t, BMP085_calibration_uint16_t,&temperature, &pressure,&error_code); //Read and convert temp. and pressure
printf("Temperature: %ld (in 0.1 deg C)\n", temperature);
printf("Pressure: %ld Pa\n\n", pressure);
printf("Altitude: %ld dm\n", bmp085CalcAltitude(pressure));
printf("error code global: %d \n",error_code);
printf("------------------------\n");
printf("------------------------\n");
_delay_ms(10);
}
return 0;
}
// E N D M A I N P R O G R A M
//#########################################
//#########################################
Die Bibliothek steht unter GNU LGPL v2.1 und kann hier heruntergeladen werden.