
Originally Posted by
Acetronics
Hi,
What about reinitialise your Wsum value to 0 @ each 50 samples batch ??? don't you run this loop in another continuous loop ... ???
Alain
Oh I do. I left that part out of the code I pasted, but it is indeed running in an outside continuous loop.
Code:
PinProbe VAR PORTA.2
...
myLoop:
WSum = 0
Pause 100
For i = 0 to 49
ADCIn PinProbe, W0
Pause 10
WSum = WSum + W0
Next i
W0 = WSum / 50
...
LCDout $fe, 1 'Clear Screen
Lcdout $fe, $80
Lcdout "Reading: ", DEC W0
Goto myLoop
The readings I get with the ADCIN method are in the ballpark but move around too much. With the "manual" ADC method I get a stable value.
Bookmarks