Been studying teh ASM code for most of the day. Just came across this:
; Apply hysteresis to the CV by checking if ADC_VALUE and ADC_VALUE+4 give the same result
addlw D'4' ; Add 4 to the AD value in W
andlw B'11100000' ; Get the top 3 bits (Result 1)
movwf TEMP
movf ADC_VALUE, w
andlw B'11100000' ; Get the top 3 bits (Result 2)
xorwf TEMP, w ; Test if the two results are the same
btfss ZEROBIT ; If zero, they're the same
goto MainLoop ; Not the same, no need to change multiplier
Could someone explain to me what it's doing, why, and how?
On another note concerning the TAPLFO code, in the main loop when he's checking the various CV inputs, it appears that only one CV per main loop is evaluated (rather than checking each one in turn per main loop) since after each one is checked there's a GOTO MAIN_LOOP instruction. Is the reason for this performance, best practice, or....? COuld you not poll each of teh CV inputs each iteration of the main loop? (perhaps it would make the PIC sluggish to do that many ADC's each time through?)