Subversion Repositories svnkaklik

Compare Revisions

Ignore whitespace Rev 5 → Rev 6

/programy/PIC_C/mereni/gmetr/gmetr.BAK
0,0 → 1,49
#include "D:\KAKLIK\programy\PIC_C\mereni\gmetr\gmetr.h"
 
#define LCD_RS PIN_B1 // rizeni registru LCD displeje
#define LCD_E PIN_B0 // enable LCD displeje
#define LCD_DATA_LSB PIN_C4 // pripojeni LSB bitu datoveho portu LCD displeje (celkem 4 bity vzestupne za sebou)
 
#include "C:\library\CCS\lcd.c"
 
 
void main()
{
signed int16 stred;
signed int16 hodnota;
setup_adc_ports(ALL_ANALOG);
setup_adc(ADC_CLOCK_DIV_2);
setup_spi(FALSE);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
 
lcd_init();
Delay_ms(100);
set_adc_channel(1);
Delay_ms(500);
stred = read_adc();
while(true)
{
hodnota = stred - read_adc();
Delay_ms(100);
LCD_gotoxy(1,1);
printf(lcd_putc," ");
if (hodnota<0)
{
LCD_gotoxy(5,2);
printf(lcd_putc," %03ld ",hodnota);
LCD_gotoxy(8-hodnota,1);
printf(lcd_putc,"* ",hodnota);
}
else
{
LCD_gotoxy(6,2);
printf(lcd_putc," %03ld ",hodnota);
LCD_gotoxy(8-hodnota,1);
printf(lcd_putc," *",hodnota);
}
}
}