Problem with POT as program selector

Algorithm development and general DSP issues

Moderator: frank

Post Reply
Aion
Posts: 33
Joined: Sat Mar 22, 2008 1:17 am

Problem with POT as program selector

Post by Aion »

Hi Frank,

I use the POT1 to select the branch of the FV-1 program. The part of the code looks as follows:

RDAX POT1 , 1
SOF 1 , -0.2
SKP NEG, A

SOF 1 , -0.2
SKP NEG, B

SOF 1 , -0.2
SKP NEG, C

SOF 1 , -0.2
SKP NEG, D

E: code5
SKP 0, OUTPUT

A: code1
SKP 0, OUTPUT

B: code2
SKP 0, OUTPUT

C: code3
SKP 0, OUTPUT

D: code4
SKP 0, OUTPUT

OUTPUT: code

etc.

Unfortunately, there are pot settings where the code jumps between labels. Looks like the POT hysteresis is too small. Is there a simple way to reduce this effect? It is present in the Spin Development board as well as in my system.

Thank you and best regards,

Aion
frank
Posts: 1244
Joined: Wed Oct 19, 2005 12:26 pm
Contact:

Re: Problem with POT as program selector

Post by frank »

All analog inputs will have some jitter in the result so results right at the threshold between values will jump between them. You can try adding filtering to the pot value to see if that helps or add some extra code to add hysteresis, etc.
Frank Thomson
Experimental Noize
Aion
Posts: 33
Joined: Sat Mar 22, 2008 1:17 am

Re: Problem with POT as program selector

Post by Aion »

Thank you. What kind of filtering do you mean? An extra cap at POT pin? Could you please give an example of pot hysteresis code?
Philcaster
Posts: 4
Joined: Mon Feb 24, 2020 2:12 pm

Re: Problem with POT as program selector

Post by Philcaster »

Hey, I know it's a month late, but I'm new to the forum and thought I'd jump in.

For filtering, I assume he meant a software low-pass (check out rom pitch shift code pot0 treatment for example).

As for coded hysteresis, here's what I came up with. Basically if the knob is on the edge of a jump (ex. 0.19-0.2 range), check what the previous mode was and don't change it. Chews up a lot of code though, maybe there's a slicker way to do it. Hope it makes sense anyway.

equ prev_mode regX ;store mode value be 0.1 increments. A=0.1, B=0.2, etc


A: ;ACC is between -0.2 and 0 from knob
sof 1, 0.01 ;if knob is between 0.19 and 0.2, ACC will now be between 0 and 0.01
skp neg, A2 ;if positive (knob between 0.19 and 0.2), check previous mode
ldax prev_mode
sof 1, -0.2
skp zro, B2 ;if knob is bewtween 0.19 and 0.2 (on the edge of A/B), if previous mode was B, keep in mode B
A2:
sof 0, 0.1 ;otherwise, we are in mode A, set mode to 0.1 for next round
wrax prev_mode, 0
///A Code///
skp zro, OUTPUT

B: ;ACC is between -0.2 and 0
sof 1, 0.01 ;if knob is between 0.39 and 0.4, ACC will now be between 0 and 0.01
skp neg, B2 ;if positive (knob between 0.39 and 0.4), check previous mode
ldax prev_mode
sof 1, -0.3
skp zro, C2 ;if knob is bewtween 0.39 and 0.4 (on the edge of B/C), if previous mode was C, keep in mode C
B2:
sof 0, 0.2 ;otherwise, we are in mode B, set prev_mode to 0.2 for next round
wrax prev_mode, 0
///B Code///
skp zro, OUTPUT

etc.
Post Reply