Hi,
Not tested but how about:/Henrik.Code:ADC_VALUE VAR WORD AMPS VAR WORD i VAR BYTE AMPS = 0 For i = 0 to 3 ' Sample 4 times ADCIN 0,ADC_VALUE ' Get actual value AMPS = AMPS + ADC_VALUE ' Accumulate NEXT AMPS = AMPS >> 1 ' Divide by 2, AMPS is now 0-2048 AMPS = AMPS ** 64000 ' Multiply by ~0.97656, AMPS is now 0-2000 AMPS = AMPS - 1000 ' AMPS is now +/-1000, change to AMPS=1000-AMPS to invert. LCDOUT $FE,$1, "Current: ", SDEC AMPS/10, ".", DEC ABS(AMPS // 10)




Bookmarks