
Originally Posted by
Ioannis
Since you have done it in PBP and if you don't mind, could you post the code you tested please? ....
Sure thing:
Code:
ADCinput var WORD
ADCcalc var WORD
ADCinLow con 0
ADCinHigh con 255
ADCoutLow con 100
ADCoutHigh con 235
ADCcalc = ADCinput / 4 ' reduce to 0-255 to avoid WORD overflow
ADCcalc = (ADCcalc MAX ADCinlow) - adcinlow ' adjust 0 - 255 range
ADCcalc = ADCcalc * (ADCouthigh - adcoutlow)' to 100 - 235 range
ADCcalc = ADCcalc / (adcinhigh - adcinlow)
ADCcalc = ADCcalc + ADCoutlow
ADCcontrast = ADCcalc MIN ADCouthigh
I just kept things simple and did things one step at a time, just like Jerson explained it. And women say men can't follow instructions. 
I know I can shrink this, but I'm just researching all the different bits of code I will need first, and documenting with comments what the code does and why.
Bookmarks