OPTIMISER_LEVEL = 6 ' Set for maximum optimiser level Device 16F877 'Although we are actualy using the 16F876! Declare XTAL = 20 RCSTA=$90 'Serial port to 115,200baud TXSTA=$24 SPBRG=10 Loop: Declare LCD_DTPIN PORTB.4 Declare LCD_LINES 2 Declare LCD_RSPIN PORTB.1 HRSOut "Meter Project " 'message to the RS232 Port Pause 200 ' Wait for LCD to start Declare ADIN_RES 10 ' 10-bit result required Declare ADIN_TAD FRC ' RC OSC chosen Declare ADIN_STIME 500 ' Allow 50us sample time Dim VAR1 As Word Dim volts As Float TRISA = %00000001 ' Configure AN0 (PORTA.0) as an input ADCON1 = %10000000 ' Set analogue input on PORTA.0 vloop: VAR1 = ADIn 0 ' Place the conversion into variable VAR1 volts = VAR1 * ( 5/1024) Lcdout $fe, 1, "x=", #var1," " lcdout $FE, $C0 , "volts=", #volts, " " Pause 50 ' delay GoTo vloop ' Do it forever Stop