Rev Author Line No. Line
2978 kaklik 1 #define VERSION "0.1"
2 #define ID "$Id: main.c 2916 2013-04-14 17:42:03Z kaklik $"
2917 jacho 3  
2948 kaklik 4 #include "main.h"
2917 jacho 5  
2979 kaklik 6 #use i2c(master, sda=PIN_C4, scl=PIN_C3)
7 #use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8) //rcv TXD xmit RXD
2917 jacho 8  
9 #define MPL3115_ADDR_R 0xC1 //addresa pro cteni
10 #define MPL3115_ADDR_W 0xC0
11  
3275 kaklik 12 #include "../MPL3115.h"
2917 jacho 13  
14  
15 void main()
16 {
17  
18 float p, t, a;
2979 kaklik 19 printf("\r\nMLAB Barometer and Altimeter demo code \r\n",);
20 printf("Temperature [deg C] Preassure [Pa] Altitude [m] \r\n",);
2917 jacho 21  
22 while(TRUE)
23 {
24 mpl3115_setP(); //nastaveni pro tlak a teplotu
25 delay_ms (500);
26 t=mpl3115_T();
27 p=mpl3115_P();
28  
29 mpl3115_setA(); //nastaveni pro vysku a teplotu
30 delay_ms (500);
31 a=mpl3115_A();
32  
2979 kaklik 33 printf("%3.1f %6.1f %5.2f \r\n", t, p, a);
2917 jacho 34  
2978 kaklik 35 delay_ms (1000);
36 }
2917 jacho 37 }
38  
39