program topeniprij ' Declarations section dim LCD_RS as sbit at Ra1_bit LCD_EN as sbit at Ra2_bit LCD_D4 as sbit at RB0_bit LCD_D5 as sbit at RB1_bit LCD_D6 as sbit at RB2_bit LCD_D7 as sbit at RB3_bit LCD_RS_Direction as sbit at TRISa1_bit LCD_EN_Direction as sbit at TRISa2_bit LCD_D4_Direction as sbit at TRISB0_bit LCD_D5_Direction as sbit at TRISB1_bit LCD_D6_Direction as sbit at TRISB2_bit LCD_D7_Direction as sbit at TRISB3_bit dim text, text1 as char[8] dim a as byte dim prijem as longword sub procedure interrupt if (intcon.5 and intcon.2 ) then intcon.2 = 0 prijem.0 = portb.4 prijem = prijem<<1 a = inc(a) if a = 23 then a=0 intcon = 136 prijem = $cdaaaa end if end if if (intcon.3 and intcon.0) then 'pri impulsu na rb4 prepne na timer a odmeruje intcon = 160 prijem = 2 end if end sub main: porta = 0 portb = 0 cmcon = 7 trisa = 0 trisb = 16 vrcon = 0 ' Configure AN pins as digital I/O option_reg = 4 intcon = 136 text = "000.00" Lcd_Init() ' Initialize Lcd Lcd_Cmd(_LCD_CLEAR) ' Clear Lcd Lcd_Cmd(_LCD_CURSOR_OFF) ' Turn cursor off prijem = 0 a = 0 tmr0 = 0 '--- Main loop while (TRUE) bytetostr(intcon,text1) lcd_out(1,1,text1) bytetostr(prijem,text) lcd_out(2,1,text) delay_ms(1000) wend end.