cancel
Showing results for 
Search instead for 
Did you mean: 

Encoder mode and rotary encoders as tuning knobs

turboscrew
Senior III
Posted on March 24, 2018 at 18:23

I understand that a timer (that supports encoder mode) can be used for keeping track of a rotary incremental encoder, but is there a good way of making the value saturating? So that when turned 'forward' the value increments to a given value and stops incrementing even if the knob is turned further, and the same way when turned 'backward' - the counter value saturates to zero.

#encoder-mode #rotary-encoder
21 REPLIES 21
turboscrew
Senior III
Posted on March 25, 2018 at 16:06

So, no better ideas to share?

Posted on March 25, 2018 at 17:07

N o b ? or Dial as suggested by

Wagner.Joerg

I have 3 installed on my new board, so a nice name would be good.

I am thinking left hand usage,

Spacial Dials

Coordinate adjuster

Colour Mixer, is my preference.

T J
Lead
Posted on March 25, 2018 at 19:36

how about Morning Glory..?

Its an affliction of the soul, a cross we all have to bear.

turboscrew
Senior III
Posted on March 25, 2018 at 20:57

I meant ideas of handling the encoder... :D

Posted on March 26, 2018 at 12:30

 ,

 ,

turboscrew wrote:

(BTW, why does the site show stars in place of the word 'k n o b'?)

It doesn't any more - the 'forbidden word' dictionary has been updated.

See: ,

 ,
Posted on March 29, 2018 at 11:30

Knob is a derogatory term in many English speaking countries, such as here in New Zealand, but only when used to describe a person as it also slang for a part of the male body.  However it is a perfectly acceptable word for actual knobs.  You could use dial for some knobs, but a dial is usually a knob with numbers on it and as rotary encoders have no absolute positions they do not have numbers, so dial is not a good name in that context.

Posted on March 29, 2018 at 11:58

I think we've done this discussion to death, and the censor problem has been resolved anyhow - see: 

https://community.st.com/0D70X000006SwP4SAK

 
Posted on March 29, 2018 at 12:21

Having had plenty of exposure to the english language (neither my native one), I never came across k-n-o-b in THIS particular context.

Perhaps I never consorted with the 'proper' circles.

But back to the topic.

There are so-called 'electronic potentiometers', with digital interfacing.

Perhaps such devices fulfill your requirements.

Posted on March 30, 2018 at 01:09

Mad magazine made at least 'door knob' familiar to me. :)

I have, unfortunately, no decision power there. The encoder is already selected.

Posted on March 30, 2018 at 12:01

I know of no simple way of making the timer 'saturate', but you could do this easily in software when reading out the timer value, something along these lines:

global:

#define DIAL_VALUE_MIN 12

#define DIAL_VALUE_MAX 4253

uint16_t dialValue = DIAL_VALUE_MIN;

local:

uint16_t t;

static uint16_t oldt;

int32_t delta;

t = TIM3->CNT;

delta = (int32_t)(int16_t)(t - oldt);

delta += dialValue;

if (delta < DIAL_VALUE_MIN) delta = DIAL_VALUE_MIN;

else if (delta > DIAL_VALUE_MAX) delta = DIAL_VALUE_MAX;

dialValue = delta;

JW