Rev Author Line No. Line
2909 kaklik 1 #include "main.h"
2912 kaklik 2 #include "SHT25.h"
2906 jacho 3  
4  
2909 kaklik 5 void main()
6 {
2912 kaklik 7 unsigned int8 i=0, sht_config;
2909 kaklik 8  
9 setup_adc_ports(NO_ANALOGS|VSS_VDD);
10 setup_adc(ADC_CLOCK_DIV_2);
11 setup_spi(SPI_SS_DISABLED);
12 setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
13 setup_timer_1(T1_DISABLED);
14 setup_timer_2(T2_DISABLED,0,1);
15 setup_ccp1(CCP_OFF);
16 setup_comparator(NC_NC_NC_NC);
17  
2911 kaklik 18 SHT25_soft_reset();
2909 kaklik 19 printf("SHT25 humidity and temperature sensor example \r\n",);
20 delay_ms (500);
21  
22 while(TRUE)
23 {
2912 kaklik 24 if (i<10) sht_config = SHT25_RH12_T14 | SHT25_HEATER_OFF; // loop alters on chip heater on and off to check correct function
2911 kaklik 25 else
26 {
2912 kaklik 27 sht_config = SHT25_RH12_T14 | SHT25_HEATER_ON;
28 if (i > 20) i = 0;
2911 kaklik 29 }
2912 kaklik 30 printf("setup: %X %X \r\n",SHT25_setup(sht_config),sht_config);
2909 kaklik 31 delay_ms (500);
32 printf("Temp: %f \r\n",SHT25_get_temp());
33 delay_ms (500);
34 printf("Hum: %f \r\n",SHT25_get_hum());
35 delay_ms (1000);
2911 kaklik 36 i++;
2909 kaklik 37 }
38 }
39