hello Mark,
Mark try incorporating this in your program...
TRISIO=%00001010 'Pic 12F675
' Define ADCIN parameters
DEFINE ADC_BITS 10
DEFINE ADC_CLOCK 3
DEFINE ADC_SAMPLEUS 50
'adval VAR byte
'Pause 100
'Loop:
ADCIN 1, number ' Read channel 1 to adval (0-1023)
'number = (number */ 500)>>2 equates to: (adval * 500)/1024
number = number >> 6
Your values should be between 1 and 1023...
And use only ONE pin at first (until you get it working) then go to the using two pins.
Make darn sure your pin has a A/C converter on it. and make darn sure your TRIS is set to a "1" to represent the A/D converter.
Also, your reading will not be a "Voltage Reading" but a reading of a number between 0 and 1024... you must convert this number to a voltage reading.
if 0=0 volts.
if 5=1024
Voltage= 5 X ADvalue / 1024
Dwayne
Last edited by Dwayne; - 3rd September 2004 at 16:50.
Ability to Fly:
Hurling yourself towards the ground, and missing.
Engineers that Contribute to flying:
Both optimists and pessimists contribute to the society. The optimist invents the aeroplane, the pessimist the parachute
Pilots that are Flying:
Those who know their limitations, and respect the green side of the grass...
Bookmarks