Device =16F877A Xtal=20 Declare LCD_Type ALPHA Declare LCD_DTPin PORTB.4 Declare LCD_ENPin PORTB.3 Declare LCD_RSPin PORTB.2 Declare LCD_Interface 4 Declare LCD_CommandUs 2000 Declare LCD_DataUs 50 Declare LCD_Lines 2 Declare Adin_Res = 10 Declare Adin_Tad = FRC Declare Adin_Stime = 50 Declare Hserial_Baud = 9600 ' Set baud rate to 9600 Declare Hserial_RCSTA = %10010000 ' Enable serial port and continuous receive Declare Hserial_TXSTA = %00100100 ' Enable transmit and asynchronous mode Declare Hserial_Clear = On TRISC = %00000001 TRISA = %00000111 ADCON1 = %10000000 ' Настройка регистра как аналоговый вход ADCON0 = %10000001 Dim Index As Word Dim X As Byte Symbol SN0 = PORTC.0 X=0 main: If SN0 = 0 Then X = X + 1: DelayMS 200: GoTo Start GoTo main Start: Index = ADIn 0 HSerOut [" ", Dec X, ". ", Dec Index / 204.6 ] Print At 1, 1, " ", Dec X, ". ", Dec Index / 204.6 DelayMS 200 GoTo main