sicklinger.com

  • Increase font size
  • Default font size
  • Decrease font size
  • English (United States)
  • Deutsch (DE-CH-AT)
Start Microcontroller (AVR) ATMEL AVR ATMEGA BMP085 library in C

ATMEL AVR ATMEGA BMP085 library in C

E-mail Print PDF
( 11 Votes )
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:

  1. Oversampling settings 0,1,2 --> max. Genauigkeit (RMS noise typ. 4 Pa) (RMS noise typ. 0.3 m)
  2. Fehlercoderückgabe für jede TWI (I2C) Aktion.
  3. Temperaturausgabe
  4. Druckausgabe
  5. Höhenberechnung mittels barometrischer Höhenformel (siehe http://en.wikipedia.org/wiki/Atmospheric_pressure)
  6. 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.

Last Updated on Friday, May 07 2010 00:05  

Add comment


Security code
Refresh


Headlines

There are no translations available.


Hallo,
habe soeben die überarbeitete Fassung der Latex Installationsanleitung unter Windows online gestellt. Es wird jetzt auch die Inkscapeversion 0.48 in Verbindung mit dem textext-Plugin unterstützt.
http://sicklinger.com/de/latex-installationsanleitung.html