The averaging code is an INCLUDE file.
Save it to a file called "Average_Hyst.pbp".
Put the file in the same folder as your project, or the PBP folder.
Then at the top of the code in post #4, add this line.
Code:
INCLUDE "Average_Hyst.pbp"
The GOTO OverAverage line just jumps over the code, making sure execution doesn't "Fall Into" the subroutine without being called by a GOSUB.
Then, change these lines to use the "Value" variable, instead of adval.
Code:
Main:
ADCIN 0, Value
GOSUB Average
LED = Value * LEDcount ; Determine which LED to light
LED = DIV32 (1023 - Margin) - 1
Edit: Whoops, sorry Henrik.
Took me an hour to get his darn post to go through.
The forums going up and down like an elevator.
Ya beat me to it.
Bookmarks