Rev 3275 Rev 3283
Line 9... Line 9...
9 #define LCD_DATA7 PIN_D7 9 #define LCD_DATA7 PIN_D7
10 #include <lcd.c> 10 #include <lcd.c>
11   11  
12 #include "../SHT25.h" 12 #include "../SHT25.h"
13 #include "../LTS01.h" 13 #include "../LTS01.h"
-   14 #include "./HMC5883L.h"
-   15 #include <math.h>
-   16  
14   17  
15 void main() 18 void main()
16 { 19 {
17 float temp1, temp2, humidity; 20 float temp1, temp2, humidity;
18 int16 i=0; 21 int16 i=0;
Line 26... Line 29...
26 setup_ccp1(CCP_OFF); 29 setup_ccp1(CCP_OFF);
27 setup_comparator(NC_NC_NC_NC); // This device COMP currently not supported by the PICWizard 30 setup_comparator(NC_NC_NC_NC); // This device COMP currently not supported by the PICWizard
28 setup_oscillator(OSC_8MHZ); 31 setup_oscillator(OSC_8MHZ);
29   32  
30   33  
31 printf("GeoMet01A\r\n",); 34 printf("GeoMet01A\r\n");
32 printf("(c) Kaklik 2013\r\n"); 35 printf("(c) Kaklik 2013\r\n");
33 printf("www.mlab.cz\r\n"); 36 printf("www.mlab.cz\r\n");
34   37
-   38 // Init the HMC5883L. Set Mode register for
-   39 // continuous measurements.
-   40 hmc5883l_write_reg(HMC5883L_CFG_A_REG, 0x18); // no average, maximal update range
-   41 hmc5883l_write_reg(HMC5883L_CFG_B_REG, 0x00); // minimal range
-   42 hmc5883l_write_reg(HMC5883L_MODE_REG, 0x00);
-   43  
35 lcd_init(); 44 lcd_init();
36 lcd_putc("(c) Kaklik 2013"); 45 lcd_putc("(c) Kaklik 2013");
37 lcd_gotoxy(3,2); 46 lcd_gotoxy(3,2);
38 lcd_putc("www.mlab.cz"); 47 lcd_putc("www.mlab.cz");
39 Delay_ms(2000); 48 Delay_ms(2000);
Line 43... Line 52...
43 { 52 {
44 lcd_gotoxy(1,1); 53 lcd_gotoxy(1,1);
45 temp1 = SHT25_get_temp(); 54 temp1 = SHT25_get_temp();
46 humidity = SHT25_get_hum(); 55 humidity = SHT25_get_hum();
47 temp2= LTS01_get_temp(); 56 temp2= LTS01_get_temp();
-   57 hmc5883l_read_data();
48   58
49 printf(lcd_putc,"%f C %f \%% \r\n",temp1, humidity); 59 printf(lcd_putc,"%f C %f \%%",temp1, humidity);
50 lcd_gotoxy(1,2); 60 lcd_gotoxy(1,2);
51 printf(lcd_putc," %f C",temp2); 61 printf(lcd_putc," %f C",temp2);
52 printf("%ld %f %f %f \r\n",i, temp1, humidity, temp2); 62 printf("%ld %f %f %f ",i, temp1, humidity, temp2);
-   63 printf("%Ld %Ld %Ld \n\r", compass.x, compass.y, compass.z);
53 i++; 64 i++;
54 Delay_ms(100); 65 Delay_ms(100);
55 } 66 }
56   67  
57 } 68 }