Hi guys, I'm new to this. I'm trying to get my PIC 16F88 to read in analogue on RB6 & RB7 and strobe a LED on RB2. I can get the LED to light up but it appears that the ADC is not reading in any values. I'm having problems configuring the ADC. Please help !!!
I have included the main part of my program below.....
Thanks
--------------------------------------------------------------------------
define OSC 20 '20MHz Must set Osc to HS when programming not XTL
'
' Set CONFIG1: --11 1111 0110 1110
' Set CONFIG2: ---- ---- ---- --11
'
INCLUDE "modedefs.bas" ' Include for SEROUT command
DEFINE ADC_BITS 10 ' Set number of bits in result
DEFINE ADC_CLOCK 1 ' Set clock source, not sure if this is correct
DEFINE ADC_SAMPLEUS 50 ' Set sampling time in microseconds
' Set ADC Registers
TRISB = %11111011 ' 1=In, 0=Out
ANSEL = %01111111 ' 1=Analogue, 0=Digital
ADCON0 = %10111000 ' Configure and turn on A/D Module.
ADCON1 = %10000000 ' Right Justify A/D result
ADCIN PORTB.6, Accel ' Read channel 5 to Accel
ADCIN PORTB.7, Gain ' Read channel 6 to Gain
pause 1000
serout 2,N9600,["g = ", #Accel," gain = ", #Gain,10,13]
high PORTB.2 'drive LED high
--------------------------------------------------------------------------
Bookmarks