symbol SF = 115 ; Caliblatin ScaleFactor setfreq m4 ; clock Frq. = 4MHz fvrsetup FVR2048 ; set FVR as 2.048V adcconfig %011 ; set FVR as ADC Vref+, 0V Vref- let w2 = 0 ; W2@=@Accum ADC let b7 =0 ; 10X counter high c.2 high c.4 main: high c.0 ; Sig for Test point ON readadc10 C.1,w1 ; read value into w1 let w2 = w2+w1 ; Accumulate value if w2 >= SF then ; if more than ScalFactor toggle c.4 ; LED on or off let w2 = W2 // SF ; use MOD value inc b7 ; inc 10x counter if b7 = 10 then ; toggle c.2 ; 1/10 LED on or off let b7 = 0 endif endif low c.0 ; Sig for TO. off 'debug pause 15 ; delay 15ms goto main ; loop back to start