Hi Steve,
Don't use a VAR to define the A/D channel. Use the channel's number instead:
You can test your project with your code I trimmed to minimum:
Code:
INCLUDE "modedefs.bas"
Define LCD_DREG PORTA
Define LCD_DBIT 0
Define LCD_RSREG PORTA
Define LCD_RSBIT 6
Define LCD_EREG PORTA
Define LCD_EBIT 4
Define LCD_BITS 4
bat var byte
OSCCON = %01100000
ANSEL = %00100000
Bat_Volts:
ADCIN 5, bat
LCDOut $FE, 1, "Battery = ",DEC bat, "V"
PAUSE 2000
goto Bat_Volts:
end
BTW, PORTB.6 is ADC Channel 5
<img src="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=3431&stc=1&d=124367750 7">
Bookmarks