Rev 2159 Rev 2406
1 #include "main.h" 1 #include "main.h"
2   2  
3 #define LCD_ENABLE_PIN PIN_E0 //// 3 #define LCD_ENABLE_PIN PIN_E0 ////
4 #define LCD_RS_PIN PIN_E1 //// 4 #define LCD_RS_PIN PIN_E1 ////
5 #define LCD_RW_PIN PIN_E2 //// 5 #define LCD_RW_PIN PIN_E2 ////
6 #define LCD_DATA4 PIN_D4 //// 6 #define LCD_DATA4 PIN_D4 ////
7 #define LCD_DATA5 PIN_D5 //// 7 #define LCD_DATA5 PIN_D5 ////
8 #define LCD_DATA6 PIN_D6 //// 8 #define LCD_DATA6 PIN_D6 ////
9 #define LCD_DATA7 PIN_D7 9 #define LCD_DATA7 PIN_D7
10 #include <lcd.c> 10 #include <lcd.c>
11   11  
12 #define ONE_WIRE_PIN PIN_C7 12 #define ONE_WIRE_PIN PIN_C7
13 #include "..\ds1820.c" 13 #include "..\ds1820.c"
14   14  
15 void main() 15 void main()
16 { 16 {
17   17  
18 setup_adc_ports(NO_ANALOGS|VSS_VDD); 18 setup_adc_ports(NO_ANALOGS|VSS_VDD);
19 setup_adc(ADC_CLOCK_DIV_2); 19 setup_adc(ADC_CLOCK_DIV_2);
20 setup_spi(SPI_SS_DISABLED); 20 setup_spi(SPI_SS_DISABLED);
21 setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); 21 setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
22 setup_timer_1(T1_DISABLED); 22 setup_timer_1(T1_DISABLED);
23 setup_timer_2(T2_DISABLED,0,1); 23 setup_timer_2(T2_DISABLED,0,1);
24 setup_ccp1(CCP_OFF); 24 setup_ccp1(CCP_OFF);
25 setup_comparator(NC_NC_NC_NC); // This device COMP currently not supported by the PICWizard 25 setup_comparator(NC_NC_NC_NC); // This device COMP currently not supported by the PICWizard
26 setup_oscillator(OSC_4MHZ); 26 setup_oscillator(OSC_4MHZ);
27   27  
28   28  
29 lcd_init(); 29 lcd_init();
30 30
31   31  
32 lcd_putc("(c) Kaklik 2011"); 32 lcd_putc("(c) Kaklik 2011");
33 lcd_gotoxy(3,2); 33 lcd_gotoxy(3,2);
34 lcd_putc("www.mlab.cz"); 34 lcd_putc("www.mlab.cz");
35 Delay_ms(2000); 35 Delay_ms(2000);
36   36  
37 lcd_putc("\fReady..\n"); 37 lcd_putc("\fReady..\n");
38 Delay_ms(100); 38 Delay_ms(100);
39   39  
40 while (TRUE) 40 while (TRUE)
41 { 41 {
42 lcd_gotoxy(1,2); 42 lcd_gotoxy(1,2);
43 printf(lcd_putc,"T: %f K ",ds1820_read()+273.15); 43 printf(lcd_putc,"T: %f K ",ds1820_read()+273.15);
-   44 printf("$T1.0 %f \r\n",ds1820_read()+273.15);
44 Delay_ms(100); 45 Delay_ms(100);
45 } 46 }
46   47  
47 } 48 }