Subversion Repositories svnkaklik

Rev

Details | Last modification | View Log

Rev Author Line No. Line
6 kaklik 1
#include "D:\KAKLIK\programy\PIC_C\mereni\gmetr\gmetr.h"
2
 
3
#define LCD_RS          PIN_B1      // rizeni registru LCD displeje
4
#define LCD_E           PIN_B0      // enable LCD displeje
5
#define LCD_DATA_LSB    PIN_C4      // pripojeni LSB bitu datoveho portu LCD displeje (celkem 4 bity vzestupne za sebou)
6
 
7
#include "C:\library\CCS\lcd.c"
8
 
9
 
10
void main()
11
{
12
   signed int16 stred;
13
   signed int16 hodnota;
14
 
15
   setup_adc_ports(ALL_ANALOG);
16
   setup_adc(ADC_CLOCK_DIV_2);
17
   setup_spi(FALSE);
18
   setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
19
   setup_timer_1(T1_DISABLED);
20
   setup_timer_2(T2_DISABLED,0,1);
21
 
22
   lcd_init();
23
   Delay_ms(100);
24
   set_adc_channel(1);
25
   Delay_ms(500);
26
   stred = read_adc();
27
 
28
   while(true)
29
   {
30
      hodnota = stred - read_adc();
31
      Delay_ms(100);
32
      LCD_gotoxy(1,1);
33
      printf(lcd_putc,"                ");
34
      if (hodnota<0)
35
      {
36
         LCD_gotoxy(5,2);
37
         printf(lcd_putc," %03ld  ",hodnota);
38
         LCD_gotoxy(8-hodnota,1);
39
         printf(lcd_putc,"*",hodnota);
40
      }
41
      else
42
      {
43
         LCD_gotoxy(6,2);
44
         printf(lcd_putc," %03ld  ",hodnota);
45
         LCD_gotoxy(8-hodnota,1);
46
         printf(lcd_putc,"*",hodnota);
47
      }
48
   }
49
}