Hey RDavid,
At this point, if I were you, I would drop back to some trouble shooting techniques.
How about using debug to send the adval to a serial port or if you are using the PICkit programmer it has that feature available.
Below is a sample program for the 16F690 so you will have to adapt it for your PIC, but you can see how to set up debug.
Code:
' 16F690
'****************************************************************
'* Name : UNTITLED.BAS *
'* Author : [select VIEW...EDITOR OPTIONS] *
'* Notice : Copyright (c) 2007 [select VIEW...EDITOR OPTIONS] *
'* : All Rights Reserved *
'* Date : 12/4/2007 *
'* Version : 1.0 *
'* Notes : *
'* : *
'****************************************************************
' 10-bit A/D conversion
' Connect analog input to channel-2 (RA2)
' -----[ I/O Definitions ]-------------------------------------------------
DEFINE DEBUG_REGG PORTA 'set debug port to porta
DEFINE DEBUG_BIT 0 'use pin a0 of porta for debug
DEFINE DEBUG_BAUD 2400 'set baud rate to 2400
DEFINE DEBUG_MODE 0 'communicate in true mode
' Define ADCIN parameters
' Set number of bits in result
DEFINE ADC_BITS 10
' Set clock source (3=rc)
DEFINE ADC_CLOCK 3
' Set sampling time in microseconds
DEFINE ADC_SAMPLEUS 50
adcVar VAR WORD ' Create variable to store result
' Set PORTA to all input
'TRISA = %11111111
' Set up AD
ANSEL = %00000100 'enable AN2, ALL THE REST DIGITAL
ANSELH = %00000000 'AN8-11 DIGITAL
ADCON0 = %10001000 ' RIGHT JUSTIFIED
ADCON1 = %00010000 'fOSC/8
Pause 500 ' Wait .5 second
main:
ADCIN 2, adcVar ' Read channel 0
' do something with adVar here
debug DEC adcvar," ",BIN adcVar,$0D,$0A
Pause 100 ' Wait.01 second
GoTo main ' Do it forever
Bookmarks