Subversion Repositories svnkaklik

Compare Revisions

Ignore whitespace Rev 328 → Rev 6

/programy/PIC_C/mereni/gmetr/gmetr.BAK
1,4 → 1,4
#include ".\gmetr.h"
#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
9,10 → 9,9
 
void main()
{
signed int16 stred;
signed int8 hodnota;
unsigned int8 i, offset;
 
signed int16 stred;
signed int16 hodnota;
setup_adc_ports(ALL_ANALOG);
setup_adc(ADC_CLOCK_DIV_2);
setup_spi(FALSE);
23,43 → 22,28
lcd_init();
Delay_ms(100);
set_adc_channel(1);
 
LCD_gotoxy(1,1);
printf(lcd_putc,"Gmetr 0.1.2 Beta");
LCD_gotoxy(1,2);
printf(lcd_putc,"Kaklik@mlab.cz");
Delay_ms(500);
 
LCD_clr();
LCD_gotoxy(1,1);
printf(lcd_putc,"Clibration...");
 
stred = 0;
for(i=0;i<=127;i++)
{
Delay_ms(10);
stred = stred + read_adc();
}
stred = stred >> 7;
 
stred = read_adc();
while(true)
{
hodnota = read_adc();
Delay_ms(50);
LCD_clr();
LCD_gotoxy(6,1);
printf(lcd_putc," %03ld ",(stred - hodnota));
if (hodnota > stred)
hodnota = stred - read_adc();
Delay_ms(100);
LCD_gotoxy(1,1);
printf(lcd_putc," ");
if (hodnota<0)
{
offset = hodnota - stred;
offset = (offset >> 5) + 8;
LCD_gotoxy(5,2);
printf(lcd_putc," %03ld ",hodnota);
LCD_gotoxy(8-hodnota,1);
printf(lcd_putc,"* ",hodnota);
}
else
{
offset = stred - hodnota;
offset = offset >> 5;
LCD_gotoxy(6,2);
printf(lcd_putc," %03ld ",hodnota);
LCD_gotoxy(8-hodnota,1);
printf(lcd_putc," *",hodnota);
}
LCD_gotoxy(offset,2);
printf(lcd_putc,"*");
}
}