I would like to invert normal pot0 values 0<->1 to infinity<->1 (in practice ~100<->1) via 1/x formula.
The problem is it doesn't work. Regardless of the value of pot0, the output signal is constant and weak. Only when the pot0 reaches value of 0, the output signal stops (skp instruction). What am I doing wrong?
You can't generate gain that way, the result after the EXP will be clamped between 0 and 0.999, as it says in the instruction set PDF for EXP:
Positive logarithmic ACC values will be clipped to +0.99999988
So REG0 will always be 0.999... and your input is 0.1 (0.05+0.05 assuming same signal to ADCL and ADCR) so your output will be 0.0999... which is a very small signal.
sebxx4 wrote: ↑Wed May 05, 2021 12:33 pm
Now I see, you're right.
So, what do you propose? How can I realize 1/x for output value >1?
You cannot really create 1/x as a linear value since it will be bigger than 1. The FV-1 normalizes to -1.0 to +0.9999.
sebxx4 wrote: ↑Wed May 05, 2021 12:33 pm
Btw, registers are 24-bit, so max value I can write to them is 16777215? And what is the best accuracy of small values? 8 digits after point?
No, the values are interpreted as -1.0 to +0.999... so no values will be considered integer, all are <1.0 (few exceptions like LOG but those are special cases). You cannot generate a large number to multiply by for gain, you will have to do adds or shifts.
Well, maybe there is some other way to make my program.
I would like to generate RAMP signal to control one of parameters in program. I need this RAMP to be variable time long (375ms <-> 600ms) and controlled via pot1. The values generated by ramp should change from +0.5 to 0. And the thing I got the biggest problem with is controlling RAMP frequency.
When value of pot1 is 0.375, ramp signal should be 375ms long (2,667Hz), when 0.5 - 500ms, when 0.6 - 600ms, etc. In general, it should vary linearly with the value of pot1, in the range of 0.375 - 0.600. But my scope observations shows the frequency of the RAMP increases with the factor entered into RMP0_RATE, that's why I needed the 1/x function to invert it (pot1 value up - ramp frequency down).
It still doesn't work. Output signal is very week regardless of the pot position. What I'm I doing wrong? Or otherwise - how can I even use this 1/x function?
sebxx4 wrote: ↑Sat May 15, 2021 10:57 pm
Where I'm exceeding allowed range? Adding the factor of 0.01 in the exp function doesn't eliminate the clipping problem?
You are trying to pass a positive value to EXP, check the instruction PDF
sebxx4 wrote: ↑Sat May 15, 2021 10:57 pm
Overall, I need to divide ACC by pot value.
Meh, maybe all this time I didn't need multiplying ACC by 1/x, but simply divide ACC by x (by pot, in my case) Lol, I feel stupid
Okay, so let's assume:
y = 0.005/POT
First, I should make log2(0.005) and then substract log2(pot) from it.
But, eg, first log gives me -7.64385618977 and I need to store it somewhere to clean the accumulator and then make second log. I suppose I can't just put such a large negative number to any register?