I am using a PIC16F73 with a 20MHz crystal. The 16F73 has a 8 bit A/D converter.
I have a current transducer connected to the RA3 pin
I am using the folling code:
DEFINE ADC_BITS 8 ' Set number of bits in result
DEFINE ADC_CLOCK 3 ' Set clock source (3-internal clock)
DEFINE ADC_SAMPLEUS 50 ' Set sampling time
result var word
TRISA = %00001011 ' Set RA0, RA1, RA3 to input, rest is output
ADCON1 = %00000100 ' Set RA0, RA1, RA3 to analog input, RA2, RA5 to digital I/O
' reference voltage = Vdd, left adjusted
ADCON0 = %11011001 ' A/D clock is internal RC, select RA3/AN3, turn on A/D
Within a loop I am calling ADCIN as follow:
ADCIN 3,result ' Read RA3 ADC channel
My problem is:
The transducer outputs a constant value of 2.54V which is right given the sensored current value, thus I know the
transducer is working properly.
However, ADCIN converts the constant 2.54V to a value that varies between 95 and 110?
If would be expecting the converted result to equal a value of +-130 (2.54/5*255=129.54)?
What bothers me most is why the ADCIN result is fluctuating between 95-110 while my voltmeter confirms a constant
2.54V as output from the transducer?
Any help or suggestion is appreciated.
Bookmarks