#include "C:\RS\Lux10b\main.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)
#define IN 0
#include "lcd.c"
void main()
{
unsigned int16 I;
float E;
setup_adc_ports(AN0);
setup_adc(ADC_CLOCK_DIV_32);
setup_psp(PSP_DISABLED);
setup_spi(SPI_SS_DISABLED);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
set_adc_channel (IN);
delay_us(20);
lcd_init();
while(TRUE)
{
I=read_adc();
delay_us(600);
E=0.0577*I;
printf(lcd_putc," E=%2.2f lx \n",E);
if(I<=128)
printf(lcd_putc,"** \r");
if(I>128&&I<=256)
printf(lcd_putc,"**** \r");
if(I>256&&I<=384)
printf(lcd_putc,"****** \r");
if(I>384&&I<=512)
printf(lcd_putc,"******** \r");
if(I>512&&I<=640)
printf(lcd_putc,"********** \r");
if(I>640&&I<=768)
printf(lcd_putc,"************ \r");
if(I>768&&I<=896)
printf(lcd_putc,"************** \r");
if(I>896&&I<=1016)
printf(lcd_putc,"****************\r");
if(I>1016)
printf(lcd_putc," *** high *** \r");
delay_ms(600);
}
}