But your code was correct....Just spotted that this should read ADFM BIT7=1= right justified
Have you done a FOR/NEXT loop yet?
Here is a snip from an 8 bit averaging. Pretty simple. Some like to throw out the first and last readings and only use the middle values. I guess it depends on the app..
Code:GET_T: ADC_TEMP = 0 FOR X_TEMP = 1 TO 20 ADCON0=00000001 GOSUB READ_AD S_TEMP = ADRESH ADC_TEMP = ADC_TEMP + S_TEMP PAUSE 250 NEXT X_TEMP OUT_TEMP = ADC_TEMP / 20
Bookmarks